Help Article

Ask the Community

Find answers or join the conversation in the Community Help Forum.

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:
 
Shipping Charges = Order Total - Tax - Item Total

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.
We’re sorry, the page you’re looking for is no longer available. Please try your search again in our Help Centre if you have a question or want to contact us.