如何从响应中找到PayPal经常性付款的当前状态



我正在使用paypal-sdk-rest gem在这里找到的应用程序:https://github.com/paypal/PayPal-Ruby-SDK

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

这是传递的内容:

{
"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验证。配置文件状态指配置文件的状态。Active状态表示概要文件已创建,并且当前处于活动状态。

来自PayPal开发者处理经常性付款文档:

您可能采取的经常性付款操作取决于的状态概要。

定期付款配置文件可以具有以下状态之一价值观:

ActiveProfile
PendingProfile
ExpiredProfile
SuspendedProfile
CancelledProfile

如果PayPal成功创建配置文件,则配置文件有 ActiveProfile 状态。但是,如果是非经常性的首次付款中的 failedinamtaction 设置为CancelOnFailureCreateRecurringPaymentsProfile请求,PayPal创建配置文件状态为PendingProfile概要文件将保持此状态直到初始支付成功或失败。

配置文件的状态为ExpiredProfile可选试用版和定期付款的总计费周期期。

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

response = PayPal::Recurring.new(profile_id: "I-VCEL6TRG35CU").send(:profile)
response.status

它会像这样返回:active,: cancelled

最新更新