Payment links
Create reusable or limited-use Moov payment links and QR codes, and track each payment on a link through transactions.
A payment link is a Moov-hosted payment page that more than one buyer can pay, for example a donation page or a fixed-price product shared on social media. Use checkouts for website orders. A checkout belongs to one order and can be paid once.
| Method | Path | Ability | Purpose |
|---|---|---|---|
POST |
/merchant/payment-links |
checkouts:write |
Create a payment link |
GET |
/merchant/payment-links |
checkouts:read |
List links and checkouts |
GET |
/merchant/payment-links/{id} |
checkouts:read |
Read one link |
GET |
/merchant/payment-links/{id}/qr-code |
checkouts:read |
Get a QR code for the link |
DELETE |
/merchant/payment-links/{id} |
checkouts:read and checkouts:write |
Disable the link at Moov |
Create a payment link
The request body is the same as for a checkout, plus max_uses:
| Field | Rules |
|---|---|
max_uses |
Optional integer, 0 to 10000. 0 means unlimited. Defaults to 0. |
Other differences from checkouts:
- There is no default expiry. Send
expires_atif the link should stop working. - The response
objectispayment_link. - The response has the
Idempotent-Replayedheader but does not echoIdempotency-Key. - Payment links and checkouts share one idempotency key space per merchant.
curl -sS -X POST "$NORTHECHPAY_API_BASE/merchant/payment-links" \
-H "Authorization: Bearer $NORTHECHPAY_API_KEY" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: link-gift-card-25" \
-d '{"amount":2500,"title":"Gift card $25","max_uses":0}'
const response = await fetch(
`${process.env.NORTHECHPAY_API_BASE}/merchant/payment-links`,
{
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.NORTHECHPAY_API_KEY}`,
Accept: 'application/json',
'Content-Type': 'application/json',
'Idempotency-Key': 'link-gift-card-25',
},
body: JSON.stringify({
amount: 2500,
title: 'Gift card $25',
max_uses: 0,
}),
},
);
const { data: link } = await response.json();
$link = Http::baseUrl(config('services.northechpay.api_base'))
->withToken(config('services.northechpay.api_key'))
->acceptJson()
->withHeaders(['Idempotency-Key' => 'link-gift-card-25'])
->post('/merchant/payment-links', ['amount' => 2500, 'title' => 'Gift card $25', 'max_uses' => 0])
->throw()
->json('data');
A new link returns 201. A replay returns 200 with Idempotent-Replayed: true.
List links
GET /merchant/payment-links returns both payment links and checkouts unless you filter by kind.
| Query parameter | Meaning |
|---|---|
kind |
payment_link or checkout. |
status |
Exact status. |
search |
Partial match on title or merchant_reference, or exact id or payment link code. |
per_page |
1 to 100. Default 20. |
page |
Page number. |
QR code
GET /merchant/payment-links/{id}/qr-code returns a PNG from Moov, base64-encoded:
{
"data": {
"format": "image/png;base64",
"qr_code": "iVBORw0KGgoAAAANSUhEUgAA…",
"checkout_url": "https://moov.link/p/hSYJZTsTH9"
}
}
Show it with <img src="data:image/png;base64,{qr_code}">. It returns 404 if the link has no Moov code yet. It works for checkouts too.
Track payments on a reusable link
A payment link's status describes the link, not each payment: the first completed payment moves the link to paid, and later payments do not change it. Webhooks describe each payment:
checkout.paidis sent once per payment, with that payment indata.payment(its ownid,amountandstatus).- A declined attempt sends
checkout.failedfor that attempt only. Earlier payments stay paid. - Refunds and disputes on any of the link's payments send their own
checkout.refundedandcheckout.disputed.
To see every payment, list transactions by the link's payment link code:
curl -sS "$NORTHECHPAY_API_BASE/merchant/transactions?search=hSYJZTsTH9&direction=incoming" \
-H "Authorization: Bearer $NORTHECHPAY_API_KEY" \
-H "Accept: application/json"
Each transaction has payment_link_code, checkout_id and its own status. A payment counts when its transaction status is completed. This needs transactions:read.
Refresh and disable
- There is no refresh endpoint under
/payment-links.POST /merchant/checkouts/{id}/refreshaccepts a payment link ID too. DELETE /merchant/payment-links/{id}disables the link at Moov. Payments already in flight are not cancelled.
When not to use payment links
Do not use a reusable link for website orders. Nothing ties a payment to one order: every payment on the link reports the same checkout. Create one checkout per order instead.