Skip to main content

Payment Intent Reference

Endpoint​

POST /payment-intent

What this endpoint does​

Creates a payment intent for an e-commerce checkout transaction and returns a PaymentUrl that can be used to direct the member to the Capricorn hosted checkout experience. The payment intent contains the transaction context required to complete the payment journey using Capricorn's hosted payment pages.

Request Headers​

In the tables below, Required indicates that Capricorn cannot process the request without that value.

HeaderTypeRequiredDescriptionConstraintsExample
client_idstringYesClient application identifier for the calling system.32-character alphanumeric, pattern ^([A-Za-z0-9]){32}$0123456789ABCDEF0123456789ABCDEF
client_secretstringYesClient application secret for the calling system.32-character alphanumeric, pattern ^([A-Za-z0-9]){32}$ABCDEF0123456789ABCDEF0123456789
x-captokenstringYesMandatory Capricorn authorization token for the approved request context.64-character SHA-256 hash, pattern ^[a-fA-F0-9]64$opaque-token
X-Correlation-IDstringNoOptional correlation value used for tracing and support.Pattern ^[0-9a-zA-Z(\-){}]+$, min length 1a0235ed0-d884-11ef-957a-005056afc7ce

URI / Query Parameters​

ParameterTypeRequiredDescriptionConstraintsExample
Nonen/aNoThis endpoint does not define URI or query parameters.n/an/a

Request Body​

Requests to this endpoint must use Content-Type: application/json.

Creates a payment intent for an e-commerce checkout transaction and returns a hosted checkout URL. The request body contains the transaction, member, supplier, and callback information required to establish the checkout session. authContextToken is an optional value obtained through the Member Identity Handover flow and can be provided when an authenticated member context is available.

important

Callback URL domains should be registered during supplier onboarding. Callback URLs should use approved HTTPS domains.

important

Retain the state value supplied when creating the Payment Intent. When the member returns through the configured callback URL, validate that the returned state value matches the value originally associated with the checkout session.

important

The cartId used when creating the Payment Intent should remain consistent throughout the hosted checkout and final transaction submission flow.

memberId: Six-digit numeric Capricorn member identifier. supplierId: Six-digit numeric Capricorn supplier identifier.

important

If a Member ID contains fewer than six digits, include leading zeros when constructing the request. Examples: 001234, 000321, 088776, 000077

{
"transactionAmount": 99.99,
"transactionDate": "2024-03-13T08:49:53.542555Z",
"memberId": "111555",
"supplierId": "000000",
"authContextToken": "TEST-AUTH-CONTEXT-TOKEN-ABC123",
"checkoutReference": "CHK-20250908-00001",
"cartId": "123456XY",
"state": "checkout-state-token-20250908-00001",
"callbackUrls": {
"success": "https://callbacks.acmeparts.example.com/payments/success",
"failure": "https://callbacks.acmeparts.example.com/payments/failure",
"cancel": "https://callbacks.acmeparts.example.com/payments/cancel"
}
}
FieldTypeRequiredDescriptionConstraints / Example
transactionAmountnumberYesDollar value of the transaction.Minimum 0.01, multipleOf: 0.01; 99.99
transactionDatestring (date-time)YesTransaction timestamp in Zulu/UTC.2024-03-13T08:49:53.542555Z
memberIdstringYesSix-digit numeric Capricorn member identifier.Min length 2, max length 6; 111555
supplierIdstringYesSix-digit numeric Capricorn supplier identifier.Min length 2, max length 6; 000000
checkoutReferencestringYesCaller-defined checkout reference.CHK-20250908-00001
cartIdstringYesCart identifier.Pattern ^[a-zA-Z0-9_-]+$; maximum length 40; 123456XY
statestringYesOpaque state-management value returned through the checkout journey.Max length 50; checkout-state-token-20250908-00001
callbackUrlsobjectYesBrowser callback URLs.See nested fields below.
callbackUrls.successstringYesValid HTTPS URL.Pattern ^https://.+$; https://callbacks.acmeparts.example.com/payments/success
callbackUrls.failurestringYesValid HTTPS URL.URL string; HTTPS example https://callbacks.acmeparts.example.com/payments/failure
callbackUrls.cancelstringYesValid HTTPS URL.URL string; HTTPS example https://callbacks.acmeparts.example.com/payments/cancel
authContextTokenstringNoOptional token supplied from the Member Identity Handover flow. When provided, it links the Payment Intent to an authenticated Capricorn member context.TEST-AUTH-CONTEXT-TOKEN-ABC123

Code Examples​

important

Replace the example credentials with the values provided during onboarding. If the example includes a supplierId, use your own supplier ID associated with your x-captoken.

curl -X POST 'https://api.capricorn.example.com/payment-intent' \
-H 'Content-Type: application/json' \
-H 'client_id: 0123456789ABCDEF0123456789ABCDEF' \
-H 'client_secret: ABCDEF0123456789ABCDEF0123456789' \
-H 'x-captoken: opaque-token' \
-H 'username: api.user' \
-H 'X-Correlation-ID: a0235ed0-d884-11ef-957a-005056afc7ce' \
-d '{
"transactionAmount": 99.99,
"transactionDate": "2024-03-13T08:49:53.542555Z",
"memberId": "111555",
"supplierId": "000000",
"authContextToken": "TEST-AUTH-CONTEXT-TOKEN-ABC123",
"checkoutReference": "CHK-20250908-00001",
"cartId": "123456XY",
"state": "checkout-state-token-20250908-00001",
"callbackUrls": {
"success": "https://callbacks.acmeparts.example.com/payments/success",
"failure": "https://callbacks.acmeparts.example.com/payments/failure",
"cancel": "https://callbacks.acmeparts.example.com/payments/cancel"
}
}'

Responses​

important

X-Correlation-ID is generated automatically if omitted and may appear as correlationId in the response body.

201 Created​

Returned when Capricorn successfully creates the payment intent and allocates a hosted checkout URL.

FieldTypeDescriptionExample
PaymentUrlstringCapricorn-hosted checkout URL that the client should redirect the user to.https://checkout.capricorn.example/XXXXXX
{
"PaymentUrl": "https://checkout.capricorn.example/XXXXXX"
}

400 Bad Request​

Returned when required headers or request-body fields are missing, malformed, or outside the documented constraints.

FieldTypeDescriptionExample
error.typestringError category for request-shape or validation problems.CAP:BAD_REQUEST
error.descriptionstringShort summary of the failure category.Bad request
error.messagestringMessage describing what to correct before retrying.Invalid Request, Please validate the request message.
{
"error": {
"type": "CAP:BAD_REQUEST",
"description": "Bad request",
"message": "Invalid Request, Please validate the request message."
}
}

401 Unauthorized​

Returned when client_id or client_secret is missing or invalid.

FieldTypeDescriptionExample
error.typestringError category returned when authentication fails.CAP:UNAUTHORIZED
error.descriptionstringShort summary of the authentication failure.Unauthorized
error.messagestringExplains that the supplied client credentials were rejected.Client id or secret is invalid.
{
"error": {
"type": "CAP:UNAUTHORIZED",
"description": "Unauthorized",
"message": "Client id or secret is invalid."
}
}

422 Unprocessable Entity​

Returned when the payment intent request is understood but cannot be processed.

FieldTypeDescriptionExample
error.typestringError category for semantically invalid requests.CAP:UNPROCESSABLE_ENTITY
error.descriptionstringShort summary of the semantic failure.Unable to process the contained instructions(422)
error.messagestringExplains why the API could not continue processing the request.Unable to process the request due to Business Rules failure
{
"error": {
"type": "CAP:UNPROCESSABLE_ENTITY",
"description": "Unable to process the contained instructions(422)",
"message": "Unable to process the request due to Business Rules failure"
}
}

429 Too Many Requests​

Returned when the caller exceeds the API rate limit.

FieldTypeDescriptionExample
messagestringRate-limit message returned when too many requests are sent in a short period.Too Many Requests
{
"message": "Too Many Requests"
}

500 Internal Server Error​

Returned when the API encounters an unexpected server-side failure while creating the payment intent.

FieldTypeDescriptionExample
error.typestringError category for unexpected server-side failures.CAP:INTERNAL_SERVER_ERROR
error.descriptionstringShort summary of the server-side error.Internal server error
error.messagestringAdvises the client to retry later.API encountered an unexpected error. Please retry later.
{
"error": {
"type": "CAP:INTERNAL_SERVER_ERROR",
"description": "Internal server error",
"message": "API encountered an unexpected error. Please retry later."
}
}

503 Service Unavailable​

Returned when a backend dependency is unavailable or times out while creating the payment intent.

Response headers

HeaderTypeDescription
Retry-AfterstringOptional delay, in seconds, that the client should wait before retrying the request.

Response Body

FieldTypeDescriptionExample
error.typestringError category for temporary downstream or platform outages.CAP:SERVICE_UNAVAILABLE
error.descriptionstringShort summary of the availability issue.Service unavailable
error.messagestringIndicates the API timed out or could not reach a backend service.A timeout occurred while processing the request.
{
"error": {
"type": "CAP:SERVICE_UNAVAILABLE",
"description": "Service unavailable",
"message": "A timeout occurred while processing the request."
}
}