使用Paypal自适应支付使用PayKey的工作流程

Cyr*_* N. 5 paypal paypal-adaptive-payments paykey

我正在尝试使用新的Paypal API(自适应支付)实施支付系统.

到目前为止,我有这个工作流程:

  • 向Paypal发送请求: AdaptivePayments/Pay
  • 这会创建一个Pay请求,并返回一个有效3小时的payKey(来源)
  • 现在,我等待paypal通过IPN向我发送请求.什么时候,我会得到pay_key
  • 使用此pay_key,我将致电AdaptivePayments/PaymentDetails了解付款状态.

但我想知道,如果超过3个小时我该怎么办?(比如退款吗?)

那么肯定的方法是什么?

谢谢你的帮助!

Cyr*_* N. 11

好吧,我会在那个问题上回答一下自己.

而不是在调用时使用payKey AdaptivePayments/Pay,而其他解决方案是使用trackingId.

这是如何做 :

第一步,创建一个AdaptivePayments/Pay并指定trackingId(必须是唯一的):

{
  "actionType":"PAY",
  "currencyCode":"USD",
  "receiverList":{"receiver":[{"amount":"1.00","email":"seller_1288085303_biz@gmail.com"}]},
  "returnUrl":"http://apigee.com/console/-1/handlePaypalReturn",
  "cancelUrl":"http://apigee.com/console/-1/handlePaypalCancel?",
  "trackingId":"abcde-12345-unique-of-course",
  "ipnNotificationUrl":"http://apigee.com/console/-1/ipn",
  "requestEnvelope":{"errorLanguage":"en_US", "detailLevel":"ReturnAll"}
}
Run Code Online (Sandbox Code Playgroud)

作为回应,您将拥有您将重定向买家的payKey,以便进行付款.

然后,对于此付款的整个演变,您将收到IPN网址的通知(此处为" http://apigee.com/console/-1/ipn ").

如果您在此地址收到(POST)请求,请检查paypal的有效性,您将获得trackingId参数.检查此trackingId是否存在,然后询问AdaptivePayments/PaymentDetails具有以下内容的trackingId:

{
 "trackingId":"{put here}",
 "requestEnvelope":{"errorLanguage":"en_US", "detailLevel":"ReturnAll"}
}
Run Code Online (Sandbox Code Playgroud)

并且您将获得完整的详细状态以作为回报.

现在,您完成更新数据库,致电买家等工作:)

什么对我有帮助:

  • 好一个!Paypal文档很复杂,很难理解这个过程. (2认同)