ruby-on-rails - 如何从响应中找到 PayPal 定期付款的当前状态?

标签 ruby-on-rails ruby paypal

我正在使用此处找到的 paypal-sdk-rest gem 开发一个应用程序:https://github.com/paypal/PayPal-Ruby-SDK

当状态改变时,PayPal 向我服务器上的 Controller 发送一条 HTTP Post 消息。我让这个 Controller 保存了响应,这样我就可以了。

这是通过的:

{
"payment_cycle":"Monthly",
"txn_type":"recurring_payment_profile_created",
"last_name":"name of the buyer",
"next_payment_date":"03:00:00 Sep 23, 2015 PDT",
"residence_country":"BR",
"initial_payment_amount":"0.00",
"currency_code":"BRL",
"time_created":"06:56:01 Sep 23, 2015 PDT",
"verify_sign":"a long code",
"period_type":" Regular",
"payer_status":"unverified",
"tax":"0.00",
"payer_email":"an email",
"first_name":"the name",
"receiver_email":"an email",
"payer_id":"a short code",
"product_type":"1",
"shipping":"0.00",
"amount_per_cycle":"25.00",
"profile_status":"Active",
"charset":"windows-1252",
"notify_version":"3.8",
"amount":"25.00",
"outstanding_balance":"0.00",
"recurring_payment_id":"a short code",
"product_name":"Prata",
"ipn_track_id":"a short  code",
"controller":"notifications",
"action":"create"
}

我必须检查这笔付款的状态,并在我的服务器上更新。我需要知道它是否已获批准,是否由于某种原因待定或被拒绝。

我如何知道付款状态?

Obs:这个响应中 payer_status 和 profile_status 有什么区别?

最佳答案

付款人状态表示帐户持有人是否已通过 PayPal 验证。配置文件状态表示配置文件的状态。事件状态表示配置文件已创建且当前处于事件状态。

来自 PayPal 开发人员 Handling Recurring Payments文档:

The recurring payments actions you may take depend on the status of the profile.

A recurring payments profile can have one of the following status values:

ActiveProfile
PendingProfile
ExpiredProfile
SuspendedProfile
CancelledProfile

If PayPal successfully creates the profile, the profile has an ActiveProfile status. However, if a non-recurring initial payment fails and you set FAILEDINITAMTACTION to CancelOnFailure in the CreateRecurringPaymentsProfile request, PayPal creates the profile with a status of PendingProfile. The profile remains in this status until the initial payment either completes successfully or fails.

A profile has a status of ExpiredProfile when PayPal completes the total billing cycles for the optional trial and the regular payment periods.

您可以使用 GetRecurringPaymentsProfileDetails API 调用以获取付款配置文件的详细信息。它会告诉您交易是否成功以及下一个账单日期。

关于ruby-on-rails - 如何从响应中找到 PayPal 定期付款的当前状态?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32743157/

相关文章:

php - Paypal 拒绝网站教程中示例代码的凭据

ruby-on-rails - Rails 还是 Grails?

ruby-on-rails - 如何使用发条每小时输入数据?

javascript - 客户端图像处理

ruby-on-rails - 为多个站点创建可重用博客组件的最佳方式

javascript - 为什么 Settimeout 不拉取更新后的图片 URL?

ruby-on-rails - 在rails中需要一个gem

ruby-on-rails - 如何在 Rails 中仅获取 GET 和 POST 参数作为哈希值?

javascript - 带有智能支付按钮的 PayPal Checkout (javascript) 创建订单问题

python - 我无法在 Paypal 支付集成中预填手机号码