Search Documentation
Search across all documentation pages, APIs and guides.
Payment Link API
Generate a unique, shareable payment URL programmatically. Ideal for invoicing software, accounting platforms, ERP systems, and any operational workflow where a specific, trackable payment link needs to be created and sent to a customer without redirecting them through a checkout session.
Best for: Zoho Books, QuickBooks, SAP, ERP payment collection, field sales, and any B2B workflow where the link is sent via email or SMS and paid independently.
Invoice-to-payment automation
Generate a link per invoice. When the customer pays, poll is_complete to auto-mark invoices as settled in your system.
ERP-triggered collections
ERP raises an order → calls this API → attaches the link_url to the order record. Finance team tracks status directly in the ERP.
Large-value partial collections
For amounts over LKR 100,000 or USD 100, enable allow_partial_payment to let customers pay in instalments. Minimum must be 30–100% of total.
Time-limited payment requests
Set expiration_date to enforce payment deadlines. Expired links reject transactions, preventing late or duplicate payments.
Authentication
Payment Link API authenticates via a Company API Key passed in the Authorization header, different from the hash-based signing used by the Payment API. Your App ID is passed as a URL query parameter, not in the request body.
| HEADER | VALUE | REQUIRED |
|---|---|---|
Authorization | Your company API key | Yes |
Content-Type | application/json | Yes |
1. Create payment link
Create a new payment link with full customer and amount specifications. This link is immediately active upon creation until its expiration date.
| PARAMETER | TYPE | DESCRIPTION |
|---|---|---|
app_idrequired | string | Your OnePay App ID. |
2. Get payment link
Retrieve full details of a specific payment link using its 8-character link ID. Poll is_complete to detect when a customer has paid and trigger downstream ERP or accounting actions.
| PARAMETER | TYPE | IN | DESCRIPTION |
|---|---|---|---|
link_idrequired | string | Path | The 8-character payment link ID (e.g. 8IT20WK7). |
app_idrequired | string | Query | Your OnePay App ID. |
Returns the same full object as the Create response. Key fields to watch:
| FIELD | TYPE | DESCRIPTION |
|---|---|---|
data.is_complete | boolean | true once the customer has fully paid. Use this to trigger order fulfillment in your system. |
data.is_delete | boolean | true if the link has been soft-deleted. |
data.link_url | string | The shareable payment URL. |
data.amount | string | Original payment amount. |
data.expiration_date | string | Link expiry date in YYYY-MM-DD format. |
data.created_at | string | ISO 8601 creation timestamp. |
data.updated_at | string | ISO 8601 last-updated timestamp. |
3. Update payment link
Update the description of an existing payment link. Only the description field can be modified after creation. Amount, currency, reference number, customer details, and expiry date are all immutable to protect payment integrity.
| PARAMETER | TYPE | IN | DESCRIPTION |
|---|---|---|---|
link_idrequired | string | Path | The 8-character payment link ID. |
| PARAMETER | TYPE | DESCRIPTION |
|---|---|---|
app_idrequired | string | Your OnePay App ID. |
descriptionrequired | string | The new description for the payment link. |
| FIELD | TYPE | DESCRIPTION |
|---|---|---|
status | number | 200 on success. |
message | string | Confirmation message. |
data | object | Updated link object with all current fields reflecting the new description. |
4. Delete payment link
Soft-deletes a payment link by setting is_delete = true. The link record is preserved for audit purposes but becomes inactive immediately.
A link can only be deleted if it has no successful transactions associated with it. Attempting to delete a link with completed payments returns a 400 error.
| PARAMETER | TYPE | IN | DESCRIPTION |
|---|---|---|---|
link_idrequired | string | Path | The 8-character payment link ID. |
app_idrequired | string | Query | Your OnePay App ID. |
| FIELD | TYPE | DESCRIPTION |
|---|---|---|
status | number | 200 on successful deletion. |
message | string | Confirmation message. |
| FIELD | TYPE | DESCRIPTION |
|---|---|---|
status | number | 400 — deletion blocked. |
message | string | "Cannot delete a link with successful transactions" |
On This Page