Bag Docs
API ReferencePayment links

Create a payment link

Creates a new payment link that customers can use to pay you. The link is immediately active and can be shared via URL. You must specify at least one network the link accepts payments on.

If you accept payments on multiple chains, pass the networks array and optionally merchantWalletAddresses to specify a different receiving wallet per chain.

POST
/api/payment-links
AuthorizationBearer <token>

API key authentication for programmatic access. Include your key in the Authorization header:

Authorization: Bearer bag_live_sk_a1b2c3d4e5f6...

Keys are prefixed with bag_live_sk_ (production) or bag_test_sk_ (sandbox). Generate keys from the Bag Dashboard.

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

curl -X POST "https://api.justusebag.xyz/api/payment-links" \  -H "Content-Type: application/json" \  -d '{    "name": "Pro Plan",    "description": "Monthly subscription to Pro features",    "amount": 29.99,    "currency": "USD",    "network": "base",    "networks": [      "base",      "polygon"    ],    "token": "USDC"  }'
{
  "status": "success",
  "data": {
    "_id": "d4e5f6a7-b8c9-4d0e-a1f2-b3c4d5e6f7a8",
    "name": "Pro Plan",
    "description": "Monthly subscription to Pro features",
    "amount": 29.99,
    "currency": "USD",
    "network": "base",
    "networks": [
      "base",
      "polygon"
    ],
    "token": "USDC",
    "active": true,
    "merchantWalletAddress": "0x1a2B3c4D5e6F7890abCdEf1234567890aBcDeF12",
    "merchantName": "Acme Corp",
    "totalCollected": 0,
    "totalTransactions": 0,
    "createdAt": "2026-03-01T10:00:00.000Z",
    "updatedAt": "2026-03-01T10:00:00.000Z"
  }
}
{
  "status": "error",
  "message": "amount: Amount must be a positive number up to 999,999,999.99; network: Invalid enum value",
  "code": "BAD_REQUEST"
}
{
  "status": "error",
  "message": "Invalid or revoked API key",
  "code": "UNAUTHORIZED",
  "hint": "Include a valid API key in the Authorization header: Bearer bag_live_sk_..."
}
{
  "status": "error",
  "message": "Too many requests. Please slow down.",
  "retryAfter": 10
}