Skip to main content

Payment Intents

A PaymentIntent guides you through the process of collecting a payment from your customer. It tracks the lifecycle of every payment attempt, from creation to confirmation to capture, and handles edge cases like authentication, retries, and failures automatically.

The PaymentIntent object​

{
"id": "pi_3NqX2B4eHqLMHCmD1vC8aKtz",
"object": "payment_intent",
"amount": 2000,
"currency": "usd",
"status": "succeeded",
"customer": "cus_Nk3mHXq7ViGwMz",
"description": "Pro plan – monthly",
"client_secret": "pi_3NqX2B4eHqLMHCmD1vC8aKtz_secret_...",
"payment_method": "pm_1NqX2B4eHqLMHCmD...",
"livemode": false,
"metadata": {},
"created": 1748476800
}

Status values​

StatusDescription
requires_payment_methodAwaiting a payment method.
requires_confirmationReady to be confirmed.
requires_actionRequires customer action (e.g., 3DS authentication).
processingThe payment is being processed.
succeededPayment was captured successfully.
canceledThe PaymentIntent was canceled.

Create a PaymentIntent​

POST /v1/payment_intents

Parameters​

ParameterTypeDescription
amount requiredintegerAmount in the smallest currency unit (e.g., cents for USD).
currency requiredstringThree-letter ISO 4217 currency code (e.g., usd).
customer optionalstringID of an existing Customer.
description optionalstringAn arbitrary string describing the payment.
payment_method optionalstringID of a PaymentMethod to attach to this intent.
confirm optionalbooleanIf true, confirm immediately after creation. Default: false.
metadata optionalobjectKey-value pairs for storing additional information.
curl https://api.meridian.dev/v1/payment_intents \
-u sk_test_4eC39HqL...: \
-d amount=2000 \
-d currency=usd \
-d customer=cus_Nk3mHXq7ViGwMz \
-d description="Pro plan – monthly"
tip

Pass the client_secret from the response to your frontend. Use Meridian.js to confirm the payment — this keeps your secret key server-side at all times.


Retrieve a PaymentIntent​

GET /v1/payment_intents/:id

curl https://api.meridian.dev/v1/payment_intents/pi_3NqX2B4eHqLMHCmD \
-u sk_test_4eC39HqL...:

Confirm a PaymentIntent​

POST /v1/payment_intents/:id/confirm

Confirms that your customer intends to pay with the provided payment method.

curl https://api.meridian.dev/v1/payment_intents/pi_3NqX2B4eHqLMHCmD/confirm \
-u sk_test_4eC39HqL...: \
-d payment_method=pm_1NqX2B4eHqLMHCmD

Capture a PaymentIntent​

POST /v1/payment_intents/:id/capture

Captures the funds of an existing uncaptured PaymentIntent (when capture_method=manual).

curl https://api.meridian.dev/v1/payment_intents/pi_3NqX2B4eHqLMHCmD/capture \
-u sk_test_4eC39HqL...:

Cancel a PaymentIntent​

POST /v1/payment_intents/:id/cancel

Cancels a PaymentIntent. You cannot cancel a PaymentIntent with status succeeded.

curl https://api.meridian.dev/v1/payment_intents/pi_3NqX2B4eHqLMHCmD/cancel \
-u sk_test_4eC39HqL...:

List all PaymentIntents​

GET /v1/payment_intents

Returns a list of PaymentIntents sorted by creation date. Supports customer, limit, starting_after, and ending_before filters.