How do we get transaction fee amount from paypal?

2019-09-11 18:52发布

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条回答
我命由我不由天
2楼-- · 2019-09-11 19:38

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.

查看更多
登录 后发表回答