How do I use the PayPal API to determine shipping charges for a transaction?
There's no straightforward way to calculate the shipping charges with the API. However, you can calculate the shipping charges using the following formula:
To determine these values, use the GetTransactionDetails API for the transaction in question, and then follow these guidelines:
- GetTransactionDetailsResponseType contains a PaymentTransactionType object.
- The PaymentTransactionType object contains a PaymentInfoType object, and a PaymentItemInfoType object.
- The PaymentItemInfoType object contains an array of PaymentItemType objects.
- Order Total is available as the "grossAmount" field in the PaymentInfoType object.
- Tax is available as the "TaxAmount" field in the PaymentInfoType object.
- Item Total is the sum of the "amount" fields for all of the entries in the PaymentItemType array in the PaymentItemInfoType object.
GetTransactionDetails API Operation (NVP and SOAP)