Shipping Label Purchase Result
Requires access scope. Also: The user requires permission.
Tracks the progress of an asynchronous shipping label purchase request.
Anchor to FieldsFields
- done (Boolean!)
- errors ([ShippingLabelPurchaseError!]!)
- id (ID!)
- shippingLabels ([ShippingLabel!]!)
- status (ShippingLabelPurchaseResultStatus!)
- Anchor to donedone•Boolean!non-null
This indicates if the job is still queued or has been run.
- Anchor to errorserrors•[Shipping
Label Purchase Error!]! non-null Purchase-processing errors for the request. Synchronous validation errors are returned from the
mutation'sfield instead.- •ID!non-null
A globally-unique ID that's returned when running an asynchronous mutation.
- Anchor to shippingLabelsshipping•[Shipping
Labels Label!]! non-null The shipping labels created by the purchase request. Labels are returned only after successful purchase.
- Anchor to statusstatus•Shipping
Label Purchase Result Status! non-null The current purchase status. A purchase starts as
PENDING_PURCHASEand ends as eitherPURCHASEDorPURCHASE_FAILED.
Anchor to MutationsMutations
- shippingLabelPurchase (ShippingLabelPurchasePayload)
- •mutation
Purchases a shipping label for a fulfillment order.
The
mutation buys one shipping label for one fulfillment order using Shopify Shipping. The mutation validates the fulfillment order, shipment details, package information, and available rates before it starts an asynchronous label purchase.NoteThe shop must have accepted the Shopify Shipping terms of service before an app can purchase labels.
FedEx label purchases are not supported.
Note:The shop must have accepted the Shopify Shipping terms of service before an app can purchase labels.
FedEx label purchases are not supported.
Note: The shop must have accepted the Shopify Shipping terms of service before an app can purchase labels.</p> <p>FedEx label purchases are not supported.
After validation, the mutation builds the shipment details, fetches available rates, selects a rate, and enqueues the label purchase. If you provide
, the mutation attempts to purchase the matching carrier and service. If you don't provide, the mutation uses Shopify Shipping's default rate selection.Default rate selection first tries to keep the fulfillment order's buyer-selected delivery method when available. If no buyer-selected rate matches, the mutation uses the shop's preferred carrier and service when configured. Otherwise, it uses Shopify's recommended rate for the shipment destination.
For Merchant of Record (MoR) and Markets Pro orders, the mutation first removes rates from carriers that don't support Markets Pro.
A shipping label can be purchased only when the fulfillment order meets the following criteria:
- The fulfillment order is fulfillable and requires shipping.
- The order has a destination shipping address.
- The fulfillment order has an assigned location that can be used as the origin address.
- The shipment has a valid shipping date, package, weight, and required customs information.
- At least one shipping rate is available for the shipment.
The mutation can return errors in two places:
- Synchronous validation errors are returned in the mutation's
field. For example, invalid fulfillment orders, invalid package dimensions, missing customs information, or unavailable rates. - Asynchronous purchase-processing errors are returned in the
field after the purchase starts. For example, carrier availability, connection, billing, or other purchase-processing failures.
Use the returned
to poll the purchase status with thenodequery. The result starts with a status ofPENDING_PURCHASEand ends withPURCHASEDorPURCHASE_FAILED. When the purchase succeeds,contains the purchased label.- Anchor to shippingLabelPurchaseshipping•Shipping
Label Purchase Label Purchase Input! required The shipment, package, and rate preferences for the label purchase.
Arguments