- xml - AJAX/Jquery XML 解析
- 具有多重继承的 XML 模式
- .net - 枚举序列化 Json 与 XML
- XML 简单类型、简单内容、复杂类型、复杂内容
我正在尝试将 ActiveMerchant 集成到我的 Rails 应用程序中。我有某些计划,如果订阅则限制用户访问。因为你们所有人可能都知道什么是基于订阅的应用程序,所以我不打算解释我的应用程序。请给我一些实现这一目标的例子。我已经看过 railscasts 第 141 到 146 集,但 Ryan 只演示了 Paypal Web Payments Standard 和 Paypal Web Payments Pro。我也阅读了很多博客,但没有帮助。
请帮忙。
提前致谢。
最佳答案
迟到总比不到好吧?
ActiveMerchant 的实际主分支包含一个集成到 PaypalGateway
和 PaypalExpressGateway
中的循环类。
这是一个有效的演示片段。我只是不确定有几点(我会在弄清楚后立即更新答案),它们是:
:initial_amount
,仅设置结算协议(protocol)不会显示任何价格。包含项目将在 billing_agreement[:description]
上方显示该项目的价格。所以我不确定这会如何影响捕获,这是我最近正在测试的内容。IPN 通知。以下代码段中缺少它们。更新如下...
class PaymentsController < ApplicationController
include ActiveMerchant::Billing
# GET /subscriptions/:id/checkout
def checkout
payment_request = PAYPAL_EXPRESS_GATEWAY.setup_purchase(@subscription.price_in_cents,
:billing_agreement => {
:type => 'RecurringPayments',
:description => 'Subscription agreement',
},
:currency => 'CHF',
:no_shipping => true,
:allow_guest_checkout => true,
:allow_note => false,
:initial_amount => @subscription.price_in_cents,
:locale => 'de',
:ip => request.remote_ip,
:return_url => url_for(:action => :confirm, :only_path => false),
:cancel_return_url => url_for(:action => :cancel, :only_path => false),
# Looks like :notify_url is not used here, but in the next section
)
if payment_request.success?
redirect_to PAYPAL_EXPRESS_GATEWAY.redirect_url_for(payment_request.token)
else
# Render something informal
render :text => payment_request.inspect.to_s and return
end
end
# POST /subscriptions/:id/confirm
# params having token and PayerID
def confirm
profile = PAYPAL_EXPRESS_GATEWAY.recurring(@subscription.price_in_cents, nil,
:description => 'Subscription agreement',
:start_date => Date.tomorrow, # PayPal throws an error if the date is not in the future
:period => 'Year',
:frequency => 1,
:amount => @subscription.price_in_cents,
:currency => 'CHF',
:initial_amount => @subscription.price_in_cents,
:auto_bill_outstanding => true,
:token => params[:token]
)
# profile has profile_id and profile_status. remember status because this gets updated via IPN.
@debug = {:params => params.inspect.to_s, :profile => profile.inspect.to_s }
# Render something informal
render :text => @debug.to_s and return
end
# implement instead of just log
def notification
log = Logger.new 'log/ipn.log'
log.debug params.inspect
render :text => params.inspect.to_s and return
end
# Private methods omitted
end
您想查看PaypalRecurringAPI和 PaypalExpressGateway/PayPalGateway查看处理了哪些选项以及在 xml 请求的哪个位置。
编辑 关于 paypal 和经常性计费的更新、修订的截屏视频是通过单独的 paypal-recurring 完成的。 gem 。如果您不能让它与 ActiveMerchant 一起使用,这可能会有所帮助。
关于ruby-on-rails - ActiveMerchant 是否支持基于订阅的交易,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4154302/
嗨我想使用 activemerchant 实现 credit() 方法。为此,我正在使用 PaypalExpress Gateway。当我显示 Activemerchant 的 Rdoc 时,我看到了
我正在使用 Activemerchant 在我的应用程序中集成 Paypal 服务。 现在我想知道如何使用 ActiveMerchant 向银行或信用卡付款? 例如:我是卖家,我想付一些钱给某人。我想
有时,在本地开发时,我的连接会下降,虽然这希望不会在生产中发生,但它会引发一个问题,即当 ActiveMerchant 发送到支付网关(在我的情况下发送到 SagePay)时,我可能应该处理来自 Ac
我在哪里可以找到 ActiveMerchant 的完整示例集成使用?我可以看到大量的网关使用示例,但看不到应该如何使用集成(例如,您在 return_url 和 cancel_return_url C
我在 Ruby 1.9.3 和 Rails 3.1 中使用 ActiveMerchant gem 我已经使用 WebPayments Pro 在 PayPal 上设置了买家虚拟账户和卖家虚拟账户。当我
我正在尝试使用 ActiveMerchant 创建一个 Paypal express 交易。有没有办法将收款人设置为负责支付任何应计费用的实体? payment_hash = { ip: ip
Active Merchant 似乎是一个不错的支付工具。但是,我需要能够保存客户的付款信息,然后在以后从卡中扣款(即,在发货时而不是在下订单时)。 两者都是Braintree和 Stripe有一种方
我正在尝试将 ActiveMerchant 集成到我的 Rails 应用程序中。我有某些计划,如果订阅则限制用户访问。因为你们所有人可能都知道什么是基于订阅的应用程序,所以我不打算解释我的应用程序。请
我使用 ActiveMerchant 和 Braintree 作为我的支付处理器。我想利用 Braintree 的客户保险库功能来存储信用卡信息。 存储正常,但我无法找出使用 customer_vau
我正在尝试研究如何在我现有的网站上添加基于订阅的付费模式,但遇到了很多相互矛盾的信息,让我有点迷茫。 我所需要的只是一种通过信用卡设置定期计费(每月)的非常简单的方法。我只需要一个简单的解决方案,但很
这可能是对 Payflow Pro 技术支持的更多问题,但无论如何。我们正在尝试使用 ActiveMerchant 通过 Payflow Pro 付款实现对一张信用卡的重复收费。我们需要客户提供一次信
根据 this , ActiveMerchant PayPal Express Gateway 初始化如下: paypal_options = { login: "API_USERNAME_HER
如果我的货币不是“美元”,我无法通过 activemerchant 进行购买这是来自 response.message 的错误文本消息:指定的交易货币必须与之前指定的相同。 这是购买设置: respo
我正在与 ActiveMerchant 合作,结帐流程将完成,最终用户将被收取正确的金额,但在通过 paypal 发送给最终用户的收据上以及在 paypal 后端,商品标题和描述缺失.但它们确实出现在
我有一个 Rails 应用程序,其中包含付款表格。如图所示the official website ,我像这样创建一张新信用卡: attributes = params[:credit_card] c
多年来,我一直在 ruby 1.8 上使用旧版本的 active_merchant (v1.8) 向 SagePay 支付网上商店的款项,三天前它停止工作了。我查看了日志并发现了这些错误: Ope
Rails 有类似 ActiveMerchant 的框架和 Freemium (使用 ActiveMerchant)来简化支付处理。其他编程语言(例如 PHP 或 Python)还有哪些其他框架? 最
我正在构建一个应用程序来处理不同服务的不同类型的交易,例如订阅、礼品订阅和购买。 我对礼品交易和 activemerchant 有疑问。我将简要概述其工作原理。 用户创建礼物订阅并为其填写数据,它存储
我需要使用 ActiveMerchant 库在我们的一个 Rails 应用程序中设置支付解决方案。尽管这个问题非常主观,但人们对主要网关(BrainTree、Authorize.net 等)的体验如何
我正在尝试借助 railscasts 教程配置我的 paypal 网关和 activemerchant,但我有点困惑,因为网关信息已更改。 这是教程中的旧配置: gateway = ActiveMer
我是一名优秀的程序员,十分优秀!