How to cancel a payment

Primer enables you to cancel a payment across all your processors in a unified way. By cancelling a payment, the authorization is voided and the hold on customer funds is released.

In order to cancel a payment, the payment must not have reached SETTLED status. Once the payment is cancelled, the payment can no longer be captured.

All cancel requests are sent to the processor used in the authorization request.

To check the status of the payment, you can use:

Cancel a payment with Primer in three ways:

⌛️

Payments timeline

Manually cancel a payment from an easy-to-use dashboard.

🖥

Workflows

Automate sophisicated payment flows to cancel your payments.

👨🏻‍💻

Payments API

Programmatically cancel your payments via API based on your business logic.

Cancel a payment via the Payments Timeline

This is useful to enable your team to cancel payments directly from within the dashboard.

Manually cancel a specific payment from the Payments Timeline in the Primer Dashboard.

Select the payment from the list view and navigate to the specific payment details page. If the payment has AUTHORIZED or PENDING status, the Cancel button in the top right corner will be enabled.

Cancel button enabled

Once you select the Cancel button, the cancel request will be sent to the processor. After it’s been processed, the payment will be cancelled and the payment details page will reflect this.

Cancelled payment details

Cancel a payment via Workflows

Use Workflows to set up business logic on when and how to cancel a payment - without writing a single line of code. Simply add the "Cancel payment" Action from the Primer Payments app to a workflow.

You can configure any additional business flows in between your "Authorize payment" and "Cancel payment" Actions, creating powerful payment flows that suit your needs.

For example, you may want to validate that the processor CVV and AVS checks MATCHED and, if not, cancel the payment - this becomes very easy with Primer.

Cancelled action example

Learn more here about the Payments app and the "Cancel payment" Action.

Cancel a payment via Payments API

Cancel a payment using the Payments API - see the API reference for the details.

12345
curl --request POST \     --url https://api.sandbox.primer.io/payments/<YOUR_PAYMENT_ID>/cancel \     --header 'X-API-KEY: <YOUR_API_KEY>' \     --header 'X-API-VERSION: 2.2' \     --header 'X-Idempotency-Key: <YOUR_IDEMPOTENCY_KEY>'
bash
copy

Include the Primer payment ID in the request, which you will have received as part of the payment creation and authorization.

It is optional to pass the cancellation reason in the payload for your own records.