Closed rachelmcr closed 22 hours ago
We need to add support in the Networking layer for a label purchase request with the Woo Shipping extension.
Endpoint: POST /wcshipping/v1/label/purchase/123
POST /wcshipping/v1/label/purchase/123
Sample request payload:
{ "async":true, "origin":{ "company":"Test Store", "name":"TEST MERCHANT", "phone":"12345678901", "country":"US", "state":"CA", "address":"60 29TH ST PMB 343", "address_2":"", "city":"SAN FRANCISCO", "postcode":"94110-4929", "id":"store_details" }, "destination":{ "company":"", "city":"SAN DIEGO", "state":"CA", "postcode":"92101-1616", "country":"US", "phone":"", "name":"Test Customer", "address":"1350 EL PRADO" }, "packages":[ { "id":"0", "box_id":"custom_box", "length":25, "width":25, "height":25, "is_letter":false, "shipment_id":"shp_33dd948486184ea09078a08be667f7b5", "service_id":"GroundAdvantage", "carrier_id":"usps", "service_name":"USPS - Ground Advantage", "products":[ 19 ], "weight":1, "rate_id":"rate_c84888134ca0453bad4d1b8a4493fac6" } ], "selected_rate":{ "shipment_0":{ "rate":{ "rateId":"rate_c84888134ca0453bad4d1b8a4493fac6", "serviceId":"GroundAdvantage", "carrierId":"usps", "title":"USPS - Ground Advantage", "rate":7.24, "retailRate":11.8, "listRate":8.81, "isSelected":false, "tracking":true, "insurance":100, "freePickup":true, "shipmentId":"shp_33dd948486184ea09078a08be667f7b5", "deliveryDays":3, "deliveryDateGuaranteed":false, "deliveryDate":null }, "parent":null } }, "hazmat":{ "shipment_0":{ "isHazmat":false, "category":"" } }, "customs":{ "shipment_0":{ "items":[ { "id":3735, "subtotal":"20.00", "subtotal_tax":"0.00", "total":"20.00", "total_tax":"0.00", "price":"20.00", "quantity":1, "tax_class":"clothing-20010", "name":"Beanie", "product_id":19, "sku":"woo-beanie", "meta":{ "customs_info":{ "description":"Beanie", "hs_tariff_number":"", "origin_country":"US" } }, "image":"https://example.com/wp-content/uploads/2023/01/beanie-2.jpg", "weight":"1", "dimensions":{ "length":"20", "width":"20", "height":"40" }, "variation":[ ], "subItems":[ ], "description":"Beanie", "hsTariffNumber":"", "originCountry":"US" } ], "contentsType":"merchandise", "restrictionType":"none", "isReturnToSender":false, "itn":"" } }, "user_meta":{ "last_order_completed":true } }
Sample response:
{ "labels": [ { "label_id": 4119, "tracking": null, "refundable_amount": 0, "created": 1731599418086, "carrier_id": null, "service_name": "USPS - Ground Advantage", "status": "PURCHASE_IN_PROGRESS", "commercial_invoice_url": "", "is_commercial_invoice_submitted_electronically": "", "package_name": "Individual packaging", "is_letter": false, "product_names": [ "Beanie" ], "product_ids": [ 19 ], "id": "0" } ], "selected_rates": { "shipment_0": { "rate": { "rateId": "rate_c84888134ca0453bad4d1b8a4493fac6", "serviceId": "GroundAdvantage", "carrierId": "usps", "title": "USPS - Ground Advantage", "rate": 7.24, "retailRate": 11.8, "listRate": 8.81, "isSelected": false, "tracking": true, "insurance": 100, "freePickup": true, "shipmentId": "shp_33dd948486184ea09078a08be667f7b5", "deliveryDays": 3, "deliveryDateGuaranteed": false, "deliveryDate": null }, "parent": null } }, "selected_hazmat": { "shipment_0": { "isHazmat": false, "category": "" } }, "selected_origin": { "shipment_0": { "company": "Test Store", "name": "TEST MERCHANT", "phone": "12345678901", "country": "US", "state": "CA", "address": "60 29TH ST PMB 343", "address_2": "", "city": "SAN FRANCISCO", "postcode": "94110-4929", "id": "store_details", "is_verified": true } }, "selected_destination": { "shipment_0": { "company": "", "city": "SAN DIEGO", "state": "CA", "postcode": "92101-1616", "country": "US", "phone": "", "name": "TEST CUSTOMER", "address": "1350 EL PRADO" } }, "customs_information": { "shipment_0": { "items": [ { "id": 3737, "subtotal": "20.00", "subtotal_tax": "0.00", "total": "20.00", "total_tax": "0.00", "price": "20.00", "quantity": 1, "tax_class": "clothing-20010", "name": "Beanie", "product_id": 19, "sku": "woo-beanie", "meta": { "customs_info": { "description": "Beanie", "hs_tariff_number": "392620", "origin_country": "US" } }, "image": "https:\/\/example.com\/wp-content\/uploads\/2023\/01\/beanie-2.jpg", "weight": "1", "dimensions": { "length": "20", "width": "20", "height": "40" }, "variation": [], "subItems": [], "description": "Beanie", "hsTariffNumber": "392620", "originCountry": "US" } ], "contentsType": "merchandise", "restrictionType": "none", "isReturnToSender": false, "itn": "" } }, "success": true }
Thanks for reporting! 👍
We need to add support in the Networking layer for a label purchase request with the Woo Shipping extension.
Endpoint:
POST /wcshipping/v1/label/purchase/123
Sample request payload:
Sample response: