我们如何从贝宝获得交易手续费金额? [英] How do we get transaction fee amount from paypal?
问题描述
我正在使用PayPal iOS SDK接受我的iOS应用中来自用户的付款.我正在使用沙箱进行测试.付款工作正常,我已收到成功的付款响应以及Payment_ID.我正在将那个Payment_ID传递到我的服务器,并使用REST API(显示付款明细)从那里开始,我试图检索与该付款有关的所有信息,但响应不一致.
I am using PayPal iOS sdk to accept payment from user in my iOS app. I am using sandbox for testing. The payment is working fine, I am getting successful payment response along with 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.
有时我会收到transaction_fee,但有时它不会在API响应中返回.
Sometimes I am getting transaction_fee while sometimes it does not return in API response.
我看到还有另一种NVP/SOAP方法来获取详细信息,但是当我只有Payment_ID时,它需要transaction_id.
I see there is another NVP/SOAP method to get details but that requires transaction_id while i am only having Payment_ID.
有人能从贝宝那里获得交易费吗?
does anyone have solution on how to get transaction fee from paypal?
推荐答案
我现在有了解决方案!
付款成功后,我收到Paypal iOS SDk的付款ID.我将其传递给服务器,服务器正在调用显示付款明细REST API 以获取所有付款明细
I was receiving Payment_ID in response from from Paypal iOS SDk after payment successfully done. I am passing that to my server and the server is calling Show payment details REST API to get all payment details
获取/v1/付款/付款/payment_id
GET /v1/payments/payment/payment_id
在上述API响应中,对于某些情况,当交易状态为完成时,贝宝不会返回 transaction_fee_amount .但返回 sale-> id(transactionId).
In above API response for some cases when transaction state is completed, paypal does not returning transaction_fee_amount. but it returns sale-->id (transactionId).
我使用Paypal PHP库,使用了transactionId并针对以下API进行了NVP调用, https://developer.paypal.com/docs/classic/api/merchant/GetTransactionDetails_API_Operation_NVP/
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/
Voila !!为此,我得到了交易的所有详细信息.
Voila!! In successfull response of that I am getting all the details for that transaction.
这篇关于我们如何从贝宝获得交易手续费金额?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!