Updating Order Status to "Paid" via Mutation

I’d like to know if it’s possible to update an order’s status to “paid” through a mutation.

I’m using a payment gateway, but the way I’m capturing the payment (via the gateway’s API) doesn’t automatically update the order status in Shopify. I’d like to confirm if there’s a way to update it via a mutation.

Tagging @JordanFinners and @KyleG-Shopify since you’ve both helped me with some questions before, do you happen to know if this is possible or the recommended approach?

@Andrei_Rodrigues : Did you check this : orderMarkAsPaid

1 Like

@Andrei_Rodrigues you can make it paid using admin GraphQL API
mutation orderMarkAsPaid($input: OrderMarkAsPaidInput!) {
orderMarkAsPaid(input: $input) {
userErrors {
field
message
}
order {
id
name
canMarkAsPaid
displayFinancialStatus
totalPrice
totalOutstandingSet {
shopMoney {
amount
currencyCode
}
}
transactions(first: 10) {
id
kind
status
amountSet {
shopMoney {
amount
currencyCode
}
}
gateway
createdAt
}
}
}
}

1 Like

You can try using the orderMarkAsPaid API

orderMarkAsPaid

mutation orderMarkAsPaid($input: OrderMarkAsPaidInput!) {
  orderMarkAsPaid(input: $input) {
    order {
      id
    }
    userErrors {
      field
      message
    }
  }
}
variables: {
  "input": {
    "id": "gid://shopify/Order/5978817265939"
  }
}

This mutation does not allow marking orders with the status authorized as paid. What should I do? Is there an alternative for this? @kyle_liu @KyleG-Shopify

When I try to mark an order with the status authorized as paid, I get the following message:
“Order cannot be marked as paid.”

The error occurs when attempt to mark an already paid order as paid.

An order can be marked as paid only if it has a positive outstanding balance and itsfinancial status isn’t already PAID

It was not paid, only marked as authorized.

Try orderCapture - GraphQL Admin

It worked! Thank you!