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.


description optional

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


payment_method_options optional

Set of key-value pairs that can modify the behavior of the payment method attached to the payment intent.

Show child attributes

card hash

Show child attribute

capture_type string

Describes the capture_type of a card payment. Possible values are automatic or manual. This is used for hold then capture feature. Please refer to this guide for more details.


allowed_bins array

Restricts the allowed card BINs for a card payment. Please refer to this guide for more details.


allowed_funding array

Restricts the allowed card funding for a card payment. Please refer to this guide for more details.


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.