Create a Setup Intent
Creates a Setup Intent resource.
Endpoint
POST /setup_intents
Sample code
- curl
- Node
- PHP
- Python
- Ruby
curl --request POST --location 'https://api.payrexhq.com/setup_intents' \
-u replace_with_secret_api_key: \
--data-urlencode 'customer_id=cus_1234' \
--data-urlencode 'payment_methods[]=card' \
--data-urlencode 'payment_methods[]=gcash' \
--data-urlencode 'payment_methods[]=maya'
const client = require('payrex-node')('insert your PayRex Secret API key.');
const setupIntents = await client.setupIntents.create({
customer_id: '<insert customer id here>',
payment_methods: [
'card',
'gcash',
'maya'
],
});
$client = new \Payrex\PayrexClient('insert your PayRex Secret API key.');
$setupIntents = $client->setupIntents->create([
'customer_id' => '<insert customer id here>',
'payment_methods' => [
'card',
'gcash',
'maya'
],
]);
from payrex import Client as PayrexClient
client = PayrexClient('insert your PayRex Secret API key.')
setup_intent = client.setup_intents.create(
{
'customer_id': '<insert customer id here>',
'payment_methods': [
'card',
'gcash',
'maya'
]
}
)
require "payrex-ruby"
client = Payrex::Client.new('insert your PayRex Secret API key.')
setup_intent = client.setup_intents.create(
customer_id: '<insert customer id here>',
payment_methods: [
'card',
'gcash',
'maya'
]
)
Parameters
customer_id REQUIRED
The ID of the customer resource that will be associated with the Setup Intent.
payment_methods optional
The list of payment methods allowed to be processed by the Setup Intent. Possible values are card, gcash, maya.
description optional
An arbitrary string attached to the Setup Intent.
metadata optional
A set of key-value pairs you can attach to the Setup Intent and the resources created by the Setup Intent.
Returns
Returns a Setup Intent resource.