orderUpdate
orderUpdate is used to update the status, buyer details, payment gateway details and (for MPay marketplaces) payment references of an existing order.
3 minute read
Key Information
Use-Case
orderUpdate is used to update a finalized order - most commonly to progress its status (e.g. from payment_in_progress to complete, or to payment_failed), to merge in additional paymentGatewayDetails, to update buyer/billing details via attributes, or to manage the order’s MPay paymentReferences.
Further Points of Note
orderIdandstatusare always required, even if you are only updatingpaymentReferencesorattributes- you must re-supply the order’s current (or new) status on every call.attributeslets you update buyer and billing details (name, email, phone, address, company name, message to seller, etc.) - seeOrderUpdateInputfor the full list of fields. Any field left out ofattributesis unchanged.paymentGatewayDetails(a JSON object) is merged into the order’s existing payment gateway details rather than replacing them outright.paymentReferences, when supplied, fully replaces the order’s existing set of payment references for this call: any reference you omit from the array is deleted, any reference with apaymentReferencekey you already have will have itsamountupdated, and any newpaymentReferencekey is created. If you leave thepaymentReferencesargument out entirely (null), the order’s existing payment references are left untouched.- If MPay is enabled on your marketplace:
- The sum of
amountacross the suppliedpaymentReferencesmust equal the order’s total, andpaymentReferencevalues must be unique within the array. - You cannot use
orderUpdateto remove every payment reference from an order - at least one must remain at all times. To add or correct a reference, supply the full desired set; to replace one, include its replacement, not just its removal.
- The sum of
- If MPay is not enabled on your marketplace,
paymentReferencesmust not be supplied at all. - See the Automated Payouts (MPay) Integration Guide for the full payment references workflow.
Availability
- Operator API: Yes
- Seller API: No - sellers cannot update orders
Example
mutation updateAnOrder {
orderUpdate(
input: {
orderId: "T3JkZXItODQ5Mzg="
status: COMPLETE
paymentReferences: [
{ paymentReference: "VISA_230226_2", amount: "20.00" }
]
}
) {
order {
id
legacyId
status
totalCents
}
errors {
field
messages
}
}
}
Arguments
| Name | Type |
|---|---|
| input | OrderUpdateMutationInput |
Response
Returns OrderUpdateMutationPayload
Error Responses
| HTTP Error | Error Message | Meaning |
|---|---|---|
| 401 | Unauthorized | You don’t have access to the endpoint, likely your API key is missing or invalid |
| 200 | Field orderUpdate doesn’t exist on type “Mutation” | Most likely you are not passing a valid Operator key (only Operators can update orders) |
| 200 | Cannot use payment references without having MPay enabled | You supplied paymentReferences but MPay is not enabled on your marketplace |
| 200 | Cannot remove all payment references from an MPay-enabled order | You supplied an empty paymentReferences array (or omitted every existing reference) on an order while MPay is enabled - at least one reference must always remain |
| 200 | Payment references contain duplicate keys | Two or more entries in the paymentReferences array share the same paymentReference value |
| 200 | Payment reference amounts must add up to order total | The sum of amount across all supplied paymentReferences does not equal the order’s total |