Post Transaction (Deprecated)
Endpoint
POST /transaction
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.
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.
| Header | Type | Required | Description | Constraints | Example |
|---|---|---|---|---|---|
client_id | string | Yes | Mandatory client credential that identifies the calling application. | 32-character alphanumeric, pattern ^([A-Za-z0-9]){32}$ | 0123456789ABCDEF0123456789ABCDEF |
client_secret | string | Yes | Mandatory client credential secret for the calling application. | 32-character alphanumeric, pattern ^([A-Za-z0-9]){32}$ | ABCDEF0123456789ABCDEF0123456789 |
x-captoken | string | Yes | Mandatory Capricorn authorization token for the approved request context. | 64-character SHA-256 hash, pattern ^[a-fA-F0-9]{64}$ | opaque-token |
X-Correlation-ID | string | No | Optional correlation value used for tracing and support. | Pattern ^[0-9a-zA-Z(\-){}]+$, min length 1 | a0235ed0-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.
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.
If a Member ID contains fewer than six digits, include leading zeros when constructing the request. Examples: 001234, 000321, 088776, 000077
| Field | Type | Required | Description | Constraints / Example |
|---|---|---|---|---|
transactionAmount | number | Yes | Transaction total amount sent for processing. | Up to 2 decimal places; 1500.95 |
transactionDate | string (date-time) | Yes | Transaction date and time in UTC. | 2024-03-13T08:49:53.542555Z |
memberId | string | Yes | Six-digit numeric Capricorn member identifier. | Six-digit numeric Capricorn member identifier. 111555 |
supplierId | string | Yes | Six-digit numeric Capricorn supplier identifier. | Six-digit numeric Capricorn supplier identifier. 000000 |
invoiceNumber | string | Yes | Supplier invoice number. | INV-1234567_ABC |
sourceTransactionReference | string | Yes | Unique identifier at the supplier side, used for duplicate prevention and response correlation. | 0000-0000000110272817_ABC |
transactionType | string | Yes | Transaction type. | INV (Invoice) or CDT (Credit Note) |
cartId | string | No | Optional identifier for transactions originating from an E-Commerce Integration checkout or cart workflow. This field is not applicable to Direct Integration transactions. | 123456XY |
country | string | No | Optional transaction country. | AU (Australia) or NZ (New Zealand) |
lineItems | array of objects | No | Optional line-item breakdown of the transaction. | See nested fields below. |
lineItems[].id | string | No | Optional line item identifier. | Length 1-50; ABCD-123456 |
lineItems[].name | string | No | Optional line item name. | Length 1-100; ABCD 4X4 Battery |
lineItems[].code | string | Yes | Required code for the line item. | Length 1-100; SKU: A5439787 |
lineItems[].description | string | Yes | Required description for the line item. | Length 1-255; ABCD 4x4 and SUV Battery |
lineItems[].unitPrice | number | No | Optional unit price. | Up to 2 decimal places; 209.59 |
lineItems[].quantity | number | No | Optional quantity. | Up to 2 decimal places; 10 |
lineItems[].tax | number | No | Optional tax amount. | Up to 2 decimal places; 100.01 |
lineItems[].totalAmount | number | Yes | Required total amount for the line item. | Up to 2 decimal places; 2195.91 |
Code Examples
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
- HTTP
- JavaScript
- Python
- C
- Java
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
}
]
}'
POST /transaction HTTP/1.1
Host: api.capricorn.example.com
Content-Type: application/json
client_id: 0123456789ABCDEF0123456789ABCDEF
client_secret: ABCDEF0123456789ABCDEF0123456789
source: CapLink
x-captoken: opaque-token
username: api.user
X-Correlation-ID: a0235ed0-d884-11ef-957a-005056afc7ce
{
"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
}
]
}
const payload = {
"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
}
]
};
const response = await fetch('https://api.capricorn.example.com/transaction', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'client_id': '0123456789ABCDEF0123456789ABCDEF',
'client_secret': 'ABCDEF0123456789ABCDEF0123456789',
'source': 'CapLink',
'x-captoken': 'opaque-token',
'username': 'api.user',
'X-Correlation-ID': 'a0235ed0-d884-11ef-957a-005056afc7ce',
},
body: JSON.stringify(payload),
});
const data = await response.json();
console.log(data);
import requests
payload = {
"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
}
]
}
response = requests.request(
'POST',
'https://api.capricorn.example.com/transaction',
headers={
'Content-Type': 'application/json',
'client_id': '0123456789ABCDEF0123456789ABCDEF',
'client_secret': 'ABCDEF0123456789ABCDEF0123456789',
'source': 'CapLink',
'x-captoken': 'opaque-token',
'username': 'api.user',
'X-Correlation-ID': 'a0235ed0-d884-11ef-957a-005056afc7ce',
},
json=payload,
)
print(response.status_code)
print(response.json())
#include <curl/curl.h>
int main(void) {
CURL *curl = curl_easy_init();
struct curl_slist *headers = NULL;
if (!curl) return 1;
curl_easy_setopt(curl, CURLOPT_URL, "https://api.capricorn.example.com/transaction");
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
headers = curl_slist_append(headers, "Content-Type: application/json");
headers = curl_slist_append(headers, "client_id: 0123456789ABCDEF0123456789ABCDEF");
headers = curl_slist_append(headers, "client_secret: ABCDEF0123456789ABCDEF0123456789");
headers = curl_slist_append(headers, "source: CapLink");
headers = curl_slist_append(headers, "x-captoken: opaque-token");
headers = curl_slist_append(headers, "username: api.user");
headers = curl_slist_append(headers, "X-Correlation-ID: a0235ed0-d884-11ef-957a-005056afc7ce");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
const char *payload = "{\"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}]}";
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, payload);
curl_easy_perform(curl);
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
return 0;
}
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
String payload = "{\"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}]}";
HttpClient client = HttpClient.newHttpClient();
HttpRequest.Builder builder = HttpRequest.newBuilder()
.uri(URI.create("https://api.capricorn.example.com/transaction"))
.header("Content-Type", "application/json")
.header("client_id", "0123456789ABCDEF0123456789ABCDEF")
.header("client_secret", "ABCDEF0123456789ABCDEF0123456789")
.header("source", "CapLink")
.header("x-captoken", "opaque-token")
.header("username", "api.user")
.header("X-Correlation-ID", "a0235ed0-d884-11ef-957a-005056afc7ce")
.method("POST", HttpRequest.BodyPublishers.ofString(payload));
HttpResponse<String> response = client.send(builder.build(), HttpResponse.BodyHandlers.ofString());
System.out.println(response.statusCode());
System.out.println(response.body());
Responses
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
| Header | Type | Required | Description | Constraints | Example |
|---|---|---|---|---|---|
X-Correlation-ID | string | No | This 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: 1 | a0235ed0-d884-11ef-957a-005056afc7ce |
Response Body
| Field | Type | Description | Example |
|---|---|---|---|
sourceTransactionReference | string | Echo of the submitted source transaction reference. | 00000400011101-12743 |
correlationId | string | Correlation identifier assigned to the request. | a0235ed0-d884-11ef-957a-005056afc7ce |
status | string | Acceptance status. | Success |
message | string | Human-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.
| Field | Type | Description | Example |
|---|---|---|---|
sourceTransactionReference | string | Echoes the submitted reference when it is available. | 00000400011101-12743 |
correlationId | string | Correlation identifier returned with the rejected result when available. | a0235ed0-d884-11ef-957a-005056afc7ce |
error.type | string | Error category for request-shape or validation problems. | CAP:BAD_REQUEST |
error.description | string | Short summary of the failure category. | Bad request |
error.message | string | Message 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.
| Field | Type | Description | Example |
|---|---|---|---|
error.type | string | Error category returned when authentication fails. | CAP:UNAUTHORIZED |
error.description | string | Short summary of the authentication failure. | Unauthorized |
error.message | string | Explains 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.
| Field | Type | Description | Example |
|---|---|---|---|
sourceTransactionReference | string | Echoes the duplicate reference supplied in the request. | 00000400011101-12743 |
correlationId | string | Correlation identifier returned with the rejected result when available. | a0235ed0-d884-11ef-957a-005056afc7ce |
error.type | string | Error category for duplicate submissions. | CAP:DUPLICATE |
error.description | string | Short summary of the duplicate condition. | Duplicate transaction |
error.message | string | Explains 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.
| Field | Type | Description | Example |
|---|---|---|---|
sourceTransactionReference | string | Echoes the submitted source transaction reference. | 00000400011101-12743 |
correlationId | string | Correlation identifier returned with the rejected result when available. | a0235ed0-d884-11ef-957a-005056afc7ce |
businessRulesPassed | boolean | Indicates the request failed business-rule validation. | false |
failedBusinessRules | array of objects | Business rules that prevented processing. | See nested fields below. |
failedBusinessRules[].ruleId | number | Identifier of the failed business rule. | 19 |
failedBusinessRules[].ruleName | string | Name of the failed business rule. | ValidateTransactionCutOffDate |
failedBusinessRules[].errorMessage | string | Human-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 |
error | object | Standard Capricorn error envelope object. | See nested fields below |
error.type | string | Error category for semantically invalid requests. | CAP:UNPROCESSABLE_ENTITY |
error.description | string | Short summary of the semantic failure. | Unable to process the contained instructions(422) |
error.message | string | Explains 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.
| Field | Type | Description | Example |
|---|---|---|---|
message | string | Rate-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
| Field | Type | Description | Example |
|---|---|---|---|
error.type | string | Error category for unexpected server-side failures. | CAP:INTERNAL_SERVER_ERROR |
error.description | string | Short summary of the server-side error. | Internal server error |
error.message | string | Advises 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
| Header | Type | Description |
|---|---|---|
Retry-After | string | Optional delay, in seconds, that the client should wait before retrying the request. |
Response Body
| Field | Type | Description | Example |
|---|---|---|---|
error.type | string | Error category for temporary downstream or platform outages. | CAP:SERVICE_UNAVAILABLE |
error.description | string | Short summary of the availability issue. | Service unavailable |
error.message | string | Indicates 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."
}
}