Payment Intents API
The Payment Intents API lets you create, query, and manage payment intents. A payment intent represents a single payment. Create it on your server with an amount and a currency, then collect it on the hosted page or the embedded form.
Create a payment intent
Creates a payment intent. It covers every gateway you have connected, so you do not pick a gateway here. All you need is an amount and a currency.
Parameters
amountintegerThe amount for the payment intent in cents (e.g. for $200.00, use 20000). Must be greater than or equal to 0.
currencystringThe currency code using an ISO 3 code, e.g. USD for US Dollar, EUR for Euro, etc.
idempotency_keyoptional, stringA unique, free-form key. Sending the same request with the same idempotency key returns the existing payment intent instead of creating a duplicate.
customeroptional, string | objectAttach a customer to this payment intent. Pass a customer id (cus_...) to attach an existing customer as-is, or pass an object and we reconcile it for you: send whatever customer data you have and we create or update the record on our end. Matching is keyed on your reference — reuse the same reference to update that customer, send a new (or no) reference to create one. It is a partial update: only the fields you include change; omitted fields are left untouched. The response returns the resulting cus_... id.
metadataoptional, objectA set of string key-value pairs you can attach to the payment intent. Returned to you on webhooks, handy for storing your own order references.
timeoutoptional, integer, default is 1800Seconds after which the payment intent is canceled if it has not succeeded. Counted from the moment the payment intent is created.
webhooksoptional, arrayWebhook endpoints to notify about this payment intent's events. Each endpoint is configured independently.
return_urloptional, stringThe URL the customer is redirected to after the hosted payment flow finishes, whether it succeeded, failed, or timed out. Read the payment intent status on that page (via Get payment intent details) to determine the outcome and branch your UI. If omitted, the customer sees a generic result page.
import Orchestrapay, { ApiVersion } from '@orchestrapay/sdk';
const orchestrapay = new Orchestrapay('orch_sk_live_eu1_...', ApiVersion.v202607);
const paymentIntent = await orchestrapay.paymentIntents.create({
amount: 15000,
currency: 'usd',
idempotency_key: 'order_123',
webhooks: [
{
url: 'https://yoursite.com/webhooks/orchestrapay',
secret: 'your_webhook_secret',
events: ['payment.success', 'payment.canceled'],
},
],
return_url: 'https://example.com/order/return',
});
// paymentIntent.payment_intent -> "pi_eu1_..."
// paymentIntent.url -> hosted checkout page
// paymentIntent.status -> "pending"Response Parameters
payment_intentstringThe typed, region-coded identifier for the payment intent (e.g. pi_eu1_...).
statusstringThe payment intent status. Always pending on creation.
amountintegerThe amount, in cents, echoed back.
currencystringThe 3-letter ISO currency, echoed back.
urlstringThe Orchestrapay hosted payment page for this payment intent. Redirect the customer here to collect the payment without building your own checkout. (You can instead embed it with @orchestrapay/react using the pi_ id and your publishable key.)
expires_atstringISO 8601 timestamp after which the payment intent auto-cancels if not paid (created time + timeout).
customerstringThe customer reference (cus_...), returned only when a customer was created or matched.
resource_createdbooleantrue if a new payment intent was created, false if an existing one was returned via your idempotency key.
{
"payment_intent": "pi_eu1_b8b5be0f481f42b4b7f5972118777c5f",
"status": "pending",
"amount": 15000,
"currency": "usd",
"url": "https://pay.orchestrapay.com/pay/pi_eu1_b8b5be0f481f42b4b7f5972118777c5f",
"expires_at": "2026-07-07T13:30:00Z",
"customer": "cus_eu1_2c1d7ef04db08d2e5e980f3f3bc70000",
"resource_created": true
}Query payment intents
Returns a list of payment intents, most recent first. Results are cursor-paginated and can be narrowed with a fixed set of filters.
Query Parameters
limitoptional, integer, default is 25How many payment intents to return, 1 to 100.
starting_afteroptional, stringA cursor for pagination: a payment intent id (pi_...). Returns the page of results immediately after this object. Use the id of the last item from the previous page to fetch the next page.
ending_beforeoptional, stringA cursor for pagination: a payment intent id (pi_...). Returns the page of results immediately before this object.
statusoptional, stringOnly return payment intents with this status: pending, success, or canceled.
createdoptional, objectFilter by creation time. Pass a Unix timestamp (or ISO 8601) for an exact match, or a range object.
customeroptional, stringOnly return payment intents attached to this customer (cus_...).
currencyoptional, stringOnly return payment intents in this 3-letter ISO currency.
Notes
- Results are ordered by creation time, most recent first.
- Pagination is cursor-based: pass the last item's
pi_id asstarting_afterto get the next page. There are no page numbers.
const params = new URLSearchParams({
limit: '25',
status: 'success',
currency: 'usd',
'created[gte]': '1704067200',
starting_after: 'pi_eu1_b8b5be0f481f42b4b7f5972118777c5f'
});
const response = await fetch(
'https://api-{region}.orchestrapay.com/v202607/payment-intents?' + params,
{ headers: { 'Authorization': 'Bearer orch_sk_live_eu1_...' } }
);Response Parameters
dataarrayThe list of payment intents, most recent first.
has_morebooleantrue if there are more results after this page. Fetch them with starting_after set to the last item's id.
{
"data": [
{
"payment_intent": "pi_eu1_b8b5be0f481f42b4b7f5972118777c5f",
"status": "success",
"amount": 15000,
"currency": "USD",
"customer": "cus_eu1_2c1d7ef04db08d2e5e980f3f3bc70000",
"created_at": "2026-07-01T12:00:00Z"
}
],
"has_more": true
}Get payment intent details
Retrieves a payment intent. Returns the same shape as when you create one, plus
its current status.
Parameters
payment_intentstringThe payment intent reference to retrieve (pi_...).
const response = await fetch('https://api-{region}.orchestrapay.com/v202607/payment-intents/pi_eu1_b8b5be0f481f42b4b7f5972118777c5f', {
headers: { 'Authorization': 'Bearer orch_sk_live_eu1_...' }
});Response Parameters
payment_intentstringThe payment intent reference (pi_...).
statusstringpending, success, or canceled.
amountintegerAmount in cents.
currencystringThree-letter ISO currency code.
urlstringThe Orchestrapay hosted payment page for this payment intent.
expires_atstringISO 8601 timestamp after which the payment intent auto-cancels if not paid.
customerstringThe attached customer (cus_...), if any.
created_atstringISO 8601 creation timestamp.
{
"payment_intent": "pi_eu1_b8b5be0f481f42b4b7f5972118777c5f",
"status": "success",
"amount": 15000,
"currency": "USD",
"url": "https://pay.orchestrapay.com/pay/pi_eu1_b8b5be0f481f42b4b7f5972118777c5f",
"expires_at": "2026-07-07T13:30:00Z",
"customer": "cus_eu1_2c1d7ef04db08d2e5e980f3f3bc70000",
"created_at": "2026-07-01T12:00:00Z"
}Cancel payment intent
Cancels a payment intent that is still in a mutable (pending) state. Returns the canceled payment intent.
Parameters
payment_intentstringThe payment intent reference to cancel (pi_...).
Status Codes
200 OK: Payment intent was canceled404 Not Found: No payment intent with the given reference exists409 Conflict: Payment intent is not mutable (already succeeded or canceled)
const response = await fetch('https://api-{region}.orchestrapay.com/v202607/payment-intents/pi_eu1_b8b5be0f481f42b4b7f5972118777c5f/cancel', {
method: 'POST',
headers: { 'Authorization': 'Bearer orch_sk_live_eu1_...' }
});Response Parameters
Returns the payment intent object (same shape as Get payment intent details) with status set to canceled.
{
"payment_intent": "pi_eu1_b8b5be0f481f42b4b7f5972118777c5f",
"status": "canceled",
"amount": 15000,
"currency": "USD",
"url": "https://pay.orchestrapay.com/pay/pi_eu1_b8b5be0f481f42b4b7f5972118777c5f",
"expires_at": "2026-07-07T13:30:00Z",
"customer": "cus_eu1_2c1d7ef04db08d2e5e980f3f3bc70000",
"created_at": "2026-07-01T12:00:00Z"
}