Add Tracking API Integration Guide
Last updated: Oct 23rd, 11:28pm
Merchants can use the PayPal Add Tracking API to manage tracking information.
Merchants can add tracking numbers and associated information to PayPal. Merchants can add tracking information with or without tracking numbers.
After adding these details to PayPal, merchants can:
- Update or cancel tracking information.
- Show tracking details.
1. Set up your development environment
Before you can integrate package tracking, you must set up your development environment. After you get a token that lets you access protected REST API resources, you create sandbox accounts to test your web and mobile apps. For details, see Get started.
2. Add tracking information with tracking numbers
You can add tracking information with or without tracking numbers for up to 20 PayPal transactions.
To add tracking information for multiple transactions, include these parameters in the request body:
Request parameter | Type | Required | Description |
---|---|---|---|
transaction_id |
string |
Required | The PayPal transaction ID. |
tracking_number |
string |
Optional (Note: Required for tangible goods shipments) |
The tracking number for the shipment. To add tracking information without tracking numbers, omit this parameter. When a call includes tracking_number , you also need to pass carrier information using the carrier parameter. |
tracking_number_type |
enum |
Optional | The type of tracking number. The possible values are:
|
status |
string |
Required | The status of the item shipment. For the supported statuses, see shipping statuses. |
shipment_date |
string |
Optional | The date when the shipment occurred, in Internet date and time format. Minimum length: 10. Maximum length: 10. |
carrier |
enum |
Optional (Note: Required when tracking_number is provided) |
The carrier for the shipment. If your carrier name is not in the list, set carrier to OTHER and set carrier name in carrier_name_other . For the supported carriers, see Carriers. |
carrier_name_other |
string |
Optional | The name of the carrier for the shipment. Required only if the carrier parameter is OTHER . |
notify_buyer |
boolean |
Optional | If true , sends an email notification to the buyer of the PayPal transaction. The email contains the tracking information uploaded in the API. Default is false . |
last_updated_time |
string |
The date and time when the tracking information was last updated, in Internet date and time format. Minimum length: 20. Maximum length: 64. |
For parameter details, see parameters.
The following request adds tracking information with tracking numbers for multiple PayPal transactions:
1curl -v -X POST https://api-m.sandbox.paypal.com/v1/shipping/trackers-batch \2 -H "Content-Type: application/json" \3 -H "Authorization: Bearer Access-Token" \4 -d '{5 "trackers": [6 {7 "transaction_id": "8MC585209K746392H",8 "tracking_number": "443844607820",9 "status": "SHIPPED",10 "carrier": "FEDEX"11 },12 {13 "transaction_id": "53Y56775AE587553X",14 "tracking_number": "443844607821",15 "status": "SHIPPED",16 "carrier": "FEDEX"17 }18 ]19}'
A successful request returns the HTTP 200 OK
status code and a JSON response body that list tracking information:
1{2 "tracker_identifiers": [3 {4 "transaction_id": "8MC585209K746392H",5 "tracking_number": "443844607820",6 "links": [7 {8 "href": "https://api-m.sandbox.paypal.com/v1/shipping/trackers/8MC585209K746392H-443844607820",9 "rel": "self",10 "method": "GET"11 },12 {13 "href": "https://api-m.sandbox.paypal.com/v1/shipping/trackers/8MC585209K746392H-443844607820",14 "rel": "replace",15 "method": "PUT"16 }17 ]18 },19 {20 "transaction_id": "53Y56775AE587553X",21 "tracking_number": "443844607821",22 "links": [23 {24 "href": "https://api-m.sandbox.paypal.com/v1/shipping/trackers/53Y56775AE587553X-443844607821",25 "rel": "self",26 "method": "GET"27 },28 {29 "href": "https://api-m.sandbox.paypal.com/v1/shipping/trackers/53Y56775AE587553X-443844607821",30 "rel": "replace",31 "method": "PUT"32 }33 ]34 }35 ],36 "errors": [37 {38 "name": "RESOURCE_NOT_FOUND",39 "debug_id": "46735c7461f3d",40 "message": "The specified resource does not exist.",41 "details": [42 {43 "field": "/trackers/0/transaction_id",44 "value": "8MC585309K746392H",45 "location": "body",46 "issue": "INVALID_TRANSACTION_ID"47 }48 ]49 }50 ],51 "links": [52 {53 "href": "https://api-m.sandbox.paypal.com/v1/shipping/trackers-batch",54 "rel": "self",55 "method": "POST"56 }57 ]58}
3. Add tracking information without tracking numbers
You can add tracking information with or without tracking numbers for up to 20 PayPal transactions.
To add tracking information for multiple transactions, include these parameters in the request body:
Request parameter | Type | Required | Description |
---|---|---|---|
transaction_id |
string |
Required | The PayPal transaction ID. |
tracking_number |
string |
Optional | The tracking number for the shipment. To add tracking information without tracking numbers, omit this parameter. |
tracking_number_type |
enum |
Optional | The type of tracking number. The possible values are:
|
status |
string |
Required | The status of the item shipment. For the supported statuses, see shipping statuses. |
shipment_date |
string |
Optional | The date when the shipment occurred, in Internet date and time format. Minimum length: 10. Maximum length: 10. |
carrier |
enum |
Optional | The carrier for the shipment. If your carrier name is not in the list, set carrier to OTHER and set carrier name in carrier_name_other . For the supported carriers, see Carriers. |
carrier_name_other |
string |
Optional | The name of the carrier for the shipment. Required only if the carrier parameter is OTHER . |
notify_buyer |
boolean |
Optional | If true , sends an email notification to the buyer of the PayPal transaction. The email contains the tracking information uploaded in the API. Default is false . |
last_updated_time |
string |
The date and time when the tracking information was last updated, in Internet date and time format. Minimum length: 20. Maximum length: 64. |
For parameter details, see parameters.
The following request adds tracking information without a tracking number for a PayPal transaction:
1curl -v -k -X POST 'https://api-m.sandbox.paypal.com/v1/shipping/trackers-batch' \2 -H 'Content-Type: application/json' \3 -d '{4 "trackers": [{5 "transaction_id": "8MC585209K746392H",6 "status": "SHIPPED"7 }]8}'
A successful request returns the HTTP 200 OK
status code with a JSON response body that lists tracking information for each transaction:
1{2 "tracker_identifiers": [{3 "transaction_id": "8MC585209K746392H",4 "links": [{5 "href": "https://api-m.sandbox.paypal.com/v1/shipping/trackers/8MC585209K746392H-NOTRACKER",6 "rel": "self",7 "method": "GET"8 }, {9 "href": "https://api-m.sandbox.paypal.com/v1/shipping/trackers/8MC585209K746392H-NOTRACKER",10 "rel": "replace",11 "method": "PUT"12 }, {13 "href": "https://api-m.sandbox.paypal.com/v1/shipping/trackers/8MC585209K746392H-NOTRACKER",14 "rel": "edit",15 "method": "PATCH"16 }]17 }]18}
4. Show tracking information
To show tracking information, call GET https://api-m.sandbox.paypal.com/v1/shipping/trackers/<transactionId>-<trackingnumber>
.
You can filter this information by including search criteria in the request.
The following request searches for tracking information for a tracking number:
1curl -v -X GET https://api-m.sandbox.paypal.com/v1/shipping/trackers/123456789-XYZ123456 \2 -H "Content-Type: application/json" \3 -H "Authorization: Bearer <Access-Token>"
A successful request returns the HTTP 200 OK
status code and any tracking information that matches the search criteria:
1{2 "transaction_id": "123456789",3 "tracking_number": "XYZ123456",4 "status": "SHIPPED",5 "shipment_date": "2015-05-31",6 "carrier": "FEDEX",7 "links": [{8 "href": "https://api-m.sandbox.paypal.com/v1/shipping/trackers-batch/123456789-XYZ123456",9 "rel": "self"10 }, {11 "href": "https://api-m.sandbox.paypal.com/v1/shipping/trackers-batch/123456789-XYZ123456",12 "rel": "replace",13 "method": "PUT"14 }, {15 "href": "https://api-m.sandbox.paypal.com/v1/shipping/trackers-batch",16 "rel": "create",17 "method": "POST"18 }]19}
5. Update or cancel tracking information
To update tracking information, include the tracking ID in the request URL and the information to change in the request body:
1curl -v -X PUT https://api-m.sandbox.paypal.com/v1/shipping/trackers/8MC585209K746392H-443844607820 \2-H "Content-Type: application/json" \3-H "Authorization: Bearer Access-Token" \4-d '{5 "transaction_id": "8MC585209K746392H",6 "tracking_number": "443844607820",7 "status": "SHIPPED",8 "carrier": "FEDEX"9}'
A successful request returns the HTTP 204 No Content
status code with no JSON response body.
To cancel tracking information, call the update tracking information method and set the status
to CANCELLED
:
1curl -v -k -X PUT 'https://api-m.sandbox.paypal.com/v1/shipping/trackers/8MC585209K746392H-443844607820' \2 -H 'Content-Type: application/json' \3 -d '{4 "transaction_id": "8MC585209K746392H",5 "tracking_number": "443844607820",6 "status": "CANCELLED",7 "carrier": "FEDEX"8}'
A successful request returns the HTTP 204 No Content
status code with no JSON response body.