Skip to main content

Post Cart Transaction Reference

Endpoint​

POST /cart/{cartId}/transaction

What this endpoint does​

Submit an invoice (INV) or credit note (CDT) for a Capricorn member as part of an E-Commerce checkout. The transaction is associated with the cart identified by cartId in the request URL. Capricorn validates the transaction against applicable business rules before accepting it for processing. If validation fails, the response identifies the business rules that were not satisfied so the transaction can be corrected and resubmitted.

important

Include cartId in the request URL, not in the JSON request body. A 202 Accepted response confirms that the transaction submission has been accepted for processing.

important

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

Request Headers​

In the tables below, Required indicates the established supplier-facing guidance for making the request.

HeaderTypeRequiredDescriptionConstraintsExample
client_idstringYesClient credential that identifies the calling application.32-character alphanumeric, pattern ^([A-Za-z0-9]){32}$0123456789ABCDEF0123456789ABCDEF
client_secretstringYesClient credential secret for the calling application.32-character alphanumeric, pattern ^([A-Za-z0-9]){32}$ABCDEF0123456789ABCDEF0123456789
x-captokenstringYesCapricorn authorization token for the approved request context.64-character hexadecimal SHA-256 hashYOUR_x-captoken
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​

ParameterTypeRequiredDescriptionConstraints / Example
cartIdstringYesIdentifier of the E-Commerce cart associated with the transaction.Pattern ^[a-zA-Z0-9_-]+$; maximum length 40; 123456XY

Example: POST /cart/123456XY/transaction.

Request Body​

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

{
"transactionAmount": 1500.95,
"invoiceDate": "2025-09-23",
"memberId": "111555",
"supplierId": "000000",
"invoiceNumber": "INV-1234567_ABC",
"sourceTransactionReference": "0000-0000000110272817_ABC",
"transactionType": "INV",
"lineItems": [
{
"id": "ABCD-123456",
"name": "ABCD 4X4 Battery",
"code": "SKU: A5439787",
"description": "ABCD 4x4 and SUV Battery",
"unitPrice": 209.59,
"quantity": 10,
"tax": 100.01,
"totalAmount": 2195.91
}
]
}
important

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

important

invoiceDate must be provided in YYYY-MM-DD format. Example: 2025-09-23.

FieldTypeRequiredDescriptionConstraints / Example
transactionAmountnumberYesTransaction total amount.Up to 2 decimal places; 1500.95
invoiceDatestring (date-only)YesInvoice date of the transaction.yyyy-MM-dd; 2025-09-23
memberIdstringYesSix-digit numeric Capricorn member identifier.111555
supplierIdstringYesSix-digit numeric Capricorn supplier identifier.000000
invoiceNumberstringYesSupplier invoice number.Pattern ^[a-zA-Z0-9_.\/-]+$; maximum length 37; INV-1234567_ABC
sourceTransactionReferencestringYesUnique identifier at the supplier side, used for duplicate prevention and response correlation.Pattern ^[a-zA-Z0-9_.\/-]+$; maximum length 40; 0000-0000000110272817_ABC
transactionTypestringYesTransaction type.INV (Invoice) or CDT (Credit Note)
lineItemsarray of objectsNoOptional line-item breakdown of the transaction.See nested fields below.
lineItems[].idstringNoLine item identifier.Length 1-50; ABCD-123456
lineItems[].namestringNoLine item name.Length 1-100
lineItems[].codestringYesLine item code.Length 1-100; SKU: A5439787
lineItems[].descriptionstringYesLine item description.Length 1-255
lineItems[].unitPricenumberNoUnit price.Up to 2 decimal places; 209.59
lineItems[].quantitynumberNoQuantity.Up to 2 decimal places; 10
lineItems[].taxnumberNoTax amount.Up to 2 decimal places; 100.01
lineItems[].totalAmountnumberYesTotal amount of the line item.Up to 2 decimal places; 2195.91

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/cart/123456XY/transaction' \
-H 'Content-Type: application/json' \
-H 'client_id: YOUR_CLIENT_ID' \
-H 'client_secret: YOUR_CLIENT_SECRET' \
-H 'x-captoken: YOUR_x-captoken' \
-H 'source: CapLink' \
-d '{
"transactionAmount": 1500.95,
"invoiceDate": "2025-09-23",
"memberId": "111555",
"supplierId": "000000",
"invoiceNumber": "INV-1234567_ABC",
"sourceTransactionReference": "0000-0000000110272817_ABC",
"transactionType": "INV",
"lineItems": [
{
"id": "ABCD-123456",
"name": "ABCD 4X4 Battery",
"code": "SKU: A5439787",
"description": "ABCD 4x4 and SUV Battery",
"unitPrice": 209.59,
"quantity": 10,
"tax": 100.01,
"totalAmount": 2195.91
}
]
}'

Responses​

important

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

202 Accepted​

Response Body

FieldTypeDescriptionExample
sourceTransactionReferencestringSupplier-side transaction reference.nxzh8q60x
correlationIdstringCorrelation identifier for the request.8ae67050-0203
messagestringAcknowledgement that the request has been accepted.The request has been accepted for processing.
statusstringAcceptance status.Success
{
"sourceTransactionReference": "nxzh8q60x",
"correlationId": "8ae67050-0203",
"message": "The request has been accepted for processing.",
"status": "Success"
}

400 Bad Request​

The request could not be processed as submitted.

Response Body

FieldTypeDescriptionExample
sourceTransactionReferencestringSupplier-side reference for the transaction.00000400011101-12743
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.
{
"sourceTransactionReference": "00000400011101-12743",
"error": {
"type": "CAP:BAD_REQUEST",
"description": "Bad request",
"message": "Invalid Request, Please validate the request message."
}
}

401 Unauthorized​

Returned when an invalid token is provided.

FieldTypeDescriptionExample
sourceTransactionReferencestring or nullSupplier-side reference for the transaction, if available.null
correlationIdstringCorrelation identifier for the request.66115d60-f74a-11f0-91e3-005056b79fa9
error.typestringError category returned when authentication fails.CAP:UNAUTHORIZED
error.descriptionstringShort summary of the authentication failure.Unauthorized
error.messagestringExplains that the supplied token was rejected.Invalid token provided
{
"sourceTransactionReference": null,
"correlationId": "66115d60-f74a-11f0-91e3-005056b79fa9",
"error": {
"type": "CAP:UNAUTHORIZED",
"description": "Unauthorized",
"message": "Invalid token provided"
}
}

404 Not Found​

The supplied cart was not found.

Response Body

FieldTypeDescriptionExample
sourceTransactionReferencestringSupplier-side transaction reference.srcTranxRef12346
correlationIdstringCorrelation identifier for the request.52068040-e243-11f1-834b-001dd8b71c6a
error.typestringError category for the missing cart.CAP:NOT_FOUND
error.descriptionstringSummary of the failure.Resource Not Found
error.messagestringExplains that the supplied cart was not found.The provided cartId is not found.
{
"sourceTransactionReference": "srcTranxRef12346",
"correlationId": "52068040-e243-11f1-834b-001dd8b71c6a",
"error": {
"type": "CAP:NOT_FOUND",
"description": "Resource Not Found",
"message": "The provided cartId is not found."
}
}

409 Conflict​

The supplied trait identifies a duplicate transaction request.

Response Body

FieldTypeDescriptionExample
sourceTransactionReferencestringSupplier-side reference for the transaction.srcTranxRef12346
correlationIdstringCorrelation identifier for the request.9ea389c0-e243-11f1-a8a2-00155d147f19
error.typestringError category for duplicate submissions.CAP:CONFLICT
error.descriptionstringShort summary of the duplicate condition.Conflict
error.messagestringExplains that the transaction reference has already been submitted.Unable to process the contained instructions. Error due to Duplicate transaction request. Please check the transaction, for already submitted request.
{
"sourceTransactionReference": "srcTranxRef12346",
"correlationId": "9ea389c0-e243-11f1-a8a2-00155d147f19",
"error": {
"type": "CAP:CONFLICT",
"description": "Conflict",
"message": "Unable to process the contained instructions. Error due to Duplicate transaction request. Please check the transaction, for already submitted request."
}
}

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​

The API encountered an unexpected server-side error.

Response Body

FieldTypeDescriptionExample
sourceTransactionReferencestringSupplier-side transaction reference.00000400011101-12743
error.typestringError category for the server-side failure.CAP:INTERNAL_SERVER_ERROR
error.descriptionstringSummary of the failure.Internal server error
error.messagestringAdvises retrying later.API encountered an unexpected error. Please retry later.
{
"sourceTransactionReference": "00000400011101-12743",
"error": {
"type": "CAP:INTERNAL_SERVER_ERROR",
"description": "Internal server error",
"message": "API encountered an unexpected error. Please retry later."
}
}

503 Service Unavailable​

The supplied trait describes a timeout connecting to a backend API or system.

Response Body

FieldTypeDescriptionExample
sourceTransactionReferencestringSupplier-side reference for the transaction.00000400011101-12743
error.typestringError category for temporary downstream or platform outages.CAP:SERVICE_UNAVAILABLE
error.descriptionstringShort summary of the availability issue.Service unavailable
error.messagestringIndicates a timeout connecting to a backend API or system.A Connection Timeout Error was encountered connecting to a backend API or System.
{
"sourceTransactionReference": "00000400011101-12743",
"error": {
"type": "CAP:SERVICE_UNAVAILABLE",
"description": "Service unavailable",
"message": "A Connection Timeout Error was encountered connecting to a backend API or System."
}
}