Skip to main content

Post Transaction (Deprecated)

Endpoint​

POST /transaction

DEPRECATED

POST /transaction is deprecated. Use POST /direct-transaction for new integrations.

What this endpoint does​

Submit an invoice (INV) or credit note (CDT) for a Capricorn member. Capricorn validates the transaction against applicable business rules when the request is received. A successful validation returns a 202 Accepted response and the transaction is queued for processing against the member's account. A failed validation returns a 422 Unprocessable Entity response containing the business rules that were not satisfied, allowing the transaction details to be corrected and resubmitted.

important

A 202 Accepted response confirms that the transaction submission has been accepted for processing.

Request Headers​

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

HeaderTypeRequiredDescriptionConstraintsExample
client_idstringYesMandatory client credential that identifies the calling application.32-character alphanumeric, pattern ^([A-Za-z0-9]){32}$0123456789ABCDEF0123456789ABCDEF
client_secretstringYesMandatory client credential secret for the calling application.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​

This endpoint does not define any URI parameters or query parameters. All transaction details are supplied in the request body.

Request Body​

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

The example below shows a complete TransactionForPost payload using sample values.

important

cartId is applicable to E-Commerce Integration transactions and is not required for Direct Integration transactions.

{
"transactionAmount": 1500.95,
"transactionDate": "2024-03-13T08:49:53.542555Z",
"memberId": "111555",
"supplierId": "000000",
"invoiceNumber": "INV-1234567_ABC",
"sourceTransactionReference": "0000-0000000110272817_ABC",
"transactionType": "INV",
"cartId": "123456XY",
"country": "AU",
"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
}
]
}

Approved supplier-facing Direct Integration guidance: memberId: Six-digit numeric Capricorn member identifier. Example: 111555. supplierId: Six-digit numeric Capricorn supplier identifier. Example: 000000.

important

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

FieldTypeRequiredDescriptionConstraints / Example
transactionAmountnumberYesTransaction total amount sent for processing.Up to 2 decimal places; 1500.95
transactionDatestring (date-time)YesTransaction date and time in UTC.2024-03-13T08:49:53.542555Z
memberIdstringYesSix-digit numeric Capricorn member identifier.Six-digit numeric Capricorn member identifier. 111555
supplierIdstringYesSix-digit numeric Capricorn supplier identifier.Six-digit numeric Capricorn supplier identifier. 000000
invoiceNumberstringYesSupplier invoice number.INV-1234567_ABC
sourceTransactionReferencestringYesUnique identifier at the supplier side, used for duplicate prevention and response correlation.0000-0000000110272817_ABC
transactionTypestringYesTransaction type.INV (Invoice) or CDT (Credit Note)
cartIdstringNoOptional identifier for transactions originating from an E-Commerce Integration checkout or cart workflow. This field is not applicable to Direct Integration transactions.123456XY
countrystringNoOptional transaction country.AU (Australia) or NZ (New Zealand)
lineItemsarray of objectsNoOptional line-item breakdown of the transaction.See nested fields below.
lineItems[].idstringNoOptional line item identifier.Length 1-50; ABCD-123456
lineItems[].namestringNoOptional line item name.Length 1-100; ABCD 4X4 Battery
lineItems[].codestringYesRequired code for the line item.Length 1-100; SKU: A5439787
lineItems[].descriptionstringYesRequired description for the line item.Length 1-255; ABCD 4x4 and SUV Battery
lineItems[].unitPricenumberNoOptional unit price.Up to 2 decimal places; 209.59
lineItems[].quantitynumberNoOptional quantity.Up to 2 decimal places; 10
lineItems[].taxnumberNoOptional tax amount.Up to 2 decimal places; 100.01
lineItems[].totalAmountnumberYesRequired total amount for 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/transaction' \
-H 'Content-Type: application/json' \
-H 'client_id: 0123456789ABCDEF0123456789ABCDEF' \
-H 'client_secret: ABCDEF0123456789ABCDEF0123456789' \
-H 'source: CapLink' \
-H 'x-captoken: opaque-token' \
-H 'username: api.user' \
-H 'X-Correlation-ID: a0235ed0-d884-11ef-957a-005056afc7ce' \
-d '{
"transactionAmount": 1500.95,
"transactionDate": "2024-03-13T08:49:53.542555Z",
"memberId": "111555",
"supplierId": "000000",
"invoiceNumber": "INV-1234567_ABC",
"sourceTransactionReference": "0000-0000000110272817_ABC",
"transactionType": "INV",
"cartId": "123456XY",
"country": "AU",
"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​

A 202 Accepted response indicates that Capricorn has accepted the transaction submission request for processing.

Response headers

HeaderTypeRequiredDescriptionConstraintsExample
X-Correlation-IDstringNoThis is a unique ID passed in by the Consumer or returned as part of the response to correlate the HTTP Request and HTTP Response.Pattern ^[0-9a-zA-Z(\-){}]+$; minimum characters: 1a0235ed0-d884-11ef-957a-005056afc7ce

Response Body

FieldTypeDescriptionExample
sourceTransactionReferencestringEcho of the submitted source transaction reference.00000400011101-12743
correlationIdstringCorrelation identifier assigned to the request.a0235ed0-d884-11ef-957a-005056afc7ce
statusstringAcceptance status.Success
messagestringHuman-readable acknowledgement that Capricorn has accepted the request.The request has been accepted
{
"sourceTransactionReference": "00000400011101-12743",
"correlationId": "a0235ed0-d884-11ef-957a-005056afc7ce",
"status": "Success",
"message": "The request has been accepted"
}

400 Bad Request​

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

FieldTypeDescriptionExample
sourceTransactionReferencestringEchoes the submitted reference when it is available.00000400011101-12743
correlationIdstringCorrelation identifier returned with the rejected result when available.a0235ed0-d884-11ef-957a-005056afc7ce
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",
"correlationId": "a0235ed0-d884-11ef-957a-005056afc7ce",
"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."
}
}

409 Conflict​

Returned when the same sourceTransactionReference has already been submitted. Use a unique reference for each new transaction and treat this response as duplicate detection rather than a transient retry case.

FieldTypeDescriptionExample
sourceTransactionReferencestringEchoes the duplicate reference supplied in the request.00000400011101-12743
correlationIdstringCorrelation identifier returned with the rejected result when available.a0235ed0-d884-11ef-957a-005056afc7ce
error.typestringError category for duplicate submissions.CAP:DUPLICATE
error.descriptionstringShort summary of the duplicate condition.Duplicate transaction
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": "00000400011101-12743",
"correlationId": "a0235ed0-d884-11ef-957a-005056afc7ce",
"error": {
"type": "CAP:DUPLICATE",
"description": "Duplicate transaction",
"message": "Unable to process the contained instructions. Error due to Duplicate transaction request. Please check the transaction, for already submitted request."
}
}

422 Unprocessable Entity​

Returned when the request is valid JSON but fails Capricorn's business-rule validation, such as transaction cut-off or eligibility checks. Review the failedBusinessRules entries in the response to identify which rules failed and determine what needs to be corrected before retrying or escalating. The example rule IDs, names, and messages below are illustrative and may vary depending on the validation failure.

FieldTypeDescriptionExample
sourceTransactionReferencestringEchoes the submitted source transaction reference.00000400011101-12743
correlationIdstringCorrelation identifier returned with the rejected result when available.a0235ed0-d884-11ef-957a-005056afc7ce
businessRulesPassedbooleanIndicates the request failed business-rule validation.false
failedBusinessRulesarray of objectsBusiness rules that prevented processing.See nested fields below.
failedBusinessRules[].ruleIdnumberIdentifier of the failed business rule.19
failedBusinessRules[].ruleNamestringName of the failed business rule.ValidateTransactionCutOffDate
failedBusinessRules[].errorMessagestringHuman-readable explanation of the rule failure.Supplier Invoice Date Cannot Be outside Cut Off Period 1/11/2023 12:00:00 AM - 31/03/2024 12:00:00 AM
errorobjectStandard Capricorn error envelope object.See nested fields below
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
{
"sourceTransactionReference": "00000400011101-12743",
"correlationId": "a0235ed0-d884-11ef-957a-005056afc7ce",
"businessRulesPassed": false,
"failedBusinessRules": [
{
"ruleId": 19,
"ruleName": "ValidateTransactionCutOffDate",
"errorMessage": "Supplier Invoice Date Cannot Be outside Cut Off Period 1/11/2023 12:00:00 AM - 31/03/2024 12:00:00 AM"
}
],
"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. Retain the correlation ID for support follow-up when available.

Response Body

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 Capricorn tries to accept the transaction.

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."
}
}