首页
/ ActiveMerchant Patch for China 使用教程

ActiveMerchant Patch for China 使用教程

2024-08-25 23:06:30作者:江焘钦

项目介绍

activemerchant_patch_for_china 是一个 Rails 插件,旨在为中国的在线支付平台添加 ActiveMerchant 补丁。该项目支持多种支付平台,包括支付宝(Alipay)、快钱(99bill)、财付通(Tenpay)等。该插件由 Richard Huang 开发,并在 MIT 许可证下发布。

项目快速启动

安装

作为插件安装

script/plugin install git://github.com/Shopify/active_merchant.git
script/plugin install git://github.com/flyerhzm/activemerchant_patch_for_china.git

作为 Gem 安装

gem install activemerchant
gem install activemerchant_patch_for_china

配置

如果你将 activemerchantactivemerchant_patch_for_china 作为 Rails 插件安装,需要在 config/environment.rb 中定义插件加载顺序,确保 activemerchant_patch_for_chinaactivemerchant 之后加载:

config.plugins = [:all, :active_merchant, :activemerchant_patch_for_china]

应用案例和最佳实践

使用支付宝(Alipay)

以下是一个使用支付宝的示例:

require 'active_merchant'
require 'active_merchant/billing/integrations/action_view_helper'

ActionView::Base.send(:include, ActiveMerchant::Billing::Integrations::ActionViewHelper)

在视图中使用支付宝支付:

<%= payment_service_for 'order_id', 'your_alipay_account', :service => :alipay do |service|
  service.seller_email 'your_alipay_account@example.com'
  service.item_name 'Order #123'
  service.amount '100.00'
  service.return_url 'http://yourwebsite.com/payment_return'
  service.notify_url 'http://yourwebsite.com/payment_notify'
end %>

典型生态项目

ActiveMerchant

ActiveMerchant 是一个用于处理支付网关的 Ruby 库,支持多种支付服务提供商。它是 Shopify 开发的一个开源项目,广泛用于电子商务应用中。

其他相关项目

  • Alipay Gem: 专门用于集成支付宝的 Ruby Gem。
  • 99bill Gem: 专门用于集成快钱的 Ruby Gem。
  • Tenpay Gem: 专门用于集成财付通的 Ruby Gem。

这些项目共同构成了一个完整的支付生态系统,为开发者提供了丰富的选择和灵活的集成方式。

登录后查看全文
热门项目推荐

热门内容推荐

项目优选

收起
openHiTLS-examplesopenHiTLS-examples
本仓将为广大高校开发者提供开源实践和创新开发平台,收集和展示openHiTLS示例代码及创新应用,欢迎大家投稿,让全世界看到您的精巧密码实现设计,也让更多人通过您的优秀成果,理解、喜爱上密码技术。
C
52
461
kernelkernel
deepin linux kernel
C
22
5
openHiTLSopenHiTLS
旨在打造算法先进、性能卓越、高效敏捷、安全可靠的密码套件,通过轻量级、可剪裁的软件技术架构满足各行业不同场景的多样化要求,让密码技术应用更简单,同时探索后量子等先进算法创新实践,构建密码前沿技术底座!
C
349
381
nop-entropynop-entropy
Nop Platform 2.0是基于可逆计算理论实现的采用面向语言编程范式的新一代低代码开发平台,包含基于全新原理从零开始研发的GraphQL引擎、ORM引擎、工作流引擎、报表引擎、规则引擎、批处理引引擎等完整设计。nop-entropy是它的后端部分,采用java语言实现,可选择集成Spring框架或者Quarkus框架。中小企业可以免费商用
Java
7
0
openGauss-serveropenGauss-server
openGauss kernel ~ openGauss is an open source relational database management system
C++
131
185
RuoYi-Vue3RuoYi-Vue3
🎉 (RuoYi)官方仓库 基于SpringBoot,Spring Security,JWT,Vue3 & Vite、Element Plus 的前后端分离权限管理系统
Vue
873
517
Cangjie-ExamplesCangjie-Examples
本仓将收集和展示高质量的仓颉示例代码,欢迎大家投稿,让全世界看到您的妙趣设计,也让更多人通过您的编码理解和喜爱仓颉语言。
Cangjie
336
1.09 K
ohos_react_nativeohos_react_native
React Native鸿蒙化仓库
C++
179
264
cherry-studiocherry-studio
🍒 Cherry Studio 是一款支持多个 LLM 提供商的桌面客户端
TypeScript
608
59
note-gennote-gen
一款跨平台的 Markdown AI 笔记软件,致力于使用 AI 建立记录和写作的桥梁。
TSX
83
4