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
| Header | Value |
|---|---|
x-api-key | Your Public Key (pk_...) |
x-timestamp | Current time in milliseconds (Unix epoch) |
x-signature | HMAC-SHA256 hash of the request |
X-Api-Version | v1 |
Content-Type | application/json |
x-trace-id | Optional — 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
| Field | Type | Description |
|---|---|---|
paymentLinkId | string | Widget template ID from dashboard |
amount | string | e.g. "49.99" |
currency | string | ISO 4217 code e.g. "USD" |
productDetails | object | Must include name |
individual | object | Must include firstName and lastName |
successRedirectUrl | string | Redirect on success |
failureRedirectUrl | string | Redirect on failure |
customerOrderId | string | Your unique order reference |
Response
{
"success": true,
"data": {
"paymentUrl": "https://checkout-widget.apara.com/checkout/payment-link/..."
}
}
Use paymentUrl to redirect your customer.