Epara DocsEpara DocumentationBack to dashboard
Epara Documentation
Merchant Integration Guide

Hosted Checkout, Merchant API, request signing, idempotency, and webhook rules.

Raw .md

Merchant Integration Guide

This guide is for merchant developers integrating with Epara. Small merchants can start with no-code Payment Links. Larger merchants should use Merchant API, Hosted Checkout, and Webhooks for automation.

Integration options

OptionWho uses it?When to choose it
Payment LinkMerchant without engineering teamWhatsApp, Instagram, SMS, or email collection.
Hosted CheckoutMerchant with website or appEpara hosts the secure payment page.
Merchant APIMerchant with backend systemOrders, invoices, refunds, payouts, and reports need automation.
QR / Code PaymentPhysical shop or field collectionCustomer pays at counter or in person.
WebhooksMerchant with order systemMerchant system must receive payment, refund, payout, or dispute events.

Environments

EnvironmentPurposeMoney movement
testIntegration, demo, QA, and test credentialNo real money movement.
liveReal merchant and consumer activityReal provider and ledger records.

Test and live credentials are separate. A test credential cannot create live payments.

Base request rule

Merchant API requests must include signing headers:

POST /api/merchant/payment-links HTTP/1.1
Host: api.epara.example
Content-Type: application/json
X-Epara-Key-Id: key_test_...
X-Epara-Timestamp: 2026-06-16T12:00:00Z
X-Epara-Nonce: 0f7d8a1a-6f0b-4c9d-9f92-8d865bb2a111
X-Epara-Signature: hmac_sha256_signature
X-Epara-API-Version: 2026-06-14.basra
Idempotency-Key: plink_school_2026_001

Signing model

Epara signs method, path, timestamp, nonce, API version, and body hash. This proves:

  • The request came from the merchant server.
  • The body was not modified in transit.
  • The nonce was not reused.
  • Timestamp drift is acceptable.
  • Merchant is using the expected API version.

Canonical string example:

POST
/api/merchant/payment-links
2026-06-16T12:00:00Z
0f7d8a1a-6f0b-4c9d-9f92-8d865bb2a111
2026-06-14.basra
sha256:6fd0a4...

Idempotency

Every request that creates persistent state or moves money must include Idempotency-Key.

OperationRequired?Why
Payment create/captureYesSame payment must not be created twice.
Refund createYesSame refund must not run twice.
Payout requestYesMerchant must not be paid twice for one request.
Payment Link createYesRetry should return same link.
Read/list requestsNoNo durable state or money movement.
{
  "merchantId": "mrc_demo_market",
  "title": "School fee - June 2026",
  "amount": 255000,
  "currency": "IQD",
  "referencePrefix": "SCH-2026",
  "allowedMethods": ["card", "consumer_wallet", "local_method"],
  "successUrl": "https://merchant.example/success",
  "cancelUrl": "https://merchant.example/cancel"
}

Successful response:

{
  "id": "plink_school_2026",
  "status": "active",
  "hostedUrl": "https://pay.epara.example/pay/school-fee",
  "amount": { "amount": 255000, "currency": "IQD" }
}

Webhook events

Merchants must not rely only on redirect URLs. The durable final result should come from signed webhooks.

EventWhen it fires
checkout.session.completedHosted Checkout completed successfully.
payment.capturedPayment became final ledger movement.
payment.failedPayment could not complete.
refund.succeededRefund completed successfully.
payout.paidProvider confirmed payout paid.
dispute.openedDispute or chargeback case opened.

Webhook verification

Merchant should verify:

  1. X-Epara-Webhook-Signature is valid.
  2. Timestamp is inside accepted drift window.
  3. Event id was not processed before.
  4. Event type is supported.
  5. Object id belongs to expected merchant-side object.

Error model

HTTP statusMeaning
400Invalid payload or missing required field.
401Missing credential or invalid signature.
403Credential scope does not allow operation.
404Object not found or does not belong to merchant.
409Idempotency or object-state conflict.
422Business rule, limit, risk, or verification block.
429Rate limit.
500Platform internal error. Retry with idempotency.

Integration checklist

  • Test API credential created.
  • Test payment link or checkout session completed.
  • Webhook endpoint verifies signed events.
  • Retry and idempotency tested.
  • Refund flow tested.
  • Payout destination and schedule approved.
  • Live API credential separated from test credential.
  • Live webhook endpoint tested.
  • Merchant go-live review completed.