v1 · vendor API ← Home Try the simulator

OnePay Online Vendor API

The OnePay Online vendor flow lets a merchant load supported customer institutions, initiate a payment, confirm it using OTP, check the status when the payment hub (DPH) needs more time, and list vendor transactions for history and reporting.

SmartPay is the payment service of the SmartBank platform by Sarab Tech. Merchants with a Mediterranean Bank (Meditbank) corporate account can receive payments from customers of all OnePay member banks through this API.

ItemValue
Base URL{{BaseUrl}} — provided with your merchant onboarding
Base route/smartpay/api/online/vendor/onepay
AuthenticationX-Api-Key header on every request
Request tracingX-Request-Id where shown
CurrencyLYD (Libyan Dinar), code 434
FormatJSON over HTTPS

Authentication & common headers

All endpoints are authenticated with a vendor API key sent in the X-Api-Key header. The backend uses it to identify and authorize your vendor/POS.

HeaderRequiredUsed byDescription
X-Api-KeyYesAll endpointsVendor API key identifying and authorizing the vendor/POS.
X-Request-IdRecommended / required where shownInitiate, confirm, status checkUnique id per request, used for tracing and safe retries. Never reuse an id for a different request.
Content-TypeYes for POSTInitiate, confirmapplication/json for request bodies.
Keep your API key on the server. Never embed X-Api-Key in browser or mobile code. All calls to this API should come from your backend.

Recommended integration flow

StepCallDeveloper action
1Get institutionsLoad once for the UI, or refresh when the institution list may change.
2Initiate paymentSend customer identifier, institution id, and amount. Save transactionId.
3Confirm paymentSend transactionId and OTP. If the response status is pending, check status.
4Check statusUse when the confirmation result is pending or DPH still needs time.
5Get transactionsUse for vendor history/reporting. Always use paging.
Want to see it live? Jump to the payment flow simulator — it walks the full init → OTP → confirm → status cycle with mock responses.

1 · Get OnePay institutions

GET{{BaseUrl}}/smartpay/api/online/vendor/onepay/get-institutions

Returns the institutions/banks the merchant can show to the customer. The selected institution id is later sent as CustomerInstitutionId. No body or query parameters.

Response — 200 OK

FieldTypeDescription
idstringInstitution id to send as CustomerInstitutionId.
namestringInstitution display name.
shortNamestringShort name/code for the UI.
logostringLogo URL or empty string.
[
  { "id": "000010", "name": "Bank of Commerce and Development", "shortName": "BCD", "logo": "https://…/bcd.png" },
  { "id": "000002", "name": "Al Jumhouria Bank", "shortName": "AJB", "logo": "https://…/ajb.png" }
]
Use this endpoint to populate the institution selector before initiating the payment.

2 · Initiate OnePay payment

POST{{BaseUrl}}/smartpay/api/online/vendor/onepay/init-transfer

Creates a OnePay payment request for a customer and returns the transactionId used in confirm and status-check calls.

Request body

FieldTypeRequiredDescription
CustomerIdentifierstringYesCustomer phone number or service identifier. Example: 0910000000.
CustomerInstitutionIdstringYesCustomer institution id, usually 6 digits. Example: 000010.
AmountdecimalYesPayment amount in LYD. Must be greater than 0.

Response — 200 OK

FieldTypeDescription
transactionIdstringTransaction created by the initiation step. Required for confirmation/status check.
customerNamestringResolved customer/from-account owner name.
customerInstitutionNamestringResolved institution name.
amountdecimalRequested payment amount.
{
  "customerName": "Mock Customer",
  "customerInstitutionName": "Bank of Commerce and Development",
  "amount": 100.234,
  "transactionId": "019f220e-5284-7434-833d-0e068d2da8d4"
}
Call this first. The returned transactionId is required to confirm the payment. The customer receives/approves the OTP through the OnePay flow.

3 · Confirm OnePay payment

POST{{BaseUrl}}/smartpay/api/online/vendor/onepay/confirm-transfer

Confirms an initiated payment using transactionId and OTP. The response may still be pending while DPH finishes processing.

Request body

FieldTypeRequiredDescription
TransactionIdstringYestransactionId returned by Initiate OnePay Payment.
OtpstringYesOTP provided by the customer. Send digits only; trim spaces.

Response — 200 OK

FieldTypeDescription
transactionIdstringTransaction id being confirmed, when returned.
bankTransactionIdstringBank/internal transaction reference if available.
isErrorbooleanfalse means the request was accepted by the API. It does not always mean final completion.
errorMessagestringError message when isError is true; empty string when no API-level error.
hostReferencestringHost/reference value used for tracing.
dphReferencestringReference returned by DPH.
statusintCurrent status. 0 usually means Pending; call the status endpoint to refresh.
{
  "transactionId": "019ed65a-25a4-7b40-9233-5dd7689a212e",
  "bankTransactionId": "019ed65a-2595-73a8-a7ce-809c2661605d",
  "isError": false,
  "errorMessage": "",
  "hostReference": "019ed65a228478f78f405a6fd2db19c0",
  "dphReference": "15344481",
  "status": 0
}
Important: use confirm only after a successful initiation. If isError is false but status is 0, call Check Payment Status after a short delay — DPH may need time to finalize the payment.

4 · Check OnePay payment status

GET{{BaseUrl}}/smartpay/api/online/vendor/onepay/check-transaction-status/:id

Checks the latest known status of a OnePay transaction. Use this when the UI is waiting, the confirm response is pending, or the result is unclear.

Path parameter

NameTypeRequiredDescription
idstringYestransactionId returned by initiation.

Response — 200 OK

FieldTypeDescription
statusintCurrent status — see Transaction status values.
isErrorbooleanWhether the status check returned an API-level error.
transactionCodestringTransaction/bank code if available.
transactionIdstringTransaction being checked.
bankTransactionIdstringBank/internal transaction reference if available.
{
  "status": 0,
  "isError": false,
  "transactionCode": "42612385",
  "transactionId": "019ed531-4a8f-7ca1-a3a1-c91d205e8133",
  "bankTransactionId": "019ed531-4a27-7503-a3de-ca9207adcaf4"
}
Poll carefully: use a short delay and a retry limit, not an infinite loop. When status becomes 1 Completed, update the merchant UI and stop polling. If it becomes Failed/Cancelled, show the returned API message if available.

5 · Get vendor transactions

GET{{BaseUrl}}/smartpay/api/online/vendor/onepay/get-transactions

Returns the authenticated vendor's OnePay transactions with paging and optional filters.

Query parameters

NameTypeRequiredExampleDescription
pageintOptional1Page number, starting from 1.
pageSizeintOptional20Number of rows per page.
statusint/stringOptional1Filter by transaction status if enabled.
fromDatedateOptional2026-07-01Start date, yyyy-MM-dd.
toDatedateOptional2026-07-05End date, yyyy-MM-dd.

Response — 200 OK

FieldTypeDescription
idstringTransaction id.
transactionCodestringDPH reference if available.
amountdecimalTransaction amount.
currencystringCurrency code. 434 means LYD.
customerAccountNamestringCustomer account holder name.
customerInstitutionNamestringCustomer institution name.
pointOfSaleNamestringVendor point-of-sale display name.
sourcestringTransaction source, e.g. Onepay.
statusintTransaction status value.
createdAtdatetimeCreation date/time.
confirmedAtdatetime?Confirmation date/time, or null if not confirmed yet.
[
  {
    "id": "019f220e-5284-7434-833d-0e068d2da8d4",
    "transactionCode": "DPH-019f220e45f47c2ca30c321751094f37",
    "amount": 100.234,
    "currency": "434",
    "customerAccountName": "Mock Customer",
    "customerInstitutionName": "Bank of Commerce and Development",
    "pointOfSaleName": "آلة الخدمة",
    "source": "Onepay",
    "status": 1,
    "createdAt": "2026-07-02T10:59:51.810919",
    "confirmedAt": "2026-07-02T10:59:52.420934"
  }
]
Use paging in production. Do not request huge date ranges from the UI. confirmedAt can be null — show "Pending" or "Not confirmed yet", not a rendering error.

Transaction status values

ValueNameMeaning
0PendingPayment started but not completed yet.
1CompletedPayment completed successfully.
2FailedPayment failed.
3RefundedPayment was refunded.
5CancelledPayment was cancelled.

Error handling

Errors are returned as JSON problem details. Exact messages may be localized, so rely on HTTP status and field names first, then display the message returned by the API.

StatusWhen it usually happensDeveloper action
400Business rule issue, duplicate request id, invalid state, or invalid OTP.Show the returned message. Do not silently retry confirmation.
401 / 403Missing or invalid X-Api-Key.Check vendor API key configuration.
404Transaction or endpoint not available/found.Check path, transaction id, and feature availability.
422Validation failed for request fields.Highlight invalid fields in the UI.
429Too many requests.Retry later and reduce repeated calls.
500Unexpected backend/upstream issue.Show a friendly error and keep request/transaction ids for support.

Example error body

{
  "type": "",
  "title": "Amount must be greater than 0",
  "detail": "Amount must be greater than 0",
  "status": 422,
  "instance": "/smartpay/api/online/vendor/onepay/init-transfer",
  "traceId": "<trace-id>",
  "errors": { "Amount": "Amount must be greater than 0" }
}

⚡ Payment flow simulator

Walk the full OnePay Online payment lifecycle with mock responses — no API key needed. Everything runs in your browser; no real calls are made.

Institutions
Initiate
Confirm (OTP)
Status
Done
API LOG
// Simulator ready. Click "Load institutions" to begin.

🛠 Request builder

Fill in your values and copy a ready-to-run request. The snippet updates live as you type.

Configure


    

Confidential — Sarab Tech LLC · OnePay Online via SmartPay · SmartBank by Meditbank · Last updated 2026-07-05