Skip to main content

Create a PaymentIntent

Creates a PaymentIntent resource.


Endpoint

POST /payment_intents

Sample code

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

const paymentIntent = await client.paymentIntents.create({
// Amount is in cents. The sample below is 100.00.
amount: 10000,
currency: 'PHP',
payment_methods: [
'card',
'gcash'
],
});

Parameters

amount REQUIRED

The amount to be collected by the PaymentIntent. This is a positive integer that your customer will pay in the smallest currency unit, cents. If the customer should pay for ₱ 120.50, the amount of the PaymentIntent should be 12050.

The minimum amount is ₱ 20 (2000 in cents) and the maximum amount is ₱ 59,999,999.99 (5999999999 in cents).


payment_methods REQUIRED

The list of payment methods allowed to be processed by the PaymentIntent. Possible values are card and gcash.


currency REQUIRED

A three-letter ISO currency code, in uppercase. As of the moment, we only support PHP.


capture_type optional

Describes if the PaymentIntent will separate authorization and capture process. Possible values are automatic, and capture. The default value is automatic.


description optional

An arbitrary string attached to the PaymentIntent. Useful reference when viewing paid Payment from PayRex Dashboard.


metadata optional

Set of key-value pairs you can attach to the PaymentIntent and the resources created by the PaymentIntent e.g. Payment. This can be useful for storing additional information about the PaymentIntent in a hash format.

Returns

Returns a PaymentIntent resource.