Cancel Payment
Use this endpoint to cancel (void) a previously authorized payment.
Cancel is supported for payment methods that use an authorization flow (for example, Card and selected alternative payment methods). Availability and behavior depend on the configured acquirer and product setup.
Cancel is only possible before the payment has been captured.
When to Use Cancel
Cancel is used when:
- A payment has been authorized
- Funds are reserved on the shopper’s account
- You no longer intend to capture the payment
If the payment has already been fully captured, you must use the Refund endpoint instead.
Cancel with Different References
Aera supports two ways to cancel a payment:
- Cancel by
pspReference(recommended): This is the recommended and most reliable method. - Cancel by
merchantReference(fallback): This method is intended for recovery scenarios where the merchant did not receive the pspReference due to network issues, timeouts, or connection failures. It allows cancellation using the merchant’s own reference identifier. This method should only be used as a fallback.
Endpoint - Cancel with Aera´s pspReference
POST /v1/{pspReference}/cancel{pspReference}is the unique identifier returned when the payment session was created.- The
idempotency-keyheader is mandatory.
Endpoint - Cancel with your merchantRefernece
POST /v1/cancel{
"merchantReference": "The reference you sent in the Create Session request",
"reference": "Optional, your reference for this cancel request"
}Full Cancel
To cancel the full remaining authorized amount, send the request without a body.
Example
POST /v1/{pspReference}/cancelIf body is not provided, the system cancels the entire remaining authorized amount.
Partial Cancel
To cancel a partial amount, include an amountDetails object in the request body.
Example
{
"merchantId": "Aera Merchant ID",
"amountDetails": {
"amount": 3000,
"currency": "NOK"
},
"merchantReference": "Customer removed item from order"
}Multiple Partial Cancels
Multiple partial cancellations are supported until the total cancelled amount equals the remaining authorized amount.
After the final cancellation:
- The payment status transitions to
cancelled(if fully cancelled) - No further capture is possible on the cancelled portion
The support of partial Cancel and multiple partial Cancels depend on the configured acquirers
Field Reference
Path Parameter
| Field | Type | Required | Description |
|---|---|---|---|
pspReference | string (UUID v7) | Yes | Unique payment identifier returned during session creation. |
Request Headers
| Field | Type | Required | Description |
|---|---|---|---|
x-api-key | string | Yes | API key assigned by Aera. |
merchant-id | string | Yes | Merchant ID assigned by Aera. |
idempotency-key | string (UUID v7) | Yes | Unique identifier for this cancel request. Required for safe retries. |
Authorization | string | Yes | Bearer <access token> |
Accept | string | Yes | application/vnd.payments.v1+json |
Content-Type | string | Yes | application/vnd.payments.v1+json |
Store your
x-api-keyand Bearer token in environment variables or a secrets manager. Never hardcode credentials in source code or commit them to version control.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
merchantId | string | Yes (for partial cancel) | Merchant ID assigned by Aera. |
amountDetails | object | No | Required for partial cancellation. If omitted, the full remaining amount is cancelled. |
reference | string | No | Optional free-text reference for reconciliation or audit purposes. |
amountDetails
| Field | Type | Required | Description |
|---|---|---|---|
amount | integer | Yes (for partial cancel) | Amount to cancel in minor units. |
currency | string (ISO 4217) | Yes (for partial cancel) | Currency code (for example, NOK). |
Cancel Response
A successful cancellation returns confirmation of the operation and updated payment status.
{
"responseInfo": {
"responseCode": "000",
"responseText": "Cancel successful"
},
"operationInfo": {
"type": "CANCEL",
"status": "SUCCESS",
"cancelledAmount": {
"amount": 3000,
"currency": "NOK"
}
}
}Important Notes
- Cancel is only possible while the payment is in an authorized state.
- Once fully captured, cancellation is no longer possible — use the refund endpoint instead.
- Some payment methods may not support partial cancellation.
- Cancel requests must include a valid
idempotency-key. - If the authorization has expired, cancellation may fail.
Updated 13 days ago