Cancel a Setup Intent
Cancels a Setup Intent resource. A Setup intent with a status of canceled means your customer cannot proceed saving a payment method through a particular setup intent.
You can only cancel a setup intent with status awaiting_payment_method.
Endpoint
POST /setup_intents/:id/cancel
Sample code
- curl
- Node
- PHP
- Python
- Ruby
curl --request POST --location 'https://api.payrexhq.com/setup_intents/<ID of a setup intent resource>/cancel' \
-u replace_with_secret_api_key:
const client = require('payrex-node')('insert your PayRex Secret API key.');
const setupIntent = await client.setupIntents.cancel(
// setup Intent to cancel.
'<ID of a setup intent resource>',
)
$client = new \Payrex\PayrexClient('insert your PayRex Secret API key.');
$setupIntent = $client->setupIntents->cancel('<setup intent id to cancel>');
from payrex import Client as PayrexClient
client = PayrexClient('insert your PayRex Secret API key.')
setup_intent = client.setup_intents.cancel(
# setup Intent to cancel.
'<ID of a setup intent resource>',
)
client = Payrex::Client.new("insert your PayRex Secret API key.")
setup_intent = client.setup_intents.cancel(
# setup Intent to cancel.
"<ID of a setup intent resource>",
)
Parameters
id REQUIRED
The id of the setup intent to be cancelled.
Returns
Returns a Setup Intent resource.