简体   繁体   English

我们如何从贝宝获得交易费用金额?

[英]How do we get transaction fee amount from paypal?

I am using PayPal iOS sdk to accept payment from user in my iOS app. 我正在使用PayPal iOS SDK接受我的iOS应用中来自用户的付款。 I am using sandbox for testing. 我正在使用沙箱进行测试。 The payment is working fine, I am getting successful payment response along with Payment_ID. 付款工作正常,我收到了Payment_ID和成功的付款响应。 I am passing that Payment_ID to my server and from there using REST API (Show payment details), I am trying to retrieve all the information related to that payment but it is not consistent response. 我正在将该Payment_ID传递到我的服务器,并使用REST API(显示付款明细)从那里传递,我试图检索与该付款相关的所有信息,但响应不一致。

Sometimes I am getting transaction_fee while sometimes it does not return in API response. 有时我会收到transaction_fee,而有时它不会在API响应中返回。

I see there is another NVP/SOAP method to get details but that requires transaction_id while i am only having Payment_ID. 我看到还有另一种NVP / SOAP方法来获取详细信息,但是当我只有Payment_ID时,它需要transaction_id。

does anyone have solution on how to get transaction fee from paypal? 有没有人关于如何从贝宝获得交易费的解决方案?

I got the solution now! 我现在有了解决方案!

I was receiving Payment_ID in response from from Paypal iOS SDk after payment successfully done. 付款成功完成后,我从Paypal iOS SDk收到了Payment_ID作为响应。 I am passing that to my server and the server is calling Show payment details REST API to get all payment details 我将其传递给服务器,服务器正在调用显示付款明细REST API以获取所有付款明细

GET /v1/payments/payment/payment_id GET / v1 /付款/付款/ payment_id

In above API response for some cases when transaction state is completed , paypal does not returning transaction_fee_amount . 在上述API响应中,在某些情况下,当事务状态完成时 ,贝宝不会返回transaction_fee_amount but it returns sale-->id (transactionId) . 但它返回sale-> id(transactionId)

Using Paypal PHP Library, I used that transactionId and made NVP call for below API, https://developer.paypal.com/docs/classic/api/merchant/GetTransactionDetails_API_Operation_NVP/ 使用Paypal PHP库,我使用了transactionId并对以下API进行了NVP调用:https://developer.paypal.com/docs/classic/api/merchant/GetTransactionDetails_API_Operation_NVP/

Voila!! 瞧! In successfull response of that I am getting all the details for that transaction. 为此,我得到了交易的所有详细信息。

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

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