Payment links
Reusable hosted checkouts with a fixed price that you can share anywhere.
Payment link
No code- Code needed
- None
- Time
- Minutes
- Customization
- The link's name, price and currency, plus your checkout settings
- Best for
- One price for many customers, such as a product, a donation or a fixed invoice
A link is a reusable hosted checkout with a fixed price. Create one in the dashboard or with POST /links, then share its url anywhere: your site, an invoice, a chat or a QR code.
Create a link
curl -X POST "https://api.402pay.co/api/v1/links" \
-H "Authorization: Bearer $PAY402_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Team plan, monthly",
"amount": "199.00",
"currency": "USD"
}'const response = await fetch("https://api.402pay.co/api/v1/links", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.PAY402_SECRET_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
name: "Team plan, monthly",
amount: "199.00",
currency: "USD"
}),
});
const { data } = await response.json();import os
import requests
response = requests.post(
"https://api.402pay.co/api/v1/links",
headers={
"Authorization": f"Bearer {os.environ['PAY402_SECRET_KEY']}",
},
json={
"name": "Team plan, monthly",
"amount": "199.00",
"currency": "USD"
},
)
data = response.json()["data"]How links work
- Payment link (one url, reused) → Payment (with the link_id)
- Payment (with the link_id) → succeeded (paid in full)
- Payment (with the link_id) → failed (canceled, final)
- Payment (with the link_id) → expired (the quote ran out)
- expired (the quote ran out) → Payment link (one url, reused): the next visit starts a new payment
- Price it in USD, EUR, GBP, CAD and AUD. Customers pay the equivalent in the coin they choose.
- Every payment made through a link carries its
link_id, soGET /payments?link_id=…lists them. - Archive a link to stop taking payments without losing its history. A checkout a customer already opened keeps working, so they can still finish paying or send the rest.
- A link's payment lasts as long as its quote. If the quote expires before anything arrives, the payment is
expired, and the customer's next visit starts a new one. - If the customer cancels at checkout, the link's payment is
failedand you receivepayment.failed. Unlike a payment you create through the API, it can't be paid again. - A link's payments can have their remainder requested when a customer sends too little.
In the dashboard: Create a payment link.
Links or payments
| Use | When |
|---|---|
| A payment link | One price for many customers, shared without code, such as a product or a donation. |
| An API payment | One order for one customer, with your own reference and metadata, created by your server. |