EndpointsCreate Payment Invoice

Create Payment Invoice

Create Payment Invoice

Creates a dynamic invoice tied to a specific payment link template, allowing merchants to pass customer and product details.

POST https://checkout-server.apara.com/checkout/payment-link/invoice

The API URLs are the same for Sandbox and Production. Only the API keys change.

Headers

HeaderRequiredValue
Content-Typeapplication/json
x-api-keyYour Public Key (pk_...)
x-timestampCurrent time in milliseconds since the Unix epoch
x-signatureHMAC-SHA256 hash of the request
X-Api-Versionv1
x-trace-idOptional identifier for request tracking

HMAC Signature

The message is the HTTP method, API path, timestamp and JSON request body concatenated together, signed with HMAC-SHA256 using your secret key.

const method = 'POST';
const path = '/checkout/payment-link/invoice';
const timestamp = Date.now().toString();
const body = JSON.stringify(requestBody);

const message = method + path + timestamp + body;
const signature = crypto.createHmac('sha256', SECRET_KEY)
  .update(message)
  .digest('hex');

Body Parameters

ParameterTypeRequiredDescription
paymentLinkIdstringUnique ID of the payment link template created in the Merchant Dashboard (pattern ^[a-f0-9]{24}$)
amountstringPayment amount, passed as a string to avoid floating-point precision errors (pattern ^\d+(\.\d{1,2})?$)
currencystringThree-letter currency code (ISO 4217) — USD, EUR, GBP, JPY, AUD, CAD, CHF, CNY, INR, SGD, HKD, NZD, SEK, KRW, NOK, MXN, BRL, ZAR, RUB, TRY and others
productDetailsobjectProduct information shown at checkout
individualobjectCustomer information
successRedirectUrlURIURL to redirect the user to after a successful payment
failureRedirectUrlURIURL to redirect the user to after a failed payment
customerOrderIdstringUnique order identifier from the merchant's system (1–100 characters)

See SDK Reference → Parameters for the full field breakdown of productDetails, individual and address.

Example Request

{
  "paymentLinkId": "69c39577e1a0100cf92c3406",
  "amount": "49.99",
  "currency": "USD",
  "productDetails": {
    "name": "Premium Annual Plan",
    "description": "12-month access to all premium features",
    "imageUrl": "https://example.com/product-image.png"
  },
  "individual": {
    "firstName": "Jane",
    "lastName": "Smith",
    "email": "jane@example.com"
  },
  "successRedirectUrl": "https://yourapp.com/payment/success",
  "failureRedirectUrl": "https://yourapp.com/payment/failure",
  "customerOrderId": "order-12345"
}

Example Response

{
  "success": true,
  "data": {
    "paymentUrl": "https://checkout-widget.apara.com/checkout/payment-link/..."
  }
}

Response Codes

CodeMeaning
200Invoice created successfully — returns the payment URL for customer checkout
400Bad Request — invalid request data, missing required fields, or validation errors
401Unauthorized — invalid API key, missing/invalid timestamp, or invalid HMAC signature
403Forbidden — API key inactive or expired, IP not whitelisted, or environment not authorized
404Not Found — payment link ID does not exist or has been deleted
500Internal Server Error — unexpected server error during invoice creation