Integration StepsStep 3: Create a Transaction

Step 3: Create a Transaction

Step 3: Create a Transaction

A transaction is a payment attempt initiated via the Apara Checkout API.

When you create a transaction:

  • You hit the Apara Checkout API and provide the transaction details
  • You receive a redirection URL in the response
  • This link opens the Apara-hosted page which has the Checkout Widget

The optional details of the individual object are needed by Apara for creating a transaction. If you pass these details, the user won't be asked again in checkout. Otherwise, the user will first need to fill in this information on the Apara-hosted page.

Tip: Pre-filling customer details improves conversion and speeds up checkout.

Getting Your API Keys

Go to Dashboard → Settings to generate your API keys.

  • You need both a Public key (pk_...) and a Secret key
  • Key generation requires 2FA — the same 2FA you use to log in to the dashboard
  • Sandbox and Production each have separate API key pairs

API Endpoint

POST /checkout/payment-link/invoice

Base URL: https://checkout-server.apara.com

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

Authentication Headers

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

HMAC Signature Calculation

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');

Required Request Fields

FieldTypeDescription
paymentLinkIdstringWidget template ID from dashboard
amountstringe.g. "49.99"
currencystringISO 4217 code e.g. "USD"
productDetailsobjectMust include name
individualobjectMust include firstName and lastName
successRedirectUrlstringRedirect on success
failureRedirectUrlstringRedirect on failure
customerOrderIdstringYour unique order reference

Response

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

Use paymentUrl to redirect your customer.