Skip to main content

Cancel a PaymentIntent

Cancels a PaymentIntent resource. A payment intent with a status of canceled means your customer cannot proceed with paying the particular payment intent.

For example, if an order from your business should be cancelled, you should also call the cancel payment intent endpoint to ensure that your customer cannot pay the payment intent moving forward.

You can only cancel a payment intent with status awaiting_payment_method.


Endpoint

POST /payment_intents/:id/cancel

Sample code

const client = require('payrex-node')('insert your PayRex Secret API key.');

const paymentIntent = await client.paymentIntents.cancel(
// Payment Intent to cancel.
'<ID of a payment intent resource>',
)

Parameters

id REQUIRED

The id of the PaymentIntent to be cancelled.

Returns

Returns a PaymentIntent resource.