Hi everyone
I’m hoping someone can help me out. I’m trying to add a shipping line to an existing order using Shopify’s GraphQL Order Edit API. Everything seems to work, but when I check the order, the newly added shipping cost is showing up as “unauthorized” (e.g. “$XX.XX of your balance is unauthorized”).
What I’m Doing1. Start the Order Edit
I call the orderEditBegin mutation with the original order ID:
mutation orderEditBegin($id: ID!) {
orderEditBegin(id: $id) {
calculatedOrder {
id
totalOutstandingSet {
presentmentMoney {
amount
currencyCode
}
}
totalPriceSet {
presentmentMoney {
amount
currencyCode
}
}
}
userErrors {
field
message
}
}
}
This returns a calculatedOrder.id, which I use for the next steps.
2. Add a Shipping Line
Then, I use the orderEditAddShippingLine mutation with the calculated order ID. Here’s a simplified version of what I’m doing:
mutation addShippingLine($id: ID!, $shippingLine: OrderEditAddShippingLineInput!) {
orderEditAddShippingLine(id: $id, shippingLine: $shippingLine) {
calculatedOrder {
id
totalOutstandingSet {
presentmentMoney {
amount
currencyCode
}
}
totalPriceSet {
presentmentMoney {
amount
currencyCode
}
}
}
calculatedShippingLine {
id
title
price {
presentmentMoney {
amount
currencyCode
}
}
stagedStatus
}
userErrors {
field
message
}
}
}
My variables might look like this:
{
"id": "gid://shopify/CalculatedOrder/
**3. Commit the Order Edit**
Finally, I commit the changes using:
```markup
mutation orderEditCommit($id: ID!, $notifyCustomer: Boolean, $staffNote: String) {
orderEditCommit(id: $id, notifyCustomer: $notifyCustomer, staffNote: $staffNote) {
order {
id
}
userErrors {
field
message
}
}
}
And I pass something like:
{
"id": "gid://shopify/CalculatedOrder/
After doing all of this, the shipping line is added, but in the Shopify admin, the shipping cost remains “unauthorized.” It says something like: “$XX.XX of your balance is unauthorized,” which suggests that the extra amount hasn’t been captured or paid.
Do I need to capture the additional payment separately for the updated order total? Is there a recommended approach or additional step to authorize the new total (including the shipping cost) when editing an order via the GraphQL API?
Thank you