How do I disable shipping in invoice from paypal api V2

Viewed 47

I'm making an application to send invoices via Paypal's REST API (https://developer.paypal.com/docs/api/invoicing/v2/) but I cannot seem to find a way to disable shipping, is this possible to do?

I have tried to mess with "shipping_preference" and tried to find an answer, but I cannot seem to find any information about this.

1 Answers

Through much trial and error, I found a solution to hide Shipping in the emailed invoice. This solution indirectly changes the (unconfigurable) category_code in the invoice from 'SHIPPING' to 'SERVICES'.

The Invoicing API documentation displays an array for shipping. In all my tests, sending the request with no tax and no shipping arrays, the API response had failed, declaring 'unable to parse'. Note that the below does not contain shipping.

In the (required) amount group of the API request, having the info below, has now solved this issue.

 'amount' => 
 array (
   'breakdown' => 
   array (
     'item_total' => 
     array (
       'currency_code' => 'USD',
       'value' => '14.00',          // <- calculate
     ),
     'discount' => 
     array (
       'invoice_discount' => 
       array (
         'amount' => 
         array (
           'currency_code' => 'USD',
           'value' => '0.00',       // <- calculate (for invoice)
         ),
       ),
       'item_discount' => 
       array (
         'currency_code' => 'USD',
         'value' => '0.00',         // <- calculate (for each item)
       ),
     ),
     'tax_total' => 
     array (
       'currency_code' => 'USD',
       'value' => '0.00',           // <- calculate
     ),
   ),
   'currency_code' => 'USD',
   'value' => '14.00',              // <- calculate 
 ),
Related