gpt4 book ai didi

ios - 使用 iOS Paypal SDK 进行付款验证 - 请澄清一下

转载 作者:太空宇宙 更新时间:2023-11-03 16:09:43 25 4
gpt4 key购买 nike

我有一个关于 Paypal 验证方面的具体问题(使用最新的 iOS PayPal SDK)

来自这份文件:https://github.com/paypal/PayPal-iOS-SDK/blob/master/docs/single_payment.md

这里提到:

Send the payment response to your servers for verification, as well as any other processing required for your business, such as fulfillment. Tip: At this point, the payment has been completed, and the user has been charged. If you can't reach your server, it is important that you save the proof of payment and try again later.

还有一个指向验证移动支付文档的链接,其中提到了各种内容,我假设这部分适用于 iOS SDK(最新)

Looking up a payment using the REST API You can payment id value in a response to look up a payment by calling the REST API. The following example retrieves a payment in the sandbox:

curl https://api.sandbox.paypal.com/v1/payments/payment/PAY-5YK922393D847794YKER7MUI \ -H "Content-Type: application/json" \ -H "Authorization: Bearer {accessToken}" You should verify that the Payment:

Is approved ("state": "approved"). Contains a Transaction with: An Amount with total and currency that match your expectation. A Sale that is completed (in related_resources, with "state": "completed"). The live endpoint is https://api.paypal.com/v1/payments/payment/{payment_id}.

https://developer.paypal.com/webapps/developer/docs/integration/mobile/verify-mobile-payment/

明白了。因此,鉴于上述假设(我希望是正确的!)应该如何处理从服务器返回的详细信息?将它们保存到数据库?

就这个特定主题而言,文档似乎有点含糊。这是我对流程的理解:

1) 付款。

2) 将付款明细发送到服务器。

3) 从服务器获取支付状态。

4) 检查它是否已获批准以及其他详细信息是否匹配(金额、货币等)

5) 再次付款时,查看付款ID是否已被使用?这是我困惑的另一部分。

提前感谢您的帮助。只是想用外行的术语进行一些澄清,看看我是否正确理解了流程。

最佳答案

您将从 sdk 中获得一个响应,其中包含一个 stateidid 你应该为了你的目的保存到数据库中,因为你总是可以调用 /payments/id https://developer.paypal.com/webapps/developer/docs/api/#look-up-a-payment-resource并查看它的详细信息。每个 id 都是唯一的。 state 将提供更多信息,说明支付是否成功。请检查文档。希望对您有所帮助。

关于ios - 使用 iOS Paypal SDK 进行付款验证 - 请澄清一下,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22171828/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com