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:

  1. Cancel by pspReference (recommended): This is the recommended and most reliable method.
  2. 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-key header 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}/cancel

If 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

FieldTypeRequiredDescription
pspReferencestring (UUID v7)YesUnique payment identifier returned during session creation.

Request Headers

FieldTypeRequiredDescription
x-api-keystringYesAPI key assigned by Aera.
merchant-idstringYesMerchant ID assigned by Aera.
idempotency-keystring (UUID v7)YesUnique identifier for this cancel request. Required for safe retries.
AuthorizationstringYesBearer <access token>
AcceptstringYesapplication/vnd.payments.v1+json
Content-TypestringYesapplication/vnd.payments.v1+json
exclamation-triangle

Store your x-api-key and Bearer token in environment variables or a secrets manager. Never hardcode credentials in source code or commit them to version control.


Request Body

FieldTypeRequiredDescription
merchantIdstringYes (for partial cancel)Merchant ID assigned by Aera.
amountDetailsobjectNoRequired for partial cancellation. If omitted, the full remaining amount is cancelled.
referencestringNoOptional free-text reference for reconciliation or audit purposes.

amountDetails

FieldTypeRequiredDescription
amountintegerYes (for partial cancel)Amount to cancel in minor units.
currencystring (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.

What’s Next

Did this page help you?