简体   繁体   English

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

[英]Payment verification with the iOS Paypal SDK - Clarification needed please

I have a specific question about the verification side of Paypal (using the latest iOS PayPal SDK) 我有一个关于Paypal验证方面的具体问题(使用最新的iOS PayPal SDK)

From this document: https://github.com/paypal/PayPal-iOS-SDK/blob/master/docs/single_payment.md 从此文档中获取: https : //github.com/paypal/PayPal-iOS-SDK/blob/master/docs/single_payment.md

This is mentioned: 这里提到:

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. 如果您无法访问服务器,请务必保存付款证明并稍后重试。

And from there is a link to the verify-mobile payments documentation, in which various things are mentioned, i'm assuming this part applies to the iOS SDK (latest) 并且从那里有一个指向验证移动支付文档的链接,其中提到了很多事情,我假设这部分适用于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. 使用REST API查找付款您可以在响应中通过调用REST API的付款ID值来查找付款。 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: curl https://api.sandbox.paypal.com/v1/payments/payment/PAY-5YK922393D847794YKER7MUI \\ -H“ Content-Type:application / json” \\ -H“ Authorization:Bearer {accessToken}”您应验证付款:

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"). 已完成的销售(在related_resources中,带有“ state”:“ completed”)。 The live endpoint is https://api.paypal.com/v1/payments/payment/ {payment_id}. 实时端点为https://api.paypal.com/v1/payments/payment/ {payment_id}。

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

Got it. 得到它了。 So given the above assumptions (which I hope are correct!) what should one do with the details returned from the server? 因此,鉴于上述假设(我希望是正确的!),该如何处理服务器返回的详细信息? Save them to a database? 将它们保存到数据库?

The docs seem to be a little vague in terms of this particular subject. 对于这个特定主题,文档似乎有些含糊。 This is my understanding of the flow: 这是我对流程的理解:

1) Make payment. 1)付款。

2) Send payment details to server. 2)将付款详细信息发送到服务器。

3) Get back payment state from server. 3)从服务器取回付款状态。

4) Check that it's approved and the other details match up (amount, currency etc) 4)检查它是否已批准,其他细节是否匹配(金额,货币等)

5) Upon making another payment, check to see if the payment id has already been used? 5)再次付款时,请检查是否已使用付款ID? This is another part of my confusion. 这是我困惑的另一部分。

Thank you in advance for any assistance. 预先感谢您的协助。 Just would like some clarification in layman's terms to see if I understand the flow correctly. 只是想对外行的术语进行澄清,以了解我是否正确理解流程。

from the sdk you will get a response which will have a state and id . 从sdk中,您将获得一个包含stateid的响应。 the id you should save to database for your purposes, because you can always call /payments/id https://developer.paypal.com/webapps/developer/docs/api/#look-up-a-payment-resource and see the details of it. 您应出于自身目的将其保存到数据库中的id ,因为您始终可以调用/payments/id https://developer.paypal.com/webapps/developer/docs/api/#look-up-a-payment-resource并查看细节。 Every id is unique. 每个id都是唯一的。 state will have more information if the payment has been successful or not. 如果付款成功或否, state将提供更多信息。 Please check documentation. 请检查文档。 Hope it helps. 希望能帮助到你。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM