Accept payments
Payment Links
Create shareable payment links to accept payments without building a checkout flow. Share via email, SMS, or embed on your site.
Overview
A Payment Link is a reusable, fixed-amount URL that opens a hosted payment page. Each link has an id (prefix ph_plk_) and a slug stored in its url field (defaults to the id). Customers visit https://paymenthooks.com/pay/{url}; each visit creates a Checkout Session for the link price, and the customer pays there.
Share anywhere
Email, SMS, social, QR codes
Reusable
One link accepts any number of payments
On/off control
Set status to inactive to stop accepting payments
Create a payment link
curl -X POST https://paymenthooks.com/api/v1/payment-links \
-H "Authorization: Bearer phk_live_..." \
-H "Content-Type: application/json" \
-d '{"name": "Pro Plan Monthly", "itemLocalCurrencyAmount": 2990, "itemLocalCurrency": "USD"}'Parameters
Create (POST /v1/payment-links)
| Parameter | Type | Required | Description |
|---|---|---|---|
| name | string | Yes | Display name shown to the customer and used as the line item description |
| itemLocalCurrencyAmount | integer | Yes* | Fixed price in the smallest unit of itemLocalCurrency (e.g. cents, paise). Must be greater than 0. Optional with priceId: the price's own amount. |
| itemLocalCurrency | string | Yes* | Three-letter ISO 4217 code the link is priced in. Uppercased. Optional with priceId: the price's currency. With priceId it may also be one of the price's currency options: the link then takes that option's exact amount (a currency the price has no amount in is 400 CURRENCY_MISMATCH). The link's checkout charges the price's exact amount in any of its currencies the customer pays in, else converts as before. There is no default currency; see /docs/money-and-currencies. |
| url | string | No | Custom slug for the hosted page (/pay/{url}). Must be unique. Defaults to the link id. |
| status | string | No | active (default) or inactive |
| productId | string | No | Product to associate with the link (stored for your reference) |
| priceId | string | No | One of your prices the link sells: its currency and amount are used unless you send them (they must then match its currency) |
| description | string | No | Accepted for compatibility (max 500 chars) but not stored; the response returns description as null |
| metadata | object | No | Key-value pairs stored on the link |
| shippingOptions | array | No | Up to 5 shipping rates every checkout the link opens offers, in the link's currency: { id?, displayName, itemLocalCurrencyAmount, taxCode? (tc_shipping or tc_nontaxable), taxBehavior? (exclusive or inclusive) }, as on checkout sessions. The first is preselected; the customer can choose another. Invalid rates return 400 VALIDATION_ERROR with error.fields.shippingOptions. |
Update (PUT /v1/payment-links/:id)
| Parameter | Type | Required | Description |
|---|---|---|---|
| name | string | No | New display name |
| itemLocalCurrencyAmount | integer | No | New fixed price in the link's own itemLocalCurrency, smallest unit. The currency and rate do not change; itemAmountUsdCents is recomputed. |
| status | string | No | active, or inactive to stop accepting payments |
| metadata | object | No | Replaces the stored metadata |
Only these four fields can be changed. itemLocalCurrency, url, productId, priceId, and server-managed fields such as id, merchantId, and paymentCount are rejected with 400 VALIDATION_ERROR (error.message names the unrecognized field), as is a body with no fields. To change the currency or slug, create a new link.
Endpoints & Responses
Request and response examples for each payment links endpoint, using the { data, error } envelope. Some examples are abridged.
/v1/payment-linksCreate a payment link. Returns 201 and sends a payment_link.created webhook to your registered endpoints. slug mirrors url. Fields not listed under Create parameters (for example merchantId) return 400 VALIDATION_ERROR.{
"name": "Pro Plan Monthly",
"itemLocalCurrencyAmount": 2990,
"itemLocalCurrency": "USD",
"url": "pro-plan-monthly"
}{
"data": {
"id": "ph_plk_7f3a9b2c1d4e5f60718293a4b5c6d7e8",
"merchantId": "ph_mrc_c9f0f895fb98ab9159f51fd0297e236d",
"name": "Pro Plan Monthly",
"url": "pro-plan-monthly",
"slug": "pro-plan-monthly",
"itemLocalCurrency": "USD",
"itemLocalCurrencyAmount": 2990,
"itemAmountUsdCents": 2990,
"itemUsdToLocalCurrencyRate": 1,
"productId": null,
"priceId": null,
"status": "active",
"metadata": {},
"paymentCount": 0,
"createdAt": "2026-05-16T10:30:00.000Z",
"updatedAt": "2026-05-16T10:30:00.000Z"
},
"error": null
}/v1/payment-links?page=1&pageSize=10&status=activeList your payment links, newest first. Filters: status, search (matches name or url), businessEntityId (one of your businesses; a business-scoped key sees only its own). pageSize max 100.{
"data": [
{
"id": "ph_plk_7f3a9b2c1d4e5f60718293a4b5c6d7e8",
"name": "Pro Plan Monthly",
"url": "pro-plan-monthly",
"slug": "pro-plan-monthly",
"itemLocalCurrency": "USD",
"itemLocalCurrencyAmount": 2990,
"itemAmountUsdCents": 2990,
"itemUsdToLocalCurrencyRate": 1,
"status": "active",
"paymentCount": 12,
"createdAt": "2026-05-16T10:30:00.000Z"
}
],
"meta": { "total": 1, "page": 1, "pageSize": 10 },
"error": null
}/v1/payment-links/:idRetrieve a payment link by id. Returns the stored record (use url as the slug).{
"data": {
"id": "ph_plk_7f3a9b2c1d4e5f60718293a4b5c6d7e8",
"merchantId": "ph_mrc_c9f0f895fb98ab9159f51fd0297e236d",
"name": "Pro Plan Monthly",
"url": "pro-plan-monthly",
"itemLocalCurrency": "USD",
"itemLocalCurrencyAmount": 2990,
"itemAmountUsdCents": 2990,
"itemUsdToLocalCurrencyRate": 1,
"status": "active",
"metadata": {},
"paymentCount": 12,
"createdAt": "2026-05-16T10:30:00.000Z",
"updatedAt": "2026-05-16T10:30:00.000Z"
},
"error": null
}/v1/payment-links/:idUpdate a payment link. Send only the fields listed under Update parameters: any other field (for example itemLocalCurrency, url, or paymentCount) or an empty body returns 400 VALIDATION_ERROR and nothing is changed. An unknown link returns 404 NOT_FOUND; any other failure returns 500 INTERNAL_ERROR. Returns the stored record.{
"name": "Pro Plan Monthly (2026)",
"itemLocalCurrencyAmount": 3490,
"status": "inactive"
}{
"data": {
"id": "ph_plk_7f3a9b2c1d4e5f60718293a4b5c6d7e8",
"name": "Pro Plan Monthly (2026)",
"url": "pro-plan-monthly",
"itemLocalCurrency": "USD",
"itemLocalCurrencyAmount": 3490,
"itemAmountUsdCents": 3490,
"itemUsdToLocalCurrencyRate": 1,
"status": "inactive",
"paymentCount": 12,
"updatedAt": "2026-05-16T11:00:00.000Z"
},
"error": null
}/v1/payment-links/resolve?slug=pro-plan-monthlyPublic, no auth. Looks the link up by slug (url) or id. Returns 404 NOT_FOUND if unknown and 410 LINK_INACTIVE if status is not active.{
"data": {
"id": "ph_plk_7f3a9b2c1d4e5f60718293a4b5c6d7e8",
"merchantId": "ph_mrc_c9f0f895fb98ab9159f51fd0297e236d",
"name": "Pro Plan Monthly",
"url": "pro-plan-monthly",
"slug": "pro-plan-monthly",
"itemLocalCurrency": "USD",
"itemLocalCurrencyAmount": 2990,
"itemAmountUsdCents": 2990,
"itemUsdToLocalCurrencyRate": 1,
"status": "active",
"createdAt": "2026-05-16T10:30:00.000Z"
},
"error": null
}/v1/payment-links/checkoutPublic, no auth. Used by the hosted /pay page: creates a Checkout Session for the link (paymentLinkId may be the id or the slug) and returns its relative URL. The session is priced in the link's itemLocalCurrency, amount and rate, attributed to the link's business, and taxed by the link's price. Optional customerCountry / customerPostalCode only pre-tax it; the customer confirms the billing address on the checkout. Returns 201; 400 VALIDATION_ERROR (paymentLinkId missing, or the link has no amount), 404 NOT_FOUND, 410 LINK_INACTIVE, 422 TAX_STATE_REQUIRED when US sales tax needs the customer's state or ZIP code.{
"paymentLinkId": "pro-plan-monthly"
}{
"data": {
"sessionId": "ph_cks_9f2c4e1a7b3d5f6081a2b3c4d5e6f708",
"url": "/checkout/ph_cks_9f2c4e1a7b3d5f6081a2b3c4d5e6f708"
},
"error": null
}/v1/payment-links/:id/payPublic, no auth. Charges the link price (itemLocalCurrencyAmount in itemLocalCurrency) directly without a Checkout Session. The response transactionLocalCurrencyAmount and transactionLocalCurrency are what was charged. :id may be the link id or its slug (url). See Direct pay endpoint for the card and UPI variants.{
"email": "[email protected]",
"cardNumber": "4242424242424242",
"cardExpiry": "12/28",
"cardCvc": "123",
"cardholderName": "Jane Doe",
"gatewayConnectionId": "ph_gwc_71aa3e5c7b9d1f2a4c6e8b0d2f4a6c8e"
}{
"data": {
"paymentId": "ph_pay_0c1d2e3f4a5b6c7d8e9f0a1b2c3d4e5f",
"status": "success",
"transactionLocalCurrencyAmount": 2990,
"transactionLocalCurrency": "USD",
"cardLast4": "4242",
"cardBrand": "visa",
"cardholderName": "Jane Doe",
"redirectUrl": "/checkout/success?payment_id=ph_pay_0c1d2e3f4a5b6c7d8e9f0a1b2c3d4e5f&payment_link_id=ph_plk_7f3a9b2c1d4e5f60718293a4b5c6d7e8"
},
"error": null
}Direct pay endpoint
POST /v1/payment-links/:id/pay charges the link price in its itemLocalCurrency without a Checkout Session. :id may be the link id or its slug. gatewayConnectionId is optional and selects one of your connected gateways; otherwise your routing rules choose. It returns 404 NOT_FOUND for an unknown link, 410 LINK_INACTIVE for an inactive link, and 400 VALIDATION_ERROR for missing fields.
- Card (default):
email,cardExpiry,cardCvc, andcardNumberare required. IfredirectUrlpoints to the gateway, send the customer there to finish. - UPI: send
paymentMethod: "upi"and the customer'svpa(required);emailis optional. The payment usually starts aspending; redirect the customer toredirectUrl. - The result
statusis the gateway outcome:success,pending,failed, orcancelled. Confirm withGET /v1/payments/:id.
{
"paymentMethod": "upi",
"vpa": "buyer@okbank",
"email": "[email protected]",
"gatewayConnectionId": "ph_gwc_71aa3e5c7b9d1f2a4c6e8b0d2f4a6c8e"
}{
"data": {
"paymentId": "ph_pay_0c1d2e3f4a5b6c7d8e9f0a1b2c3d4e5f",
"gatewayTransactionId": "pay_Nq2x...",
"status": "pending",
"transactionLocalCurrencyAmount": 150000,
"transactionLocalCurrency": "INR",
"paymentMethod": "upi",
"redirectUrl": "https://gateway.example.com/upi/collect/..."
},
"error": null
}Link statuses
activeLive and accepting paymentsinactiveDeactivated; resolve and pay return 410 LINK_INACTIVEEmbed on your website
The browser SDK renders the hosted /pay/{slug}page in an iframe inside your container. Pass the link's url value as slug. The frame renders only on origins you allow under Developers > Embedded Checkout; on any other site the browser blocks it.
<script src="https://paymenthooks.com/sdk/paymenthooks.js"></script>
<div id="pay-widget"></div>
<script>
PaymentHooks.init({ publishableKey: "phk_pub_..." });
PaymentHooks.paymentLink({ slug: "pro-plan-monthly", container: "#pay-widget" });
</script>