Hosted Payment Link (one-time)
This flow minimizes payment UI work on your site: your backend creates a payment link via API, you send the customer to Swirepay’s hosted checkout (entity.link), and after payment Swirepay redirects them back to your redirectUri. You then verify status server-side before showing success or failure.
It aligns with the Payment Links pattern described in Swirepay’s integration materials (hosted checkout vs capturing PAN on your domain — see internal reference Swirepay PG Merchant Integration Kit): notifications (SMS/email), optional expiry, verification APIs, and optional server callbacks.
For token → payment method → payment session on your pages instead, see Direct integration.
At a glance
POST /v1/payment-linkwith amount (cents), currency, description, payer hints (customerobject orcustomerGid),redirectUri, and optionalserverCallbackUrl.- Read
entity.linkfrom the response and redirect the payer’s browser there (hosted payment page for card or ACH as configured). - After checkout, Swirepay redirects to
redirectUri(typically with payment-link context you can read server-side). - Call
GET /v1/payment-link/{gid}/verifyfrom your backend (with the payment link GID) to confirmstatusand inspectpaymentSessionwhen paid.
Full API schemas and try-it-out: Create payment link, Get payment link, Verify payment link.
Partner integrations
When acting on behalf of a submerchant, send the optional x-destination-account header with that merchant’s sp-account-id on:
POST /v1/payment-link(create)GET /v1/payment-link/{gid}(retrieve)GET /v1/payment-link/{gid}/verify(verify)
Omit the header when the operation applies to your own Swirepay account. Same semantics as Partner integration for REST APIs.
Create a payment link
POST /v1/payment-link
Headers
x-api-key: secret key (recommended for server-side creation).x-destination-account: optional — affiliate account GID for partner/submerchant context (see above).
Body (common fields)
| Field | Purpose |
|---|---|
amount | Amount in cents |
currencyCode | For example USD |
description | Shown on hosted checkout and receipts |
paymentMethodType | For example ["CARD"], ["ACH"], or both |
redirectUri | HTTPS URL to send the payer after payment (GET redirect) |
customer | New customer { name, email, phoneNumber } or use customerGid for an existing customer |
notificationType | How Swirepay notifies the payer (see API schema) |
serverCallbackUrl | Optional HTTPS URL for Swirepay to POST a server-to-server completion payload |
expiresAt | Optional expiration for the link |
Example shape (new customer):
{
"amount": 5000,
"currencyCode": "USD",
"paymentMethodType": ["CARD", "ACH"],
"redirectUri": "https://merchant.example.com/pay/return",
"description": "Invoice #1234",
"customer": {
"email": "payer@example.com",
"name": "Jane Doe",
"phoneNumber": "+14155550100"
},
"serverCallbackUrl": "https://merchant.example.com/webhooks/payment-link"
}
Response: entity.link is the hosted URL to open for the payer (environment-specific host). Store entity.gid as the payment link identifier for verification calls.
Redirect the payer
Send the customer to entity.link (302/redirect from your app or render as “Pay now”). They complete authentication and payment on Swirepay-hosted UI — you do not collect PAN in your checkout.
After redirect — verify before UX confirmation
Browser redirects alone are not sufficient for reconciliation — always verify server-side.
GET /v1/payment-link/{gid}/verify
- Same
gidfrom create response (payment link GID). - Pass
x-destination-accountwhen verifying on behalf of a submerchant.
Interpret entity.status (for example ACTIVE vs PAID) and whether entity.paymentSession is populated with finalized payment session details when the charge succeeded.
See Verify payment link for response nuances (pending vs complete examples).
Optional: server callback (serverCallbackUrl)
If you configure serverCallbackUrl on create, Swirepay can POST JSON to your endpoint after successful processing (similar to webhook-style notifications described in broader integration kits). Treat callbacks as supplementary to verify — always reconcile using verify or official webhooks as appropriate for your deployment.
For webhook semantics (headers, signing) for other event types, see Webhook delivery & payloads and Webhooks.
Operational comparisons (hosted vs checkout)
Hosted Payment Link vs Payment Checkout product differences (notifications, expiry behavior, verification APIs) are summarized in merchant integration references and product docs — choose based on whether you need multi-channel payer notifications and mandatory expiry policies.