Skip to main content

Cancel a Payment Intent

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 either status awaiting_payment_method or awaiting_capture.


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 Payment Intent resource.