Add Tracking API
Add Tracking API
Merchants can use the PayPal Add Tracking API to manage tracking information. Merchants can add tracking numbers and associated information to PayPal. After adding these details to PayPal, merchants can:
Update tracking details.
Show tracking details.
Cancel tracking numbers.
For more information, see the Add Tracking API Overview and Add Tracking API Integration Guide.
- class python_paypal_api.api.Tracking(*args, **kwargs)
Use the /trackers resource to create and manage tracking information for PayPal transactions.
- put_tracking(self, id: str, **kwargs) ApiResponse
PUT /v1/shipping/trackers/{id}
Updates or cancels the tracking information for a PayPal transaction, by ID. To cancel tracking information, call this method and set the status to CANCELLED. For more information, see Update or cancel tracking information.
**args:
id string requiredThe ID of the tracker in thetransaction_id-tracking_number
format.**kwargs: Request body
status enum requiredThe status of the item shipment. For allowed values, see Shipping Statuses.The possible values are:CANCELLED
. The shipment was cancelled and the tracking number no longer applies.DELIVERED
. The item was already delivered when the tracking number was uploaded.LOCAL_PICKUP
. Either the buyer physically picked up the item or the seller delivered the item in person without involving any couriers or postal companies.ON_HOLD
. The item is on hold. Its shipment was temporarily stopped due to bad weather, a strike, customs, or another reason.SHIPPED
. The item was shipped and is on the way.SHIPMENT_CREATED
. The shipment was created.DROPPED_OFF
. The shipment was dropped off.IN_TRANSIT
. The shipment is in transit on its way to the buyer.RETURNED
. The shipment was returned.LABEL_PRINTED
. The label was printed for the shipment.ERROR
. An error occurred with the shipment.UNCONFIRMED
. The shipment is unconfirmed.PICKUP_FAILED
. Pick-up failed for the shipment.DELIVERY_DELAYED
. The delivery was delayed for the shipment.DELIVERY_SCHEDULED
. The delivery was scheduled for the shipment.DELIVERY_FAILED
. The delivery failed for the shipment.INRETURN
. The shipment is being returned.IN_PROCESS
. The shipment is in process.NEW
. The shipment is new.VOID
. If the shipment is cancelled for any reason, its state is void.PROCESSED
. The shipment was processed.NOT_SHIPPED
. The shipment was not shipped.
transaction_id string requiredThe PayPal transaction ID.carrier enum requiredThe carrier for the shipment. Some carriers have a global version as well as local subsidiaries. The subsidiaries are repeated over many countries and might also have an entry in the global list. Choose the carrier for your country. If the carrier is not available for your country, choose the global version of the carrier. If your carrier name is not in the list, set carrier_other_name to OTHER. For allowed values, see Carriers.The possible values are:ACOMMERCE
. aCommercePHL_2GO
. 2GO PhilippinesAU_DHL_EXPRESS
. DHL Express Australia.BEL_DHL
. DHL Belgium.DE_DHL_DEUTSHCE_POST_INTL_SHIPMENTS
. Deutsche Post DHL Post International GermanyIE_AN_POST_REGISTERED
. Post Registered IrelandAU_AU_POST
. Australian Postal CorporationSPEEDEXCOURIER
. Speedex Courier.UK_ROYALMAIL_SPECIAL
. Royal Mail Special Delivery UKFR_COLIS
. Colis France.VNPOST_EMS
. Post EMS Vietnam.NL_FEDEX
. Federal Express NetherlandsCN_EMS
. EMS China.IT_POSTE_ITALIANE
. Poste Italiane.HK_DHL_ECOMMERCE
. DHL eCommerce Hong Kong.ARAMEX
. Aramex.AU_OTHER
. Other - Australia.TW_CHUNGHWA_POST
. Chunghwa POST TaiwanDPEX
. DPEX WorldwidePOST_SERBIA
. Pošta SrbijePL_POCZTEX
. PocztexCNEXPS
. CN Express China.DIRECTLOG
. Directlog.ES_CORREOS_DE_ESPANA
. Correos de EspanaBE_KIALA
. Kiala Point BelgiumALPHAFAST
. Alphafast.UKR_POSHTA
. Ukrposhta - Ukraine’s National PostCN_FEDEX
. Federal Express ChinaBUYLOGIC
. BuylogicIT_DHL_ECOMMERCE
. DHL eCommerce Italy.NINJAVAN_MY
. Ninjavan Malaysia.JPN_YAMATO
. Yamato Japan.POSTNORD_LOGISTICS
. Post Nord Logistics.US_DHL_GLOBALFORWARDING
. DHL Global Forwarding US.IT_SGT
. SGT Corriere Espresso Italy.NINJAVAN_PHILIPPINES
. Ninja Van Philippines.EKART
. Ekart.IDN_WAHANA
. Wahana Indonesia.IDN_POS_INT
. Pos Indonesia International.DE_HERMES
. Hermes Germany.PRT_CHRONOPOST
. Chronopost Portugal.MYS_MYS_POST
. Pos MalaysiaWEBINTERPRET
. WebInterpret.BG_BULGARIAN_POST
. Bulgarian PostNL_TPG
. TPG Post NetherlandsCA_CANPAR
. Canpar Courier CanadaMYS_AIRPAK
. Airpak Malaysia.MEX_SENDA
. Senda Mexico.LANDMARK_GLOBAL
. Landmark Global.UK_NIGHTLINE
. Nightline UK.JP_UPS
. United Parcel Service JapanUK_DHL
. DHL UK.SG_SG_POST
. Singapore Post.PHL_AIRSPEED
. Airspeed Philippines.DHL
. DHL Express.KR_KOREA_POST
. Korea PostJP_KURO_NEKO_YAMATO_UNYUU
. Kuro Neko Yamato Unyuu JapanIE_AN_POST_SWIFTPOST
. Swift Post IrelandCUCKOOEXPRESS
. Cuckoo Express.FR_OTHER
. Other - France.FASTRAK_TH
. Fastrak Thailand.AU_DHL_ECOMMERCE
. DHL eCommerce Australia.DE_UPS
. United Parcel Service GermanyESHOPWORLD
. EShopWorld.INTERNATIONAL_BRIDGE
. International Bridge.FR_COLIPOSTE
. Coliposte FranceAU_AUSTRIAN_POST
. Austrian Post.IND_DELHIVERY
. Delhivery IndiaDE_TNT
. TNT Germany.GLOBAL_DHL
. DHL Global.US_DHL_PARCEL
. DHL Parcel US.NL_UPS
. United Parcel Service NetherlandsGB_APC
. APC Overnight UKIDN_TIKI
. Tiki Indonesia.HERMES
. Hermes.ESP_NACEX
. Nacex SpainNL_TNT
. TNT Netherlands.DE_FEDEX
. Federal Express GermanyOTHER
. Other.BONDSCOURIERS
. Bonds Couriers.IT_DHL_GLOBALFORWARDING
. DHL Global Forwarding Italy.IDN_LION_PARCEL
. Lion Parcel Indonesia.UK_YODEL
. Yodel UKIT_DHL_EXPRESS
. DHL Express Italy.PL_DHL_GLOBALFORWARDING
. DHL Global Forwarding PolandDPD_POLAND
. DPD Poland.AU_AUSTRALIA_POST_EXPRESS_POST_PLATINUM
. Australia Post Express Post PlatinumES_TNT
. TNT Spain.CN_DHL_EXPRESS
. DHL Express Canada.DE_DPD
. DPD Germany.DE_DPD_DELISTRACK
. DPD Delistrack GermanyCN_DHL_ECOMMERCE
. DHL eCommerce China.JP_TNT
. TNT Japan.PRT_CTT
. CTT Expresso PortugalUK_INTERLINK_EXPRESS
. Interlink Express UK.NLD_POSTNL
. PostNL NetherlandsCA_DHL_ECOMMERCE
. DHL eCommerce Canada.SWIFTAIR
. Swift Air.NOR_POSTEN
. Posten NorgeMEX_REDPACK
. Redpack Mexico.PL_MASTERLINK
. Masterlink PolandPL_TNT
. TNT Express PolandNIM_EXPRESS
. Nim ExpressPL_UPS
. United Parcel Service PolandUKR_NOVA
. Nova PoshtaQUANTIUM
. Quantium.SENDLE
. Sendle.SG_PARCELPOST
. Parcel Post Singapore.SG_NINJAVAN
. Ninjavan Singapore.BQC_EXPRESS
. BQC Express.RPD2MAN
. RPD2man DeliveriesTHA_KERRY
. Kerry Thailand.MEX_AEROFLASH
. Aeroflash Mexico.SPREADEL
. Spreadel.ESP_REDUR
. Redur SpainJP_JAPANPOST
. Japan PostARE_EMIRATES_POST
. Emirates Post GroupCN_CHINA_POST_EMS
. China Post EMS Express Mail ServiceUK_DHL_GLOBALFORWARDING
. DHL Global Forwarding UK.CN_SF_EXPRESS
. SF Express China.UK_FEDEX
. Federal Express UKPOL_POCZTA
. Poczta Poland.YANWEN
. Yanwen ExpressKOR_CJ
. CJ Korea.DE_DEUTSCHE_POST_DHL_WITHIN_EUROPE_TRACKNET
. Deutsche Post DHL Tracknet GermanyIND_XPRESSBEES
. XpressBees India.UK_TNT
. TNT UK.CJ_KOREA_THAI
. CJ Logistics in ThailandCN_OTHER
. Other - China.IDN_POS
. Indonesia Post.ABC_MAIL
. ABC Mail.UK_UPS
. United Parcel Service UKCHINA_POST
. China Post.PL_DHL_EXPRESS
. DHL Express Poland.ESP_SPANISH_SEUR
. Spanish Seur SpainSG_ZALORA
. Zalora Singapore.MATKAHUOLTO
. Matkahuoloto.FR_LAPOSTE
. Laposte France.KANGAROO_MY
. Kangaroo Express Malaysia.ESP_CORREOS
. Sociedad Estatal Correos y TelégrafosNL_KIALA
. KIALA NetherlandsIND_BLUEDART
. Blue Dart Express DHLTUR_PTT
. PTT Turkey.CA_CANNOT_PROVIDE_TRACKING
. Cannot provide tracking - Canada.JPN_SAGAWA
. Sagawa Japan.MYS_SKYNET
. Skynet Malaysia.IT_FERCAM
. Fercam Italy.UK_AIRBORNE_EXPRESS
. Airborne Express UK.CA_OTHER
. Other - Canada.DE_DEUTSHCE_POST_DHL_TRACK_TRACE_EXPRESS
. Deutsche Post DHL Track Trace Express GermanyCORREOS_DE_MEXICO
. Mex Post Correos de MexicoFR_DHL_GLOBALFORWARDING
. DHL Global Forwarding France.GLOBAL_SKYNET
. Skynet Global.AU_DHL_GLOBALFORWARDING
. DHL Global Forwarding Australia.DE_DHL_GLOBALFORWARDING
. DHL Global Forwarding Germany.SFC_LOGISTICS
. SFC LogisticsUS_GLOBEGISTICS
. Globeistics US.CA_DHL_GLOBALFORWARDING
. DHL Global Forwarding Canada.OMNIPARCEL
. Omni Parcel.PHL_AIR21
. Air21 PhilippinesCBL_LOGISTICA
. CBL LogísticaFR_MONDIAL
. Mondial France.DE_DHL_ECOMMERCE
. DHL eCommerce Germany.ADICIONAL
. Adicional.CH_SWISS_POST_PRIORITY
. Swiss Post PriorityNL_INTANGIBLE_DIGITAL_SERVICES
. Intangible Digital ServicesDE_ASENDIA
. Asendia Germany.NL_ABC_MAIL
. ABC Mail NetherlandsUK_DELTEC
. Deltec UK.ONE_WORLD
. One World.AIRBORNE_EXPRESS
. Airborne Express.ES_OTHER
. Other - Spain.US_DHL_ECOMMERCE
. DHL eCommerce USUS_ENSENDA
. Ensenda US.CPACKET
. Cpacket.IND_REDEXPRESS
. Red Express India.NL_LOCAL_PICKUP
. Local PickUp NetherlandsUK_ROYALMAIL_AIRSURE
. Royal Mail AirSure UKFR_TNT
. TNT France.RINCOS
. Rincos.B2CEUROPE
. B2C EuropePHL_LBC
. LBC Philippines.SG_TAQBIN
. TA-Q-BIN Parcel Singapore.GR_ELTA
. Elta Greece.WINIT
. WinIt.NLD_DHL
. DHL Netherlands.FR_GEODIS
. Geodis France.DE_DHL_PACKET
. DHL Packet Germany.ARG_OCA
. OCA ArgentiaJP_DHL
. DHL Japan.RUSSIAN_POST
. Russian Post.TW_TAIWAN_POST
. Chunghwa PostBE_BPOST
. Bpost BelgiumJP_SAGAWA_KYUU_BIN
. Sagawa Kyuu Bin JapanNATIONWIDE_MY
. Nationwide Malaysia.TNT
. TNT Portugal.COURIERS_PLEASE
. Couriers Please.DMM_NETWORK
. DMM Network.TOLL
. TollNONE
. NoneIDN_FIRST_LOGISTICS
. First Logistics Indonesia.BH_POSTA
. BH POŠTASENDIT
. SendIt.US_DHL_EXPRESS
. DHL Express US.FEDEX
. FedEx.SWE_POSTNORD
. PostNord SverigePHL_XEND_EXPRESS
. Xend Express Philippines.POSTI
. Posti.CA_CANADA_POST
. Canada PostPL_FEXEX
. Fexex PolandCN_EC
. EC China.HK_TAQBIN
. TA-Q-BIN Parcel Hong Kong.UK_AN_POST
. AddressPay UKWISELOADS
. Wiseloads.PRT_SEUR
. Seur PortugalUS_ONTRAC
. Ontrac US.THA_THAILAND_POST
. Thailand Post.DPE_EXPRESS
. DPE Express.UK_DHL_EXPRESS
. DHL Express UK.NL_DHL
. DHL NetherlandsHK_FLYT_EXPRESS
. Flyt Express Hong KongUK_HERMESWORLD
. Hermesworld UK.IT_REGISTER_MAIL
. Registered Mail Italy.ARG_CORREO
. Correo ArgentinoCA_LOOMIS
. Loomis Express CanadaDTDC_AU
. DTDC Australia.DPD
. DPD Global.ASENDIA_HK
. Asendia Hong Kong.UK_ROYALMAIL_RECORDED
. Royal Mail Recorded UKPL_POCZTA_POLSKA
. Poczta PolskaEU_IMX
. IMX EUIDN_PANDU
. Pandu Indonesia.MEX_ESTAFETA
. Estafeta MexicoSREKOREA
. SRE KoreaCYP_CYPRUS_POST
. Cyprus PostNZ_COURIER_POST
. CourierPost New ZealandCN_EMPS
. EMPS China.AU_TNT
. TNT Australia.UK_CANNOT_PROVIDE_TRACKING
. Cannot provide tracking - UK.ES_DHL
. DHL Spain.CONTINENTAL
. Continental.IND_DTDC
. DTDC India.UK_DPD
. DPD UK.IT_TNT
. TNT ItalyPL_DHL
. DHL Portugal.JP_NITTSU_PELICAN_BIN
. Nittsu Pelican Bin JapanTHA_DYNAMIC_LOGISTICS
. Dynamic Logistics Thailand.IT_POSTE_ITALIA
. Poste ItaliaUK_ROYALMAIL_INTER_SIGNED
. Royal Mail International Signed UKHERMES_IT
. Hermes Italy.FR_BERT
. Bert FranceIND_PROFESSIONAL_COURIERS
. Professional Couriers India.POL_SIODEMKA
. Siodemka Poland.IE_AN_POST_SDS_PRIORITY
. Post SDS Priority IrelandADSONE
. ADSone CumulusBRA_CORREIOS
. Correios Brazil.UBI_LOGISTICS
. UBI Logistics.ES_CORREOS
. Sociedad Estatal Correos y TelégrafosNGA_NIPOST
. Nigerian Postal ServiceAUT_AUSTRIAN_POST
. Austrian Post.AU_FASTWAY
. Fastway Australia.AUS_TOLL
. Toll Australia.CA_CANPAR_COURIER
. Canpar Courier Canada.SWE_DIRECTLINK
. Direct Link SwedenCZE_CESKA
. Česká poštaROYAL_MAIL
. Royal Mail.SG_SINGPOST
. SingPost SingaporeIT_OTHER
. Other - Italy.ZA_FASTWAY
. Fastway Couriers (South Africa)SEKOLOGISTICS
. Seko Logistics.CN_UPS
. CN_UPSHUNTER_EXPRESS
. Hunter Express.DE_DHL_PARCEL
. DHL Parcel Germany.NLD_TRANSMISSION
. Transmission Netherlands.CN_TNT
. TNT China.DE_DEUTSCHE
. Deutsche Post Germany.AIRSURE
. Airsure.UK_PARCELFORCE
. Parcelforce UK.SWE_DB
. DB Schenker SwedenCN_CHINA_POST
. China PostPL_GLS
. General Logistics Systems PolandEU_BPOST
. bpostRELAIS_COLIS
. Relais ColisUK_DHL_PARCEL
. DHL Parcel UK.AUS_STARTRACK
. StarTrack AustraliaAU_TOLL_IPEC
. Toll IPEC AustraliaCORREOS_CHILE
. CorreosChileCH_SWISS_POST_EXPRES
. Swiss Post ExpressMYS_TAQBIN
. TA-Q-BIN Parcel Malaysia.JET_SHIP
. Jetship.HK_DHL_EXPRESS
. DHL Express Hong Kong.IT_SDA
. SDA Express CourierDE_DHL_DEUTSCHEPOST
. DHL Deutsche Post Germany.HK_DHL_GLOBALFORWARDING
. DHL Global Forwarding Hong Kong.PHL_RAF
. RAF Philippines.PANTOS
. Pantos.KOR_ECARGO
. Ecargo Korea.AT_AUSTRIAN_POST_EMS
. EMS Express Mail Service AustriaIT_BRT
. BRT Corriere Espresso ItalyCHE_SWISS_POST
. Swiss Post.FASTWAY_NZ
. Fastway New Zealand.IT_EBOOST_SDA
. IT_EBOOST_SDAASENDIA_UK
. Asendia UK.RRDONNELLEY
. RR Donnelley.US_RL
. RL US.GR_GENIKI
. Geniki Greece.DE_DHL_EXPRESS
. DHL Express Germany.CA_GREYHOUND
. Greyhound Canada.UK_COLLECTPLUS
. CollectPlus UKNINJAVAN_THAI
. Ninjavan Thailand.RABEN_GROUP
. Raben Group.CA_DHL_EXPRESS
. DHL Express Canada.GLOBAL_TNT
. TNT Global.IN_INDIAPOST
. India PostITIS
. ITIS InternationalPHL_JAMEXPRESS
. JamExpress Philippines.PRT_INT_SEUR
. Internationational Seur PortugalESP_ASM
. Parcel Monitor SpainNINJAVAN_ID
. Ninjavan Indonesia.JP_FEDEX
. Federal Express JapanFR_CHRONOPOST
. Chronopost France.FR_SUIVI
. Suivi FedEx FranceFR_TELIWAY
. Teliway France.JPN_JAPAN_POST
. Japan PostHRV_HRVATSKA
. Hrvatska PoštaAT_AUSTRIAN_POST_PAKET_PRIME
. Austrian Post Paket PrimeDE_OTHER
. Other - Germany.HK_HONGKONG_POST
. Hong Kong Post.GRC_ACS
. ACS Greece.HUN_MAGYAR
. Magyar PostaFR_DHL_PARCEL
. DHL Parcel France.UK_OTHER
. Other - UK.LWE_HK
. LWE Hong Kong.PL_DHL_PARCEL
. DHL Parcel Poland.PARCELFORCE
. Parcel Force.AU_AUSTRALIA_POST_EMS
. Australia Post EMSUS_ASCENDIA
. Ascendia US.ROU_POSTA
. Poșta RomânăNZ_NZ_POST
. New Zealand Post Limited (NZ)RPX
. RPX International.POSTUR_IS
. Postur.IE_AN_POST_SDS_EMS
. Post SDS EMS Express Mail Service IrelandUK_UK_MAIL
. UK MailUK_FASTWAY
. Fastway UK.CORREOS_DE_COSTA_RICA
. Correos de Costa RicaMYS_CITYLINK
. Citylink Malaysia.PUROLATOR
. Purolator.IND_DOTZOT
. DotZot IndiaNG_COURIERPLUS
. Courier Plus NigeriaHK_FOUR_PX_EXPRESS
. 4PX Express Hong KongROCKETPARCEL
. Rocket Parcel InternationalCN_DHL_GLOBALFORWARDING
. DHL Global Forwarding China.EPARCEL_KR
. EParcel Korea.INPOST_PACZKOMATY
. InPost Paczkomaty.KOR_KOREA_POST
. Korea Post.CA_PUROLATOR
. Purolator CanadaAPR_72
. APR 72.FR_DHL_EXPRESS
. DHL Express France.IDN_JNE
. JNE Indonesia.AU_AUSTRALIA_POST_EPARCEL
. Australia Post EparcelGLOBAL_ESTES
. Estes Global.LTU_LIETUVOS
. Lietuvos paštas Lithuania.THECOURIERGUY
. The Courier GuyBE_CHRONOPOST
. Chronopost Belgium.VNM_VIETNAM_POST
. Vietnam Post.AU_STAR_TRACK_EXPRESS
. StarTrack Express AustraliaRAM
. JP RAM Shipping
carrier_name_other stringThe name of the carrier for the shipment. Provide this value only if the carrier parameter isOTHER
.last_updated_time stringThe date and time when the tracking information was last updated, in Internet date and time format.20
.64
.^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])[T,t]([0-1][0-9]|2[0-3]):[0-5][0-9]:([0-5][0-9]|60)([.][0-9]+)?([Zz]|[+-][0-9]{2}:[0-9]{2})$
.links array (contains the link_description object)An array of request-related HATEOAS links.notify_buyer booleanIftrue
, sends an email notification to the buyer of the PayPal transaction. The email contains the tracking information that was uploaded through the API.postage_payment_id stringThe postage payment ID.quantity integerThe quantity of items shipped.shipment_date stringThe date when the shipment occurred, in Internet date and time format.20
.64
.^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])[T,t]([0-1][0-9]|2[0-3]):[0-5][0-9]:([0-5][0-9]|60)([.][0-9]+)?([Zz]|[+-][0-9]{2}:[0-9]{2})$
.tracking_number stringThe tracking number for the shipment.tracking_number_type enumThe type of tracking number.The possible values are:CARRIER_PROVIDED
. A merchant-provided tracking number.E2E_PARTNER_PROVIDED
. A marketplace-provided tracking number.
tracking_number_validated booleanIndicates whether the carrier validated the tracking number.### Example python
from python_paypal_api.api import Tracking from python_paypal_api.base import ( ShipmentStatus, Carrier, TrackingNumberType, PaypalApiException ) import logging def py_put_tracking(composed_id: str, dictionary: dict): logger.info("---------------------------------") logger.info("Tracking > put_tracking(%s)" % str(dictionary)) logger.info("---------------------------------") try: result = Tracking(debug=True).put_tracking( id=composed_id, body=dictionary ) logger.info(result) except PaypalApiException as error: logger.error(error) if __name__ == '__main__': logger = logging.getLogger("test") id_transaction = "9ST00334VA8626***" number_tracking = "443844607820" path = "{}-{}".format(id_transaction, number_tracking) update = \ { "transaction_id": id_transaction, "tracking_number": number_tracking, "tracking_number_type": TrackingNumberType.CARRIER_PROVIDED.value, "status": ShipmentStatus.ON_HOLD.value, "carrier": Carrier.FEDEX.value, "notify_buyer": True } py_put_tracking(path, update)
### Response
A successful request returns the HTTP 204 OK status code with no JSON response body.
204 No Content
- get_tracking(self, id: str, **kwargs) ApiResponse
GET /v1/shipping/trackers/{id}
Shows tracking information, by tracker ID, for a PayPal transaction.
**args:
id string requiredThe ID of the tracker in thetransaction_id-tracking_number
format.### Example python
from python_paypal_api.api import Tracking from python_paypal_api.base import ( ShipmentStatus, Carrier, TrackingNumberType, PaypalApiException ) import logging def py_get_tracking(composed_id: str): logger.info("---------------------------------") logger.info("Tracking > get_tracking(%s)" % str(composed_id)) logger.info("---------------------------------") try: result = Tracking(debug=True).get_tracking( id=composed_id ) logger.info(result) except PaypalApiException as error: logger.error(error) if __name__ == '__main__': logger = logging.getLogger("test") id_transaction = "9ST00334VA8626***" number_tracking = "443844607820" path = "{}-{}".format(id_transaction, number_tracking) py_get_tracking(path)
### Response JSON
A successful request returns the HTTP 200 OK status code and a JSON response body that shows tracking information.
{ "transaction_id": "8MC585209K746392H", "tracking_number": "443844607820", "status": "SHIPPED", "carrier": "FEDEX", "links": [ { "href": "https://api-m.sandbox.paypal.com/v1/shipping/trackers/8MC585209K746392H-443844607820", "rel": "self" }, { "href": "https://api-m.sandbox.paypal.com/v1/shipping/trackers/8MC585209K746392H-443844607820", "rel": "replace", "method": "PUT" }, { "href": "https://api-m.sandbox.paypal.com/v1/shipping/trackers-batch", "rel": "create", "method": "POST" } ] }
- post_tracking(self, **kwargs) ApiResponse
POST /v1/shipping/trackers-batch
Adds tracking information, with or without tracking numbers, for multiple PayPal transactions. Accepts up to 20 tracking IDs. For more information, see Add tracking information with tracking numbers and Add tracking information without tracking numbers.
**kwargs:
links array (contains the link_description object)An array of request-related HATEOAS links.trackers array (contains the tracker object)### Example python
from python_paypal_api.api import Tracking from python_paypal_api.base import ( ShipmentStatus, Carrier, TrackingNumberType, PaypalApiException ) import logging def py_post_tracking(dictionary: dict): logging.info("---------------------------------") logging.info("Tracking > post_tracking(%s)" % str(dictionary)) logging.info("---------------------------------") try: result = Tracking(debug=True).post_tracking( body=dictionary ) logging.info(result) except PaypalApiException as error: logging.error(error) if __name__ == '__main__': logger = logging.getLogger("test") id_transaction = "9ST00334VA8626***" number_tracking = "443844607820" trackers = { "trackers": [ { "transaction_id": id_transaction, "tracking_number": number_tracking, "status": "SHIPPED", "carrier": "FEDEX" } ] } py_post_tracking(trackers)
### Response JSON
A successful request returns the HTTP 200 OK status code and a JSON response body that shows tracking information.
{ "tracker_identifiers": [ { "transaction_id": "8MC585209K746392H", "tracking_number": "443844607820", "links": [ { "href": "https://api-m.sandbox.paypal.com/v1/shipping/trackers/8MC585209K746392H-443844607820", "rel": "self", "method": "GET" }, { "href": "https://api-m.sandbox.paypal.com/v1/shipping/trackers/8MC585209K746392H-443844607820", "rel": "replace", "method": "PUT" } ] }, { "transaction_id": "53Y56775AE587553X", "tracking_number": "443844607821", "links": [ { "href": "https://api-m.sandbox.paypal.com/v1/shipping/trackers/53Y56775AE587553X-443844607821", "rel": "self", "method": "GET" }, { "href": "https://api-m.sandbox.paypal.com/v1/shipping/trackers/53Y56775AE587553X-443844607821", "rel": "replace", "method": "PUT" } ] } ], "errors": [ { "name": "RESOURCE_NOT_FOUND", "debug_id": "46735c7461f3d", "message": "The specified resource does not exist.", "details": [ { "field": "/trackers/0/transaction_id", "value": "8MC585309K746392H", "location": "body", "issue": "INVALID_TRANSACTION_ID" } ] } ], "links": [ { "href": "https://api-m.sandbox.paypal.com/v1/shipping/trackers-batch", "rel": "self", "method": "POST" } ] }