Payment links are shareable URLs that allow your customers to pay with any token on any supported chain. Each link can be customized with branding, forms, shipping options, and more.

Info

Payment links automatically handle token routing, gas abstraction, and cross-chain swaps via the AnySpend protocol.

idstring

Unique identifier for the payment link (e.g., pl_abc123).

namestring

Display name shown to the customer during checkout.

urlstring

The shareable checkout URL (e.g., https://anyspend.com/pay/pl_abc123).

short_urlstring

Shortened URL for sharing (e.g., https://as.pay/abc123).

The token contract address you want to receive payment in.

chain_idnumber

The chain ID where you want to receive payment.

The wallet address that receives the payment.

amountstring | null

Fixed payment amount in the token's smallest unit. Null for variable-amount links.

min_amountstring | null

Minimum allowed amount for variable-amount links.

max_amountstring | null

Maximum allowed amount for variable-amount links.

suggested_amountstring | null

Pre-filled suggested amount for variable-amount links.

descriptionstring | null

Description shown on the checkout page.

product_idstring | null

Associated product ID, if linked to a product.

image_urlstring | null

Image displayed on the checkout page.

theme_colorstring | null

Hex color code for checkout page branding (e.g., #6366f1).

button_textstring | null

Custom text for the pay button (default: "Pay").

max_usesnumber | null

Maximum number of completed payments allowed. Null for unlimited.

usesnumber

Number of completed payments so far.

expires_atstring | null

ISO 8601 expiration timestamp. Null for no expiration.

activeboolean

Whether the link is currently accepting payments.

form_schemaobject | null

Custom form fields to collect from the customer during checkout.

shipping_optionsarray | null

Available shipping options for physical goods.

Whether to collect a shipping address during checkout.

return_urlstring | null

URL to redirect the customer to after payment.

return_labelstring | null

Label for the return button (e.g., "Back to Store").

brandingobject | null

Custom branding configuration.

fee_on_topboolean

Whether the platform fee is added on top of the payment amount (true) or absorbed by the merchant (false).

itemsarray

Line items attached to this payment link.

created_atstring

ISO 8601 creation timestamp.

updated_atstring

ISO 8601 last update timestamp.


URL parameters

When sharing a payment link URL, you can append query parameters to pre-fill session data, track attribution, and associate payments with your customers.

ParameterDescriptionExample
client_reference_idYour internal reference ID (order ID, user ID, etc.)?client_reference_id=order_123
metadata[key]Arbitrary key-value metadata (bracket notation, up to 50 keys)?metadata[user_id]=clerk_abc&metadata[plan]=pro
session_idUse a pre-created checkout session instead of creating a new one?session_id=cs_abc123
success_urlOverride the redirect URL after successful payment?success_url=https://example.com/thanks
cancel_urlOverride the cancel/back URL?cancel_url=https://example.com/cart
utm_sourceUTM source for attribution?utm_source=twitter
utm_mediumUTM medium for attribution?utm_medium=social
utm_campaignUTM campaign for attribution?utm_campaign=launch

Metadata limits

  • Maximum 50 keys per session
  • Key length: up to 40 characters
  • Value length: up to 500 characters

Example: associating payments with your customers

text
https://anyspend.com/pay/abc123?client_reference_id=order_456&metadata[user_id]=clerk_abc&metadata[plan]=pro

All parameters are passed through to webhooks, so you can reconcile payments on your backend.

Tip

For enterprise integrations that need full control, use the Checkout Sessions API to create sessions server-side with customer_email, customer_name, metadata, and client_reference_id, then redirect using the returned url or append ?session_id= to your payment link.


searchstringquery

Search payment links by name or description.

activebooleanquery

Filter by active status. Omit to return all links.

sortstringquerydefault: created_at

Sort field. One of: created_at, updated_at, name, uses.

orderstringquerydefault: desc

Sort order. One of: asc, desc.

pagenumberquerydefault: 1

Page number for pagination.

limitnumberquerydefault: 20

Number of results per page (max 100).

curl -X GET "https://platform-api.anyspend.com/api/v1/payment-links?active=true&sort=created_at&order=desc&page=1&limit=20" \
  -H "Authorization: Bearer asp_xxx"
json
{ "data": [ { "id": "pl_abc123", "name": "Premium Plan", "url": "https://anyspend.com/pay/pl_abc123", "short_url": "https://as.pay/abc123", "token_address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", "chain_id": 1, "recipient_address": "0x1234...abcd", "amount": "50000000", "description": "Premium monthly subscription", "active": true, "uses": 42, "max_uses": null, "expires_at": null, "created_at": "2026-01-15T10:30:00Z", "updated_at": "2026-02-20T14:22:00Z" } ], "pagination": { "page": 1, "limit": 20, "total": 1, "total_pages": 1, "has_more": false }}

Create a new payment link with customizable checkout experience.

namestringrequiredbody

Display name for the payment link.

token_addressstringrequiredbody

Contract address of the token you want to receive.

chain_idnumberrequiredbody

Chain ID where you want to receive the token.

recipient_addressstringrequiredbody

Wallet address that receives the payment.

descriptionstringbody

Description displayed on the checkout page.

amountstringbody

Fixed payment amount in the token's smallest unit. Omit for variable-amount links.

min_amountstringbody

Minimum amount for variable-amount links.

max_amountstringbody

Maximum amount for variable-amount links.

suggested_amountstringbody

Pre-filled amount for variable-amount links.

product_idstringbody

Link to an existing product.

image_urlstringbody

URL of the image to display on the checkout page.

theme_colorstringbody

Hex color code for checkout branding (e.g., "#6366f1").

button_textstringbody

Custom pay button text.

max_usesnumberbody

Maximum number of completed payments. Omit for unlimited.

expires_atstringbody

ISO 8601 expiration timestamp.

form_schemaobjectbody

Custom form fields to collect during checkout. See the Payment Link object above for structure.

shipping_optionsarraybody

Shipping options for physical goods. See the Payment Link object above for structure.

collect_shipping_addressbooleanbodydefault: false

Whether to collect a shipping address.

return_urlstringbody

URL to redirect the customer after payment.

return_labelstringbody

Label for the return button.

brandingobjectbody

Custom branding configuration. See the Payment Link object above for structure.

fee_on_topbooleanbodydefault: false

Add platform fee on top of the payment amount.

itemsarraybody

Line items to display on checkout.

curl -X POST "https://platform-api.anyspend.com/api/v1/payment-links" \
  -H "Authorization: Bearer asp_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Premium Plan",
    "token_address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
    "chain_id": 1,
    "recipient_address": "0x1234567890abcdef1234567890abcdef12345678",
    "amount": "50000000",
    "description": "Premium monthly subscription",
    "image_url": "https://example.com/premium.png",
    "theme_color": "#6366f1",
    "button_text": "Subscribe Now",
    "return_url": "https://example.com/thank-you",
    "return_label": "Back to Dashboard",
    "form_schema": {
      "fields": [
        {
          "id": "company_name",
          "type": "text",
          "label": "Company Name",
          "required": true,
          "placeholder": "Acme Inc."
        },
        {
          "id": "team_size",
          "type": "select",
          "label": "Team Size",
          "required": true,
          "options": ["1-10", "11-50", "51-200", "200+"]
        }
      ]
    },
    "items": [
      {
        "name": "Premium Plan - Monthly",
        "amount": "50000000",
        "quantity": 1
      }
    ]
  }'
json
{ "id": "pl_abc123", "name": "Premium Plan", "url": "https://anyspend.com/pay/pl_abc123", "short_url": "https://as.pay/abc123", "token_address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", "chain_id": 1, "recipient_address": "0x1234567890abcdef1234567890abcdef12345678", "amount": "50000000", "min_amount": null, "max_amount": null, "suggested_amount": null, "description": "Premium monthly subscription", "product_id": null, "image_url": "https://example.com/premium.png", "theme_color": "#6366f1", "button_text": "Subscribe Now", "max_uses": null, "uses": 0, "expires_at": null, "active": true, "form_schema": { "fields": [ { "id": "company_name", "type": "text", "label": "Company Name", "required": true, "placeholder": "Acme Inc." }, { "id": "team_size", "type": "select", "label": "Team Size", "required": true, "options": ["1-10", "11-50", "51-200", "200+"] } ] }, "shipping_options": null, "collect_shipping_address": false, "return_url": "https://example.com/thank-you", "return_label": "Back to Dashboard", "branding": null, "fee_on_top": false, "items": [ { "id": "pli_item001", "name": "Premium Plan - Monthly", "amount": "50000000", "quantity": 1, "image_url": null } ], "created_at": "2026-02-27T10:30:00Z", "updated_at": "2026-02-27T10:30:00Z"}

Fetch a single payment link by ID, including its line items.

idstringrequiredpath

The payment link ID (e.g., pl_abc123).

curl -X GET "https://platform-api.anyspend.com/api/v1/payment-links/pl_abc123" \
  -H "Authorization: Bearer asp_xxx"

Returns the full Payment Link object including items.


Update an existing payment link. Only the fields you include in the request body will be updated.

idstringrequiredpath

The payment link ID.

All body parameters from the create endpoint are accepted. Additionally:

activebooleanbody

Set to false to deactivate the link.

Warning

Changing token_address, chain_id, or recipient_address on a link that has existing sessions may cause inconsistencies. Create a new link instead if you need to change payment routing.

curl -X PATCH "https://platform-api.anyspend.com/api/v1/payment-links/pl_abc123" \
  -H "Authorization: Bearer asp_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Premium Plan (Updated)",
    "amount": "75000000",
    "button_text": "Upgrade Now"
  }'

Returns the updated Payment Link object.


Permanently delete a payment link. This cannot be undone. Active checkout sessions for this link will fail.

idstringrequiredpath

The payment link ID.

curl -X DELETE "https://platform-api.anyspend.com/api/v1/payment-links/pl_abc123" \
  -H "Authorization: Bearer asp_xxx"
json
{ "id": "pl_abc123", "deleted": true}

Retrieve analytics and conversion metrics for a specific payment link.

idstringrequiredpath

The payment link ID.

curl -X GET "https://platform-api.anyspend.com/api/v1/payment-links/pl_abc123/stats" \
  -H "Authorization: Bearer asp_xxx"
json
{ "payment_link_id": "pl_abc123", "views": 1250, "sessions": 340, "completed": 42, "conversion_rate": 0.1235, "total_volume": "2100000000", "utm_breakdown": { "sources": { "twitter": { "views": 500, "sessions": 120, "completed": 18 }, "email": { "views": 400, "sessions": 150, "completed": 20 }, "direct": { "views": 350, "sessions": 70, "completed": 4 } }, "mediums": { "social": { "views": 500, "sessions": 120, "completed": 18 }, "newsletter": { "views": 400, "sessions": 150, "completed": 20 }, "none": { "views": 350, "sessions": 70, "completed": 4 } }, "campaigns": { "launch_feb_2026": { "views": 600, "sessions": 200, "completed": 30 }, "none": { "views": 650, "sessions": 140, "completed": 12 } } }}

Retrieve checkout sessions associated with a specific payment link.

idstringrequiredpath

The payment link ID.

statusstringquery

Filter by session status: open, processing, completed, expired, failed.

pagenumberquerydefault: 1

Page number.

limitnumberquerydefault: 20

Results per page (max 100).

curl -X GET "https://platform-api.anyspend.com/api/v1/payment-links/pl_abc123/sessions?status=completed&page=1&limit=10" \
  -H "Authorization: Bearer asp_xxx"
json
{ "data": [ { "id": "cs_sess001", "payment_link_id": "pl_abc123", "status": "completed", "amount": "50000000", "token_address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", "chain_id": 1, "payer_address": "0xaabb...ccdd", "tx_hash": "0x9f8e...1a2b", "form_data": { "company_name": "Acme Inc.", "team_size": "11-50" }, "created_at": "2026-02-25T08:15:00Z", "completed_at": "2026-02-25T08:16:30Z" } ], "pagination": { "page": 1, "limit": 10, "total": 42, "total_pages": 5, "has_more": true }}

Retrieve visitor analytics for a specific payment link, including referrer and geographic data.

idstringrequiredpath

The payment link ID.

pagenumberquerydefault: 1

Page number.

limitnumberquerydefault: 20

Results per page (max 100).

curl -X GET "https://platform-api.anyspend.com/api/v1/payment-links/pl_abc123/visitors?page=1&limit=20" \
  -H "Authorization: Bearer asp_xxx"
json
{ "data": [ { "id": "vis_001", "payment_link_id": "pl_abc123", "ip_country": "US", "referrer": "https://twitter.com", "user_agent": "Mozilla/5.0 ...", "utm_source": "twitter", "utm_medium": "social", "utm_campaign": "launch_feb_2026", "started_session": true, "visited_at": "2026-02-25T08:10:00Z" } ], "pagination": { "page": 1, "limit": 20, "total": 1250, "total_pages": 63, "has_more": true }}

Create a copy of an existing payment link with optional field overrides.

idstringrequiredpath

The payment link ID to duplicate.

namestringbody

Override the name of the duplicated link. Defaults to "Copy of {original name}".

Any other fields from the create endpoint can be passed as overrides.

curl -X POST "https://platform-api.anyspend.com/api/v1/payment-links/pl_abc123/duplicate" \
  -H "Authorization: Bearer asp_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Premium Plan - EU",
    "recipient_address": "0xabcdef1234567890abcdef1234567890abcdef12"
  }'

Returns a new Payment Link object with a new ID.


List line items

Retrieve all line items attached to a payment link.

idstringrequiredpath

The payment link ID.

curl -X GET "https://platform-api.anyspend.com/api/v1/payment-links/pl_abc123/items" \
  -H "Authorization: Bearer asp_xxx"
json
{ "data": [ { "id": "pli_item001", "payment_link_id": "pl_abc123", "name": "Premium Plan - Monthly", "amount": "50000000", "quantity": 1, "image_url": null, "created_at": "2026-02-27T10:30:00Z" } ]}

Add a line item

Add a new line item to an existing payment link.

idstringrequiredpath

The payment link ID.

namestringrequiredbody

Item name.

amountstringrequiredbody

Item price in the token's smallest unit.

quantitynumberrequiredbody

Quantity.

image_urlstringbody

Item image URL.

curl -X POST "https://platform-api.anyspend.com/api/v1/payment-links/pl_abc123/items" \
  -H "Authorization: Bearer asp_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Add-on: Priority Support",
    "amount": "10000000",
    "quantity": 1
  }'
json
{ "id": "pli_item002", "payment_link_id": "pl_abc123", "name": "Add-on: Priority Support", "amount": "10000000", "quantity": 1, "image_url": null, "created_at": "2026-02-27T11:00:00Z"}

Remove a line item

Remove a line item from a payment link.

idstringrequiredpath

The payment link ID.

itemIdstringrequiredpath

The line item ID.

curl -X DELETE "https://platform-api.anyspend.com/api/v1/payment-links/pl_abc123/items/pli_item002" \
  -H "Authorization: Bearer asp_xxx"
json
{ "id": "pli_item002", "deleted": true}
Ask a question... ⌘I