Payment Intents API
The Payment Intents API allows you to create, query, and manage payment intents. Payment intents represent individual payment attempts and contain all the necessary information for processing payments through various gateways.
Create a payment intent
Creates a new payment intent that can be used to process a payment through a specific gateway.
Parameters
gatewaystringThe name of the gateway that this payment intent is associated with. This needs to match the list of gateway names provided by Orchestrapay through the POST /checkout-intents endpoint.
checkout_intentoptional, stringThe uuid that you received from creating a checkout intent (using the POST /checkout-intents endpoint). If a value is provided, you no longer need to provide any other field except `gateway`.
amountintegerThe amount for the payment intent in cents (e.g. for 200 EGP, use 20000). Must be greater than or equal to 0.
currencystringThe currency code using an ISO 3 code, e.g. EGP for Egyptian Pound, USD for US Dollar, etc.
checkout_intent_idempotency_keyoptional, stringAn idempotency key provided by the merchant, this is a free-form optional string that, if provided, will restrain from two similar resources being created.
human_friendly_payment_intent_secretoptional, stringAn optional free-form value that will be displayed to the customer on the front-end as a reference. This is typically the Order Name that the customer can see on the merchant website and will be used for troubleshooting with the CX team of the merchant.
payment_intent_timeout_secondsoptional, integer, default is 1800The SLA in seconds after which the payment intent is deemed cancelled. We start counting the SLA only after the payment intent is created, if you create a checkout intent at T0 and a payment intent at T1, the SLA time expiry is calculated from T1.
webhook_urlsoptional, arrayA list of URLs that will be subscribed to all new events for this payment intent (or payment intents associated with this checkout intents). Each will receive the same payload at the same time.
webhook_secretoptional, stringAn optional webhook secret that is sent over as a header in every webhook that we send, under the header name Orchestrapay-Webhook-Secret
final_success_urloptional, stringThe final URL where the customer will be redirected once the payment intent is successful. If no value is provided, the customer will be shown a generic success message (we strongly advise to provide a value).
final_failure_urloptional, stringThe final URL where the customer will be redirected if the payment intent is canceled, fails or times out past its SLA. If no value is provided, the customer will be shown a generic failure message (we strongly advise to provide a value).
feature_flagoptional, stringA feature flag to be executed for the payment intent. Feature flags allow you to display a certain behaviour to certain customers.
tenantoptional, stringName of the tenant (you can have multiple tenants for the same integration).
lgoptional, stringAny locale that you want to use for the payment intent. You can also specify a locale when redirecting the user by appending the ?lg= property to the querystring.
line_itemsoptional, arrayA cart object containing the items being purchased
payloadoptional, objectThe payload that the merchant receives. This is used to run pre-credit checks with the BNPLs and to speed up the checkout process, this is also returned to you through the webhook so it could be useful to store any metadata you need.
curl -X POST https://api.orchestrapay.com/payment-intents \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"gateway": "mybnpl-stg",
"checkout_intent": "7b8e759b-530a-4e34-8538-2d65c933f38d",
"amount": 15000,
"currency": "EGP",
"checkout_intent_idempotency_key": "my_idempotency_key 123",
"human_friendly_payment_intent_secret": "#1925",
"payment_intent_timeout_seconds": 1800,
"webhook_urls": ["https://excited-candied-measure.glitch.me/"],
"webhook_secret": "My.Secret",
"final_success_url": "https://example.com/?order_successful",
"final_failure_url": "https://example.com/?order_canceled",
"feature_flag": "filter6mo",
"tenant": "myshop-1029x",
"lg": "fr_MA",
"line_items": [
{
"name": "Order 123",
"quantity": 2,
"price": 100,
"image": "https://pay.orchestrapay.com/order123.svg",
"category": "Mobile Phones",
"slug": "random-slug",
"url": "https://www.example.com"
}
],
"payload": {
"some_data": "Unstructured JSON object with cart and customer data"
}
}'Response Parameters
payment_intentstringUnique identifier for the payment intent
resource_createdbooleanIndicates if a new resource was created
target_urlstringURL to redirect the customer to complete the payment intent
{
"payment_intent": "550e8400-e29b-41d4-a716-446655440000",
"resource_created": true,
"target_url": "https://api.orchestrapay.com/payment-intents/redirect?payment_intent=550e8400-e29b-41d4-a716-446655440000"
}Query payment intents
Retrieves a paginated list of payment intents that match your query criteria.
Query Parameters
limitoptional, integer, default is 50Number of entities per page (max 1000)
pageoptional, integerPage number to query
sortByoptional, stringSort by property:ASC|DESC (e.g., "amount:DESC"). Available columns: payment_intent_secret, amount_paid_by_customer, amount
filteroptional, objectFilter parameters for querying payment intents
Filter Operators
$eqEqual to$notNot equal to$nullIs null$inIn array$gtGreater than$gteGreater than or equal to$ltLess than$lteLess than or equal to$btwBetween$ilikeCase-insensitive like$swStarts with$containsContainscurl https://api.orchestrapay.com/payment-intents \
-H "Authorization: Bearer YOUR_API_KEY" \
-d "limit=50" \
-d "page=1" \
-d "sortBy=amount:DESC" \
-d "filter.currency=$eq:EGP" \
-d "filter.status=$in:success,canceled"Response Parameters
data[]arrayArray of payment intent objects
metaobjectPagination metadata
linksobjectPagination links
Notes
- The response follows JSON:API pagination specifications
- You can sort by the following columns:
payment_intent_secret,amount_paid_by_customer,amount - Filterable properties include:
currency,created_at,updated_at,status,amount,checkout_intent,payment_intent_secret,checkout_intent_idempotency_key,gateway,gateway_transaction_id,gateway_transaction_human_readable,payment_intent - To fetch a single record by ID, use
?filter.payment_intent_secret=$eq:... - Status values in the response are simplified to their base form (e.g.,
pending_createdbecomespending)
{
"data": [
{
"payment_intent_secret": 1234,
"payment_intent": "550e8400-e29b-41d4-a716-446655440000",
"amount": 1000,
"currency": "EGP",
"status": "success",
"sub_status": "success",
"created_at": "2023-07-01T12:00:00Z",
"updated_at": "2023-07-01T12:00:00Z",
"checkout_intent_idempotency_key": "order_123",
"gateway": "paystack",
"phone_number": "+201234567890",
"step_number": 4,
"last_reason": null
}
],
"meta": {
"itemsPerPage": 50,
"totalItems": 95,
"currentPage": 2,
"totalPages": 4,
"sortBy": [["amount", "DESC"]]
},
"links": {
"first": "https://api-staging.orchestrapay.com/payment-intents?page=1&limit=50&sortBy=amount:DESC",
"previous": "https://api-staging.orchestrapay.com/payment-intents?page=1&limit=50&sortBy=amount:DESC",
"current": "https://api-staging.orchestrapay.com/payment-intents?page=2&limit=50&sortBy=amount:DESC",
"next": "https://api-staging.orchestrapay.com/payment-intents?page=3&limit=50&sortBy=amount:DESC",
"last": "https://api-staging.orchestrapay.com/payment-intents?page=4&limit=50&sortBy=amount:DESC"
}
}Get payment intent details
Retrieves public data for a specific payment intent. This endpoint is safe to use in frontend applications.
Parameters
payment_intentstringThe payment intent UUID to retrieve
curl https://api.orchestrapay.com/payment-intents/550e8400-e29b-41d4-a716-446655440000 \
-H "Authorization: Bearer YOUR_API_KEY"Response Parameters
amountintegerPayment intent amount in cents
currencystringThree-letter ISO currency code
payment_intentstringPayment intent UUID
human_friendly_payment_intent_secretstringHuman-readable payment intent ID
gatewaystringPayment gateway used
payment_intent_timeout_secondsintegerTimeout duration in seconds
final_failure_urlstringURL to redirect on failure
final_success_urlstringURL to redirect on success
statusstringPayment intent status
initial_dataobjectGateway-specific initial data
payment_intent_datestringPayment intent creation date
feature_flagstringFeature flag identifier
tenantobjectTenant information
tenant_initial_user_dataobjectUser data associated with payment intent
lgstringLanguage code
x_token_idstringToken identifier
step_numberintegerCurrent step in payment intent flow
last_reasonstringLast status reason
{
"amount": 1000,
"currency": "EGP",
"payment_intent": "550e8400-e29b-41d4-a716-446655440000",
"human_friendly_payment_intent_secret": "PI123",
"gateway": "paystack",
"payment_intent_timeout_seconds": 3600,
"final_failure_url": "https://example.com/failure",
"final_success_url": "https://example.com/success",
"status": "pending",
"initial_data": {
"checkout_url": "https://checkout.paystack.com/123"
},
"payment_intent_date": "2023-07-01T12:00:00Z",
"feature_flag": "new_ui",
"tenant": {
"logo": "https://example.com/logo.png",
"favicon": "https://example.com/favicon.ico"
},
"tenant_initial_user_data": {
"phone_number": "+201234567890",
"email": "customer@example.com",
"payment_intent_channel": "web",
"redirect_to": "https://example.com"
},
"lg": "en",
"x_token_id": "token_123",
"step_number": 1,
"last_reason": "Waiting for customer action"
}Cancel payment intent
Cancels a payment intent that is still in a mutable state.
Parameters
payment_intentstringThe payment intent UUID to cancel
Status Codes
200 OK: Payment intent was successfully canceled404 Not Found: No payment intent with the given UUID exists409 Conflict: Payment intent is not mutable (already completed or canceled)
curl -X PUT https://api.orchestrapay.com/payment-intents/550e8400-e29b-41d4-a716-446655440000/cancel \
-H "Authorization: Bearer YOUR_API_KEY"Response Parameters
amountintegerPayment intent amount in cents
currencystringThree-letter ISO currency code
payment_intentstringPayment intent UUID
human_friendly_payment_intent_secretstringHuman-readable payment intent ID
gatewaystringPayment gateway used
payment_intent_timeout_secondsintegerTimeout duration in seconds
final_failure_urlstringURL to redirect on failure
final_success_urlstringURL to redirect on success
statusstringPayment intent status (canceled)
initial_dataobjectGateway-specific initial data
payment_intent_datestringPayment intent creation date
feature_flagstringFeature flag identifier
tenantobjectTenant information
tenant_initial_user_dataobjectUser data associated with payment intent
lgstringLanguage code
x_token_idstringToken identifier
step_numberintegerThe last successful step before the transaction failed.
last_reasonstringLast status reason
{
"amount": 1000,
"currency": "EGP",
"payment_intent": "550e8400-e29b-41d4-a716-446655440000",
"human_friendly_payment_intent_secret": "PI123",
"gateway": "paystack",
"payment_intent_timeout_seconds": 3600,
"final_failure_url": "https://example.com/failure",
"final_success_url": "https://example.com/success",
"status": "canceled",
"initial_data": {
"checkout_url": "https://checkout.paystack.com/123"
},
"payment_intent_date": "2023-07-01T12:00:00Z",
"feature_flag": "new_ui",
"tenant": {
"logo": "https://example.com/logo.png",
"favicon": "https://example.com/favicon.ico"
},
"tenant_initial_user_data": {
"phone_number": "+201234567890",
"email": "customer@example.com",
"payment_intent_channel": "web",
"redirect_to": "https://example.com"
},
"lg": "en",
"x_token_id": "token_123",
"step_number": 4,
"last_reason": null
}