Updating Shipping details for digital orders using PayPal API

42 Views Asked by At

I am using paypal Standard checkout using Rest API for digital orders. As soon as the client pay, the order is marked as COMPLETED. Now, I have to update the shipping details by going to txn page => Add Tracking info => Select order status => Order processed (Tracking no. not required) => submit.

enter image description here

I tried to do this using API by first getting the orderID from https://api.paypal.com/v2/payments/captures/{payment ID} and then getting the order details from https://api.paypal.com/v2/checkout/orders/{order_id};

But couldn't understand how do I update this status and which endpoint will work? Updating a number of orders manually is very tedious.

1

There are 1 best solutions below

0
Preston PHX On

See the add package tracking documentation.

Here is an example API request that adds tracking to an order. The items sent are the same as the ones in the original create/capture order (sku values must match)

POST to https://api-m.sandbox.paypal.com/v2/checkout/orders/5O190127TN364715T/track

{ 
"capture_id": "8MC585209K746392H", 
"tracking_number": "443844607820", 
"carrier": "FEDEX", 
"notify_payer": true, 
"items": [{
  "sku": "sku01",
  "quantity": "1",
  "name": "T-Shirt",
  "description": "Green T-Shirt",
  "image_url": "https://example.com/static/images/items/1/tshirt_green.jpg",
  "url": "https://example.com/url-to-the-item-being-purchased-1",
  "upc": {
    "type": "UPC-A",
    "code": "123456789012"
  }
}, {
  "sku": "sku02",
  "quantity": "2",
  "name": "Shoes",
  "description": "Running, Size 10.5",
  "image_url": "https://example.com/static/images/items/1/shoes_running.jpg",
  "url": "https://example.com/url-to-the-item-being-purchased-2",
  "upc": {
    "type": "UPC-A",
    "code": "987654321012"
  }
}]
}

Since your question is about digital orders (no physical items), tracking is less useful. The best solution in your case may be to create/capture the order with no shipping information. The parameter to set is payment_source.paypal.experience_context.shipping_preference = "NO_SHIPPING"

Additionally, when including an items array, each item's category can be set to DIGITAL_GOODS