younifyd
Menu

shippingLabelPurchase

Purchases a shipping label for a fulfillment order. The shippingLabelPurchase mutation buys one shipping label for one fulfillment order using Shopify Shipping.

Use it in a workflow

  1. Add a step and choose the Shopify connector.
  2. Pick the shippingLabelPurchase action (under Shipping).
  3. Fill in the fields below, then reference the result from later steps as {{shippinglabelpurchase.response.data}}.

Query

This is the mutation the action sends by default. Edit it in the step's Query field to change which fields come back.

graphql
mutation ShippingLabelPurchase($shippingLabelPurchase: ShippingLabelPurchaseInput!) {
  shippingLabelPurchase(shippingLabelPurchase: $shippingLabelPurchase) {
    shippingLabelPurchaseResult {
      done
      errors {
        code
        field
        message
      }
      id
      shippingLabels {
        cancellable
        id
        location
        printed
        shippingDocuments
        trackingInfo
      }
      status
    }
    userErrors {
      code
      field
      message
    }
  }
}

Variables

Pass these as a JSON object in the step's Variables field.

shippingLabelPurchaseobjectrequired

The shipment, package, and rate preferences for the label purchase.

fulfillmentOrderIdstringrequired
shippingDatetimestringrequired
packageInfoobject2 fields
totalWeightobject2 fields
notifyCustomerboolean
preferredRateSelectionobject2 fields
originAddressobject13 fields
json
{
  "shippingLabelPurchase": {
    "fulfillmentOrderId": "string",
    "shippingDatetime": "string",
    "packageInfo": {
      "customPackage": {
        "weight": "string",
        "dimensions": "string",
        "type": "string"
      },
      "carrierPackage": {
        "carrierCode": "string",
        "carrierPackageCode": "string",
        "name": "string"
      }
    },
    "totalWeight": {
      "value": 0,
      "unit": "KILOGRAMS"
    },
    "notifyCustomer": false,
    "preferredRateSelection": {
      "carrierCode": "string",
      "serviceCode": "string"
    },
    "originAddress": {
      "address1": "string",
      "address2": "string",
      "city": "string",
      "company": "string",
      "country": "string",
      "countryCode": "AF",
      "firstName": "string",
      "id": "string",
      "lastName": "string",
      "phone": "string",
      "province": "string",
      "provinceCode": "string"
    }
  }
}

Response

Read the result with {{shippinglabelpurchase.response.data.data.shippingLabelPurchase}}. If the API returns errors, the step fails and they are at {{shippinglabelpurchase.response.data.errors}}.

shippingLabelPurchaseResultobject
doneboolean
errorsarray<object>
idstring
shippingLabelsarray<object>
statusstring

One ofPENDING_PURCHASEPURCHASE_FAILEDPURCHASED

userErrorsarray<object>
codeobject
fieldobject
messageobject

Need more? See the Shopify guide for connection setup and behaviour shared by every action.