Choose the Documentation MX Merchant MX Connect

Cancel, stop & refund a transaction

Reverse or halt a transaction after it's created — cancel before processing, stop a check in transit, refund a completed collection, or pull its receipt.

Once a transaction exists it isn't necessarily final. Depending on where it sits in its lifecycle, you can cancel it before it processes, stop a check that's already in transit, refund funds you collected, or fetch a receipt for your records. Each action is a single call keyed off the transaction's id or your own externalId.

Which action do I need?

Use cancel while a transaction is still SCHEDULED or PENDING, stop for a CHECK that's already PROCESSING, IN_DELIVERY, or DELIVERED, and refund to return money after a collection has gone through. None of these can be undone once accepted.


Cancel a transaction

Cancel a transaction that is still in SCHEDULED or PENDING status, any time before it's picked up for processing.

Make a POST request to /v1/transaction/id/{id}/cancel (or /v1/transaction/externalId/{externalId}/cancel). Like other Treasury calls it requires the PromiseMode header (NEVER for an immediate response, ALWAYS to defer processing).

Request

POST /v1/transaction/id/2/cancel
PromiseMode: NEVER

{
  "reason": "OTHERS",
  "comment": "customer requested to cancel the scheduled transaction"
}
FieldRequiredDescription
reasonYesWhy you're cancelling. One of INCORRECTLY_CREATED, ON_USER_REQUEST, OTHERS.
commentConditionalRequired when reason is OTHERS.

Response

204 No Content — the cancellation was accepted. The transaction moves to CANCELLED and will not be processed.

A cancellation can't be revoked. Once cancelled, the system will never process the transaction — create a new one if you still need to move the money.


Stop a transaction

Stop a CHECK transaction that's already moving — in PROCESSING, IN_DELIVERY, or DELIVERED status — for example when a check is lost or was sent for the wrong amount.

Make a POST request to /v1/transaction/id/{id}/stop (or /v1/transaction/externalId/{externalId}/stop).

Request

POST /v1/transaction/id/544/stop
PromiseMode: NEVER

{
  "reason": "INCORRECTLY_CREATED",
  "comment": "user comment goes here"
}
FieldRequiredDescription
reasonYesWhy you're stopping the check. One of FRAUD, INCORRECT_DESTINATION, INCORRECT_AMOUNT, LOST_CHECK, INCORRECTLY_CREATED, ON_USER_REQUEST, OTHERS.
commentConditionalRequired when reason is OTHERS.

Response

204 No Content — the stop request was accepted.

Stop applies only to the CHECK method. To reverse other methods, cancel it (if it hasn't processed) or issue a refund.


Refund a transaction

A refund via ACH is initiated when you return funds to a customer — for example, when you collected too much. The refund is always processed back to the original source of the funds (the credit-initiating entity), so a credit transaction via ACH must exist to initiate it.

Make a POST request to /v1/transaction/id/{id}/refund, referencing the original transaction's id.

Request

POST /v1/transaction/id/975/refund
PromiseMode: NEVER

{
  "amount": "10.00",
  "purpose": "Refund",
  "reason": "ON_CUSTOMER_REQUEST"
}
FieldRequiredDescription
amountOptionalAmount to refund. If omitted, the full transaction amount is refunded.
purposeOptionalFree-text purpose for the refund.
reasonOptionalReason for the refund (for example, ON_CUSTOMER_REQUEST).

Response

201 Created, with the new refund transaction's url (for example, /v1/transaction/id/8176). The refund is itself a transaction and follows the standard lifecycle.

Example: you collected $15 but should have collected $10 — initiate a $5 refund. The customer receives the funds back on the same rail they paid on.


Retrieve a receipt

Fetch a transaction's receipt as a Base64-encoded PDF. This works for all transaction types (send, collect, deposit, and so on).

Make a GET request to /v1/transaction/id/{id}/receipt (or /v1/transaction/externalId/{externalId}/receipt).

Response

{
  "isGenerated": true,
  "base64Content": "JVBERi0xLjQKMSAwIG9iago8PAovVHlwZSAvQ2F0YWxvZwov...",
  "mimeType": "application/pdf",
  "transaction": {
    "id": 12345678,
    "url": "/v1/transaction/id/12345678"
  }
}
FieldDescription
isGeneratedWhether the receipt PDF has been generated. If false, the receipt isn't available yet and the API returns an error code.
base64ContentThe full receipt PDF, Base64-encoded. Decode it on your side to get the file.
mimeTypeThe file format — always application/pdf.
transaction.id / transaction.urlThe transaction the receipt belongs to.

Best practices

PracticeWhy
Act on status, not timeCheck the transaction's current status before you cancel or stop; the allowed action depends on where it is in the lifecycle.
Always send a reasonCancel and stop require a reason; add a comment whenever you use OTHERS so the audit trail is clear.
Track the follow-up transactionA refund creates a new transaction — store its id/externalId and track it like any other money movement.
Poll receipts on isGeneratedIf isGenerated is false, retry later rather than treating it as an error.

See also