DocsCharge · Test
Test API

Charge

Simulate card charges in the test environment. All transactions are simulated and do not process real funds. Use your test API key with /api/test/charge.

Important

Send requests to /api/test/charge with your test API key. For card numbers and expected outcomes, see the Test Cards reference.

Card Charge

POST/api/test/charge
EncryptedAPI Key

Payload encryption required. Encrypt the request JSON and send { "payload": "<iv>:<ciphertext>" }. Decrypt the response payload field. Encryption guide →. Do not share your API key or Encryption Key with anyone.

Uses the test gateway for sandbox testing. Request and response shapes match the live endpoint.

Same request body as the live endpoint. Use test card numbers below or on the Test Cards page.

Important

All payment API requests must be encrypted on your server before sending. Build the JSON below, encrypt it with your Encryption Key, and POST {"payload": "<iv_hex>:<ciphertext_hex>"}. Do not share your API key or Encryption Key with anyone — use them only on your backend. See the Encryption guide for code examples.

Request structure (encrypt this JSON)

{
  "merchantOrderId": "ORD-12345",

  "payment": {
    "amount": 100,
    "currency": "USD"
  },

  "card": {
    "number": "4539148800003011",
    "expiryMonth": 12,
    "expiryYear": 2031,
    "cvv": "123",
    "holderName": "John Doe"
  },

  "customer": {
    "firstName": "John",
    "lastName": "Doe",
    "email": "john@example.com",
    "ip": "185.23.44.91"
  },

  "billing": {
    "addressLine1": "12, Hill",
    "city": "Nevada",
    "state": "Nevada",
    "country": "US",
    "postalCode": "12345"
  },

  "callback": {
    "webhookUrl": "https://your-domain.com/webhook",
    "returnUrl": "https://your-domain.com/payment/callback"
  }
}

Wire format (send this to the API)

Encrypted request body

{
  "payload": "3f2a1b0c9d8e7f6a5b4c3d2e1f0a9b8c7d6e5f4a3b2c1d0e9f8a7b6c5d4e3f2a:8e4f2a1b0c9d8e7f6a5b4c3d2e1f0a9b8c7d6e5f4a3b2c1d0e9f8a7b6c5d4e3f2a1b0c9d8e7f6a5b4c3d2e1f0"
}

Request Parameters

Single reference table grouped by JSON object. Nested fields use dot notation (e.g. payment.amount).

FieldTypeRequiredDescription
Order
merchantOrderIdstringRequiredUnique order identifier from your system
merchantProfileIdnumberOptionalMerchant profile ID. Defaults to your PRIMARY profile if omitted
terminalIdstringOptionalTerminal ID to route the charge to a specific MID (skips routing/cascading)
descriptionstringOptionalHuman-readable payment description
metadatastringOptionalAdditional data as a JSON string
sourcestringOptionalPayment source. Use 'link' when charging via a payment link token
tokenstringOptionalPayment link token (required when source is 'link')
Paymentpayment
payment.amountnumberRequiredPayment amount (minimum 0.01)
payment.currencystringRequiredCurrency code (3 letters, e.g. USD, EUR)
Cardcard
card.numberstringRequiredCard number (13–19 digits)
card.expiryMonthnumberRequiredExpiry month (1–12)
card.expiryYearnumberRequiredExpiry year (4 digits)
card.cvvstringOptionalCVV code (3–4 digits)
card.holderNamestringOptionalName printed on the card
Customercustomer
customer.firstNamestringRequiredCustomer first name
customer.lastNamestringRequiredCustomer last name
customer.emailstringRequiredCustomer email address
customer.phoneNumberstringOptionalCustomer phone number
customer.ipstringOptionalCustomer IPv4 address for risk checks. Falls back to the request IP if omitted
Billingbilling
billing.addressLine1stringRequiredBilling street address
billing.citystringRequiredBilling city
billing.statestringRequiredBilling state or region
billing.countrystringRequiredBilling country (2-letter ISO code)
billing.postalCodestringRequiredBilling ZIP or postal code
Callbackcallback
callback.webhookUrlstringRequiredWebhook URL for transaction status notifications
callback.returnUrlstringRequiredURL to redirect the customer after payment or 3DS
callback.cancelUrlstringOptionalURL to redirect if the customer cancels

Test Card Numbers

Card NumberScenarioAuthStatusDescription
45391488000030103D Secure authentication3DSREDIRECTTriggers a 3D Secure flow. The API returns a redirect URL in the is3DS field. Send the customer to that URL to complete authentication.
4539148800003011Successful payment (2D)2DSUCCESSSimulates a frictionless approval with no 3DS step. The transaction completes immediately with a SUCCESS status.
4539148800003012Declined payment (2D)2DFAILEDSimulates an issuer decline with no 3DS step. The API returns success: false with status FAILED, error.code DECLINED, message, and full data (merchantOrderId, transactionId, amount, currency, customer fields). The wire response remains encrypted.

Response: 3D Secure (card 4539148800003010)

Important

When the card requires 3DS, the response has status: "REDIRECT" and an is3DS URL. Redirect the customer to that URL to complete authentication.

Important

All payment API responses — including success, declined, failed, and validation errors — are returned encrypted when you are authenticated. The wire body is {"success": true|false, "payload": "<iv_hex>:<ciphertext_hex>"}. Decrypt payload with your Encryption Key to read the standard JSON documented below. Outer success mirrors the decrypted outcome (false for declines and errors). Do not share your Encryption Key or API key — keep both on your server only.

Wire format (from API)

{
  "success": true,
  "payload": "7c8d9e0f1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6b7:4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6b7c8"
}

After decryption

3DS redirect

200
{
  "success": true,
  "status": "REDIRECT",
  "data": {
    "amount": 11,
    "currency": "USD",
    "merchantOrderId": "e21be056-d0c2-4003-be28-28dc88684b35",
    "transactionId": "FP2603YFGPKSWF0060",
    "firstName": "John",
    "lastName": "Doe",
    "address": "12, Hill",
    "city": "Nevada",
    "state": "Nevada",
    "country": "US",
    "email": "john@example.com",
    "webhookUrl": "https://your-domain.com/webhook"
  },
  "is3DS": "https://api.payoflux.com/payment/sandbox/card?transactionId=FP2603YFGPKSWF0060"
}

Response: 2D Success (card 4539148800003011)

Wire format (from API)

{
  "success": true,
  "payload": "7c8d9e0f1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6b7:4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6b7c8"
}

After decryption

2D success

200
{
  "success": true,
  "status": "SUCCESS",
  "data": {
    "amount": 11,
    "currency": "USD",
    "merchantOrderId": "e21be056-d0c2-4003-be28-28dc88684b35",
    "transactionId": "FP2603YFGPKSWF0060",
    "firstName": "John",
    "lastName": "Doe",
    "address": "12, Hill",
    "city": "Nevada",
    "state": "Nevada",
    "country": "US",
    "email": "john@example.com",
    "webhookUrl": "https://your-domain.com/webhook"
  }
}

Response: 2D Failed (card 4539148800003012)

Important

All payment API responses — including success, declined, failed, and validation errors — are returned encrypted when you are authenticated. The wire body is {"success": true|false, "payload": "<iv_hex>:<ciphertext_hex>"}. Decrypt payload with your Encryption Key to read the standard JSON documented below. Outer success mirrors the decrypted outcome (false for declines and errors). Do not share your Encryption Key or API key — keep both on your server only.

Wire format (from API)

{
  "success": true,
  "payload": "7c8d9e0f1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6b7:4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6b7c8"
}

After decryption

2D declined

200
{
  "success": false,
  "status": "FAILED",
  "message": "Transaction declined by issuer",
  "error": {
    "code": "DECLINED",
    "message": "Transaction declined by issuer"
  },
  "data": {
    "amount": 11,
    "currency": "USD",
    "merchantOrderId": "e21be056-d0c2-4003-be28-28dc88684b35",
    "transactionId": "FP2603YFGPKSWF0060",
    "firstName": "John",
    "lastName": "Doe",
    "address": "12, Hill",
    "city": "Nevada",
    "state": "Nevada",
    "country": "US",
    "email": "john@example.com",
    "webhookUrl": "https://your-domain.com/webhook"
  }
}