Get API Key
Obtain your unique API Key from the APEX dashboard for secure authentication
Step 1
// Include in all API requests Authorization: Bearer sk_live_your_secret_key
Install SDK
Choose your preferred language and install the APEX SDK
Step 2
npm install @apex/payment-optimization
Submit Transaction
Send transaction details to the optimization engine
Step 3
// POST /v1/optimize/transactions
const response = await fetch('https://api.apex-payments.com/v1/optimize/transactions', {
method: 'POST',
headers: {
'Authorization': 'Bearer sk_live_your_secret_key',
'Content-Type': 'application/json'
},
body: JSON.stringify({
request_id: 'req_1234567890abcdef',
merchant_id: 'merch_abc123',
transaction_data: {
payment_currency: 'USD',
payment_amount: 10000, // $100.00 in cents
card_details: {
card_brand: 'VISA',
card_type: 'CREDIT'
}
}
})
});Apply Optimization
Process the optimization advice for your transaction
Step 4
const data = await response.json();
// Apply recommendations
if (data.optimization_advice.payment_account_advice.action === 'USE_NETWORK_TOKEN') {
// Use network token for transaction
}
if (data.optimization_advice.three_ds_advice.action === 'TRIGGER_THREEDS') {
// Initiate 3DS authentication
}Get API Key
Obtain your unique API Key from the APEX dashboard for secure authentication
Install SDK
Choose your preferred language and install the APEX SDK
Submit Transaction
Send transaction details to the optimization engine
Apply Optimization
Process the optimization advice for your transaction
Code Examples
// Include in all API requests Authorization: Bearer sk_live_your_secret_key
npm install @apex/payment-optimization
// POST /v1/optimize/transactions
const response = await fetch('https://api.apex-payments.com/v1/optimize/transactions', {
method: 'POST',
headers: {
'Authorization': 'Bearer sk_live_your_secret_key',
'Content-Type': 'application/json'
},
body: JSON.stringify({
request_id: 'req_1234567890abcdef',
merchant_id: 'merch_abc123',
transaction_data: {
payment_currency: 'USD',
payment_amount: 10000, // $100.00 in cents
card_details: {
card_brand: 'VISA',
card_type: 'CREDIT'
}
}
})
});const data = await response.json();
// Apply recommendations
if (data.optimization_advice.payment_account_advice.action === 'USE_NETWORK_TOKEN') {
// Use network token for transaction
}
if (data.optimization_advice.three_ds_advice.action === 'TRIGGER_THREEDS') {
// Initiate 3DS authentication
}Node.js
Stablenpm install @apex/payment-optimizationPython
Stablepip install apex-paymentsPHP
Stablecomposer require apex/payment-sdkJava
BetaMaven and Gradle support availableGo
Coming Soongo get github.com/apex/apex-goRuby
Coming Soongem install apex-paymentsAPI Key Authentication
All API requests must include your API Key in the Authorization header. Keep your API Key confidential and never expose it in client-side code.
Authorization: Bearer sk_live_your_secret_key
# Example request
curl -X POST https://api.apex-payments.com/v1/optimize/transactions -H "Authorization: Bearer sk_live_your_secret_key" -H "Content-Type: application/json" -d '{...}'/v1/optimize/transactions
Submit transaction details and receive ML-powered optimization recommendations
Example Request
{
"request_id": "req_1234567890abcdef",
"merchant_id": "merch_abc123",
"transaction_data": {
"payment_currency": "USD",
"order_currency": "USD",
"payment_amount": 10000,
"mcc": "5732",
"order_create_time": "2023-10-27T10:30:00Z",
"card_details": {
"is_network_token": false,
"pan_hash": "a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6",
"card_brand": "VISA",
"card_type": "CREDIT",
"cvv_provided": true,
"expiration_date": "12/25",
"billing_address": {
"line1": "123 Main St",
"city": "Anytown",
"postal_code": "12345",
"country": "US"
}
},
"three_ds_status": "NOT_USED",
"token_usage": "NOT_USED",
"card_on_file_status": "NOT_COF"
}
}Example Response
{
"request_id": "req_1234567890abcdef",
"advice_id": "adv_fedcba0987654321",
"optimization_advice": {
"payment_account_advice": {
"action": "USE_NETWORK_TOKEN"
},
"card_on_file_advice": {
"action": "USE_COF"
},
"billing_address_advice": {
"action": "TRIGGER_AVS"
},
"three_ds_advice": {
"action": "TRIGGER_THREEDS"
},
"cvv_advice": {
"action": "SEND_CVV"
},
"exemption_advice": {
"action": "REQUEST_TRA_EXEMPTION"
}
}
}Payment Account
Recommendations for network token vs PAN usage
USE_NETWORK_TOKENUse network token for enhanced securityUSE_PANUse raw PAN for this transactionNO_SPECIFIC_ADVICENo specific recommendationCard on File
Optimize Card-on-File transaction processing
USE_COFProcess as Card-on-File transactionUSE_NON_COFProcess as non-COF transactionNO_SPECIFIC_ADVICENo specific recommendation3D Secure
Intelligent 3DS authentication guidance
TRIGGER_THREEDSInitiate 3DS authentication flowTRIGGER_DATA_ONLYUse data-only 3DS transactionTRIGGER_EXEMPTION_IN_AREQRequest exemption in AReqNO_SPECIFIC_ADVICENo specific recommendationCVV Handling
CVV processing recommendations
SEND_CVVInclude CVV in authorizationDROP_CVVProcess without CVVNO_SPECIFIC_ADVICENo specific recommendationExemptions
Authorization exemption strategies
REQUEST_TRA_EXEMPTIONRequest Transaction Risk Analysis exemptionREQUEST_LOW_VALUE_EXEMPTIONRequest Low Value exemptionNO_EXEMPTION_NEEDEDNo exemption recommendedBilling Address
AVS and billing address optimization
TRIGGER_AVSTrigger Address Verification ServiceKEEP_FIRST_5_OF_BILLING_ADDRESSUse first 5 chars of billing addressKEEP_FIRST_7_OF_BILLING_ADDRESSUse first 7 chars of billing addressNO_SPECIFIC_ADVICENo specific recommendationRequest was successful
Malformed or invalid request. Check error message for details
Missing or invalid API Key
No permission to access this resource
Unexpected server error occurred
Error Response Format
All error responses follow a consistent JSON structure
{
"error": {
"code": "invalid_parameter",
"message": "Missing required field: payment_amount",
"param": "transaction_data.payment_amount"
}
}API Documentation
Complete reference for transaction optimization API
Testing Sandbox
Full test environment with ML recommendations
Integration Examples
Real-world payment optimization patterns
99.99% Uptime
Enterprise-grade reliability and monitoring
Join the Developer Community
Get help, share ideas, and connect with other developers building on APEX.