Create, update and refund external transactions
merchantCode and transactionId in these examples are placeholders — use a real merchant from your context and ids from paymentExternalTransactions.
Use the paymentExternalTransactionCreate, paymentExternalTransactionUpdate and paymentExternalTransactionRefund mutations to record the payment activity of an external gateway in OMS.
Create an external transaction
Use paymentExternalTransactionCreate mutation to add a new payment transaction to OMS. The mutation accepts a PaymentExternalTransactionCreateInput object — its reference lists all the available fields.
This mutation creates the provider-side payment record for a merchant. Use it when the payment gateway sends OMS the first event for a transaction, such as an authorized or completed payment.
Field notes:
merchantCodeidentifies the payment merchant that owns the transaction;numberis the transaction identifier assigned by the provider.referenceCodeis thenumberof the order the transaction pays. It is not validated at creation (the order might not exist in OMS yet): OMS links the transaction to the order when it finds the two consistent, and from then on the transaction exposes it inorderand the order lists it insaleTransactions. Until thenorderisnull.amountis positive for a payment: a positive amount is matched to an order, a negative one to a return.statusispendedfor a transaction waiting capture,completedonce captured,failedif it failed.feesrecords the provider fees: each fee requiresamountandcurrency;descriptionandexchangeRateare optional.
mutation createExternalTransaction {
paymentExternalTransactionCreate(
input: {
merchantCode: "1"
number: "12345678"
provider: "visa"
amount: 10.1
currency: "EUR"
referenceCode: "12345"
status: pended
timestamp: "2026-04-03T10:15:30.000Z"
fees: [
{
amount: 0.2
currency: "EUR"
description: "Interchange"
exchangeRate: 1
}
]
}
) {
id
}
}{
"data": {
"paymentExternalTransactionCreate": {
"id": "1005"
}
},
"extensions": {
"queryComplexity": 2,
"bucketBalance": 9998,
"bucketRestoreRate": 100
}
}Update an external transaction
Use paymentExternalTransactionUpdate mutation to update an existing payment transaction in OMS. The mutation accepts a PaymentExternalTransactionUpdateInput object — its reference lists all the available fields.
This mutation updates mutable transaction data after OMS has already stored the external transaction. It is typically used to move a transaction from pended to completed or failed, or to attach final provider fee data.
Field notes:
statustransitions are validated: an invalid one (including the status the transaction already has) is rejected withInvalid status updateand the error codeBAD_REQUEST. The allowed transitions are listed in Transaction statuses.timestampgoes withstatus: OMS stores it asstartedAt,transactedAtorfailedAtdepending on the submitted status.feesdoes not replace the fee list: a fee withidupdates that fee, a fee withoutidadds a new one.
mutation updateExternalTransaction {
paymentExternalTransactionUpdate(
transactionId: "1005"
input: {
status: completed
timestamp: "2026-04-22T17:15:30.000Z"
fees: [
{
id: "112"
amount: 0.66
currency: "EUR"
description: "Interchange"
exchangeRate: 1
}
]
}
) {
id
}
}{
"data": {
"paymentExternalTransactionUpdate": {
"id": "1005"
}
},
"extensions": {
"queryComplexity": 2,
"bucketBalance": 9998,
"bucketRestoreRate": 100
}
}Refund an external transaction
Use paymentExternalTransactionRefund mutation to create a refund for an existing transaction. The mutation accepts a PaymentExternalTransactionRefundInput object — its reference lists all the available fields.
The refund is a child transaction linked to the original payment, and the mutation returns the refund transaction, not the original one: keep its id if you need to update the refund later. How refunds and the original transaction interact is explained in Refund transactions.
Field notes:
transactionIdis the original transaction being refunded.referenceCodeis thenumberof the repayment request (return) the refund belongs to, or the order'snumber: OMS resolves the association from either one, and a linked refund exposes the return inrepaymentRequest. The refund is in any case linked to the original transaction (and, through it, to the order) viasaleTransaction.amountis negative for a refund: a negative amount is matched to a return, never to an order.status,timestampandfeeswork as at creation, on the refund transaction.- A
completedrefund moves the original transaction topartially_refundedortotally_refunded; apendedrefund does not affect it until it completes.
mutation refundExternalTransaction {
paymentExternalTransactionRefund(
transactionId: "1005"
input: {
number: "R123456"
provider: "visa"
amount: -1.2
currency: "EUR"
referenceCode: "R123456"
status: pended
timestamp: "2026-04-03T10:15:30.000Z"
fees: [
{
amount: 0.4
currency: "EUR"
description: "Interchange"
exchangeRate: 1
}
]
}
) {
id
}
}{
"data": {
"paymentExternalTransactionRefund": {
"id": "1006"
}
},
"extensions": {
"queryComplexity": 2,
"bucketBalance": 9998,
"bucketRestoreRate": 100
}
}