Skip to main content

PaymentIntents

Learn more about the PaymentIntent resource

A PaymentIntent tracks the customer's payment lifecycle, keeping track of any failed payment attempts and ensuring the customer is only charged once. Create one PaymentIntent whenever your customer arrives at your checkout page. Retrieve the Payment Intent later to see the history of payment attempts.

A PaymentIntent transitions through multiple statuses throughout its lifetime via Payrex.JS until it creates, at most, one successful payment.

Endpoints

POST /payment_intents

GET /payment_intents/:id

The PaymentIntent Resource

{
"id": "pi_SJuGtXXC3XNRWpW3W1zQKiLWf67ZC4sX",
"resource": "payment_intent",
"amount": 10000,
"amount_received": 0,
"amount_capturable": 0,
"client_secret": "pi_SJuGtXXC3XNRWpW3W1zQKiLWf67ZC4sX_secret_7KGizzHuLtPtaLwiRMHekBHRUo6yv52r",
"currency": "PHP",
"description" :"",
"livemode": false,
"metadata": null,
"next_action": {
"type": "redirect",
"redirect_url": "https://my-application/redirect"
},
"payment_method_options": {
"card": {
"capture_type" :"automatic",
}
},
"payment_methods": ["card", "gcash"],
"status": "awaiting_payment_method",
"created_at": 1700407880,
"updated_at": 1700407880
}

Attributes


id string

Unique identifier for the resource. The prefix is pi_.


resource string

Represents the resource's type. The value is payment_intent.


amount string

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 ₱ 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).


amount_received string

The amount already collected by the PaymentIntent. This is a positive integer that your customer paid in the smallest currency unit, cents. If the customer paid ₱ 120.50, the amount_received 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).

This attribute is best used for hold then capture feature of card payment method.


amount_capturable string

The amount that can be captured by the PaymentIntent. This is a positive integer that your customer authorized in the smallest currency unit, cents. If the customer authorized ₱ 120.50, the amount_capturable 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).

This attribute is best used for hold then capture feature of card payment method.


payment_methods array of strings

The list of payment methods allowed to be processed by the PaymentIntent.


status string

The latest status of the PaymentIntent. Possible values are awaiting_payment_method, awaiting_next_action, processing, or succeeded.


client_secret string

The client secret of this PaymentIntent used for client-side retrieval using a public API key. The client secret can be used to complete a payment from your client application.


currency string

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


description string

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


livemode boolean

The value is true if the resource's mode is live or the value is false if the resource mode is test.


metadata hash

A set of key-value pairs attached to the PaymentIntent and the resources created by the PaymentIntent, e.g., Payment. This is useful for storing additional information about the PaymentIntent.


return_url string

The URL where your customer will be redirected after completing the authentication if they didn't exit or close their browser while authenticating.


next_action hash

If this attribute is present, it tells you what actions you need to take so that your customer can make a payment using the selected method.

Show child attributes

next_action.type string

The type of the next action to perform, The possible value is redirect.


next_action.redirect_url string

The URL for authenticating a payment by redirecting your customer.



payment_method_id string

The latest PaymentMethod ID of attached to the PaymentIntent.


payment_method_options hash

A 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.

created_at timestamp

The time the resource was created and measured in seconds since the Unix epoch.


updated_at timestamp

The time the resource was updated and measured in seconds since the Unix epoch.