Skip to main content

Cancel a payment

Cancelling a payment releases the reserved funds back to the customer’s bank account.
This keeps the customer’s bank statement and the payment overview in the Vipps Vipps or MobilePay MobilePay app in sync with their expectations — and ensures a better customer experience.

You should always release any funds you don’t plan to capture as soon as possible.
If you are only capturing part of an authorized amount, cancel the remainder right away, so the customer can use those funds for other purposes.

A payment can be cancelled via this API or on portal.vippsmobilepay.com.

You can cancel at any time while there are remaining authorized funds. Cancelling will release these funds back to the customer.

Payment deadlines

All payments must be handled within the payment capture deadlines.
Attempting to cancel a payment after its deadline will return HTTP 400 Bad Request.

Creating a cancel request

To cancel an authorized payment, use
POST:/epayment/v1/payments/{reference}/cancel.

For example, this request cancels the entire payment.
Note: Once cancelled, the payment cannot be captured.

curl -X POST https://apitest.vipps.no/epayment/v1/payments/UNIQUE-PAYMENT-REFERENCE/cancel \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR-ACCESS-TOKEN" \
-H "Ocp-Apim-Subscription-Key: YOUR-SUBSCRIPTION-KEY" \
-H "Merchant-Serial-Number: YOUR-MSN" \
-H "Vipps-System-Name: acme" \
-H "Vipps-System-Version: 3.1.2" \
-H "Vipps-System-Plugin-Name: acme-webshop" \
-H "Vipps-System-Plugin-Version: 4.5.6" \

The response will summarize the payment’s status. In this example, 499 NOK was authorized but not captured, and the full amount was cancelled:

{
"amount":{
"currency":"NOK",
"value":49900
},
"state":"AUTHORIZED",
"aggregate":{
"authorizedAmount":{
"currency":"NOK",
"value":49900
},
"cancelledAmount":{
"currency":"NOK",
"value":49900
},
"capturedAmount":{
"currency":"NOK",
"value":0
},
"refundedAmount":{
"currency":"NOK",
"value":0
}
},
"pspReference":"37c34d8c-2649-448e-864b-060d5d93e4c4",
"reference":"acme-shop-123-order123abc"
}
Payment state

The payment state remains AUTHORIZED after a cancel. If you cancel before the customer authorizes (for example, if they change their mind), the payment state becomes TERMINATED.

Webhooks
You can receive automatic notifications when a payment is cancelled. Register for these webhook events:

  • epayments.payment.cancelled.v1
  • epayments.payment.terminated.v1

For full details, see webhooks.

Cancel transaction only (advanced)

It’s not possible to cancel a payment when a user is actively authorizing (e.g., during a payment scheme process or 3-D Secure session). If a cancellation request arrives too late, the user may have already authorized the payment.

To only cancel payments that have not yet been authorized, set the cancelTransactionOnly flag in the cancel payload. This ensures the reservation is only released if authorization is still pending.

Cancel after a partial capture

You should always release any funds you don’t plan to capture, as soon as possible.
After a partial capture, cancelling the payment will release the remaining reserved amount, so the customer can use those funds for other purposes.

Use the cancel endpoint to release any remaining funds.

Cancelling after a partial capture will always release the entire not-yet-captured amount for the payment.
This action is irreversible.

Example

Suppose you have a payment with the following aggregates:

{
"aggregate": {
"authorizedAmount": { "currency": "NOK", "value": 1000 },
"cancelledAmount": { "currency": "NOK", "value": 0 },
"capturedAmount": { "currency": "NOK", "value": 250 },
"refundedAmount": { "currency": "NOK", "value": 0 }
}
}

To release the remaining funds, call POST:/epayment/v1/payments/{reference}/cancel as usual.

After cancellation, the aggregate is updated and the remaining funds are released to the customer's bank account:

{
"aggregate": {
"authorizedAmount": { "currency": "NOK", "value": 1000 },
"cancelledAmount": { "currency": "NOK", "value": 750 },
"capturedAmount": { "currency": "NOK", "value": 250 },
"refundedAmount": { "currency": "NOK", "value": 0 }
}
}

🛟 Looking for app help? Visit our Help center (opens in a new tab) for guides and chat. Vipps MobilePay

Help us improve our documentation

Did you find what you were looking for?