Post Direct Transaction Reference
Endpoint
POST /direct-transaction
What this endpoint does
Submit an invoice (INV) or credit note (CDT) for a Capricorn member using the invoice date. Capricorn validates the transaction against applicable business rules before accepting it for processing. If the transaction fails validation, the response identifies the business rules that were not satisfied so the transaction can 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 the established supplier-facing guidance for making the request.
| Header | Type | Required | Description | Constraints | Example |
|---|---|---|---|---|---|
client_id | string | Yes | Client credential that identifies the calling application. | 32-character alphanumeric, pattern ^([A-Za-z0-9]){32}$ | 0123456789ABCDEF0123456789ABCDEF |
client_secret | string | Yes | Client credential secret for the calling application. | 32-character alphanumeric, pattern ^([A-Za-z0-9]){32}$ | ABCDEF0123456789ABCDEF0123456789 |
x-captoken | string | Yes | Capricorn authorization token for the approved request context. | 64-character hexadecimal SHA-256 hash | YOUR_CAP_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.
{
"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
}
]
}
If a Member ID contains fewer than six digits, include leading zeros when constructing the request. Examples: 001234, 000321, 088776, 000077
invoiceDate must be provided in YYYY-MM-DD format. Example: 2025-09-23.
| Field | Type | Required | Description | Constraints / Example |
|---|---|---|---|---|
transactionAmount | number | Yes | Transaction total amount. | Up to 2 decimal places; 1500.95 |
invoiceDate | string (date-only) | Yes | Invoice date of the transaction. | yyyy-MM-dd; 2025-09-23 |
memberId | string | Yes | Six-digit numeric Capricorn member identifier. | 111555 |
supplierId | string | Yes | Six-digit numeric Capricorn supplier identifier. | 000000 |
invoiceNumber | string | Yes | Supplier invoice number. | Pattern ^[a-zA-Z0-9_.\/-]+$; maximum length 37; INV-1234567_ABC |
sourceTransactionReference | string | Yes | Unique identifier at the supplier side, used for duplicate prevention and response correlation. | Pattern ^[a-zA-Z0-9_.\/-]+$; maximum length 40; 0000-0000000110272817_ABC |
transactionType | string | Yes | Transaction type. | INV (Invoice) or CDT (Credit Note) |
lineItems | array of objects | No | Optional line-item breakdown of the transaction. | See nested fields below. |
lineItems[].id | string | No | Line item identifier. | Length 1-50; ABCD-123456 |
lineItems[].name | string | No | Line item name. | Length 1-100 |
lineItems[].code | string | Yes | Line item code. | Length 1-100; SKU: A5439787 |
lineItems[].description | string | Yes | Line item description. | Length 1-255 |
lineItems[].unitPrice | number | No | Unit price. | Up to 2 decimal places; 209.59 |
lineItems[].quantity | number | No | Quantity. | Up to 2 decimal places; 10 |
lineItems[].tax | number | No | Tax amount. | Up to 2 decimal places; 100.01 |
lineItems[].totalAmount | number | Yes | Total amount of 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/direct-transaction' \
-H 'Content-Type: application/json' \
-H 'client_id: YOUR_CLIENT_ID' \
-H 'client_secret: YOUR_CLIENT_SECRET' \
-H 'x-captoken: YOUR_CAP_TOKEN' \
-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
}
]
}'
POST /direct-transaction HTTP/1.1
Host: api.capricorn.example.com
Content-Type: application/json
client_id: YOUR_CLIENT_ID
client_secret: YOUR_CLIENT_SECRET
x-captoken: YOUR_CAP_TOKEN
source: CapLink
{
"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
}
]
}
const payload = {
"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
}
]
};
const response = await fetch('https://api.capricorn.example.com/direct-transaction', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'client_id': 'YOUR_CLIENT_ID',
'client_secret': 'YOUR_CLIENT_SECRET',
'x-captoken': 'YOUR_CAP_TOKEN',
'source': 'CapLink',
},
body: JSON.stringify(payload),
});
console.log(response.status);
console.log(await response.text());
import requests
payload = {
"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
}
]
}
response = requests.post(
'https://api.capricorn.example.com/direct-transaction',
headers={
'Content-Type': 'application/json',
'client_id': 'YOUR_CLIENT_ID',
'client_secret': 'YOUR_CLIENT_SECRET',
'x-captoken': 'YOUR_CAP_TOKEN',
'source': 'CapLink',
},
json=payload,
)
print(response.status_code)
print(response.text)
#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/direct-transaction");
headers = curl_slist_append(headers, "Content-Type: application/json");
headers = curl_slist_append(headers, "client_id: YOUR_CLIENT_ID");
headers = curl_slist_append(headers, "client_secret: YOUR_CLIENT_SECRET");
headers = curl_slist_append(headers, "x-captoken: YOUR_CAP_TOKEN");
headers = curl_slist_append(headers, "source: CapLink");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
const char *payload = "{\"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}]}";
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, payload);
CURLcode result = curl_easy_perform(curl);
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
return result == CURLE_OK ? 0 : 1;
}
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
String payload = "{\"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}]}";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.capricorn.example.com/direct-transaction"))
.header("Content-Type", "application/json")
.header("client_id", "YOUR_CLIENT_ID")
.header("client_secret", "YOUR_CLIENT_SECRET")
.header("x-captoken", "YOUR_CAP_TOKEN")
.header("source", "CapLink")
.POST(HttpRequest.BodyPublishers.ofString(payload))
.build();
HttpResponse<String> response = client.send(request, 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
The request has been accepted 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 | Required | Description / Example |
|---|---|---|---|
sourceTransactionReference | string | No | Supplier-side transaction reference. Example: srcTranxRef1234 |
correlationId | string | No | Correlation identifier for the request. Example: a0235ed0-d884-11ef-957a-005056afc7ce |
message | string | Yes | Acknowledgement that the request has been accepted. Example: The request has been accepted for processing. |
status | string | No | Acceptance status. Example: Success |
{
"sourceTransactionReference": "srcTranxRef1234",
"correlationId": "a0235ed0-d884-11ef-957a-005056afc7ce",
"message": "The request has been accepted for processing.",
"status": "Success"
}
400 Bad Request
The request could not be processed as submitted.
Response Body
| Field | Type | Description | Example |
|---|---|---|---|
sourceTransactionReference | string | Supplier-side reference for the transaction. | 00000400011101-12743 |
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",
"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.
| Field | Type | Description | Example |
|---|---|---|---|
sourceTransactionReference | string or null | Supplier-side reference for the transaction, if available. | null |
correlationId | string | Correlation identifier for the request. | 1e9a2980-e240-11f1-a8a2-00155d147f19 |
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 token was rejected. | Invalid token provided |
{
"sourceTransactionReference": null,
"correlationId": "1e9a2980-e240-11f1-a8a2-00155d147f19",
"error": {
"type": "CAP:UNAUTHORIZED",
"description": "Unauthorized",
"message": "Invalid token provided"
}
}
409 Conflict
The supplied trait identifies a duplicate transaction request.
Response Body
| Field | Type | Description | Example |
|---|---|---|---|
sourceTransactionReference | string | Supplier-side reference for the transaction. | srcTranxRef12346 |
correlationId | string | Correlation identifier for the request. | 9ea389c0-e243-11f1-a8a2-00155d147f19 |
error.type | string | Error category for duplicate submissions. | CAP:CONFLICT |
error.description | string | Short summary of the duplicate condition. | Conflict |
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": "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."
}
}
422 Unprocessable Entity
The Direct Transaction trait describes a business-rules failure using the following error envelope.
Response Body
| Field | Type | Description | Example |
|---|---|---|---|
sourceTransactionReference | string | Supplier-side transaction reference. | srcTranxRef12345678 |
correlationId | string | Correlation identifier for the request. | 00783be0-e240-11f1-a8a2-00155d147f19 |
error.type | string | Error category for the business-rule failure. | CAP:BUSINESS_RULE_FAILURE |
error.description | string | Summary of the validation failure. | Business Rule(s) validation failed |
error.message | string | Explains that business-rule validation failed. | Transaction cannot be processed due to one or multiple business rule failure(s). |
{
"sourceTransactionReference": "srcTranxRef12345678",
"correlationId": "00783be0-e240-11f1-a8a2-00155d147f19",
"error": {
"type": "CAP:BUSINESS_RULE_FAILURE",
"description": "Business Rule(s) validation failed",
"message": "Transaction cannot be processed due to one or multiple business rule failure(s)."
}
}
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
The API encountered an unexpected server-side error.
Response Body
| Field | Type | Description | Example |
|---|---|---|---|
sourceTransactionReference | string | Supplier-side transaction reference. | 00000400011101-12743 |
error.type | string | Error category for the server-side failure. | CAP:INTERNAL_SERVER_ERROR |
error.description | string | Summary of the failure. | Internal server error |
error.message | string | Advises 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
| Field | Type | Description | Example |
|---|---|---|---|
sourceTransactionReference | string | Supplier-side reference for the transaction. | 00000400011101-12743 |
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 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."
}
}