How do we get transaction fee amount from paypal?

血红的双手。 提交于 2019-12-12 04:22:02

问题


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.

Sometimes I am getting transaction_fee while sometimes it does not return in API response.

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?


回答1:


I got the solution now!

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

GET /v1/payments/payment/payment_id

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).

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!! In successfull response of that I am getting all the details for that transaction.



来源:https://stackoverflow.com/questions/39717164/how-do-we-get-transaction-fee-amount-from-paypal

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!