Skip to main content
POST
/
v2
/
payment-links
Create Payment Link
curl --request POST \
  --url https://api.example.com/v2/payment-links

Create Payment Link

Generate a payment link that customers can use to complete checkout. Payment links automatically handle HSA/FSA eligibility detection and can be used for both one-time and recurring payments.
All monetary amounts are integers in cents (e.g., 4995 = $49.95).

Authentication

Authorization: Bearer glm_test_YOUR_API_KEY

Request Body

{
  "amount": 4995,
  "currency": "USD",
  "description": "Premium Blood Pressure Monitor",
  "customer": {
    "email": "customer@example.com",
    "first_name": "Jane",
    "last_name": "Doe"
  },
  "products": [
    {
      "merchant_product_id": "BP-MONITOR-001",
      "name": "Blood Pressure Monitor",
      "quantity": 1,
      "price": 4995
    }
  ],
  "payment_type": "one_time",
  "success_url": "https://yoursite.com/success",
  "cancel_url": "https://yoursite.com/cancel",
  "metadata": {
    "order_id": "ORD-12345"
  }
}

Parameters

ParameterTypeRequiredDescription
amountintegerYesTotal amount in cents
currencystringYesISO 4217 currency code (e.g., "USD")
descriptionstringYesDescription of the payment
customerobjectNoPre-fill customer information
customer.emailstringNoCustomer email
customer.first_namestringNoCustomer first name
customer.last_namestringNoCustomer last name
productsarrayNoProduct line items
products[].merchant_product_idstringYes*Your product reference ID
products[].namestringYes*Product name
products[].quantityintegerYes*Quantity
products[].priceintegerYes*Unit price in cents
payment_typeenumNoone_time or subscription (default: one_time)
subscriptionobjectNoRequired if payment_type is subscription
subscription.intervalenumYes*daily, weekly, monthly, yearly
subscription.interval_countintegerNoNumber of intervals (default: 1)
subscription.trial_period_daysintegerNoFree trial days
success_urlstringYesRedirect URL after successful payment
cancel_urlstringNoRedirect URL if customer cancels
metadataobjectNoCustom key-value pairs
expires_attimestampNoWhen link expires (default: 15 days)

Response

{
  "id": "plink_abc123xyz",
  "url": "https://checkout.withgale.com/pay/plink_abc123xyz",
  "amount": 4995,
  "currency": "USD",
  "description": "Premium Blood Pressure Monitor",
  "payment_type": "one_time",
  "status": "active",
  "customer": {
    "email": "customer@example.com",
    "first_name": "Jane",
    "last_name": "Doe"
  },
  "products": [
    {
      "merchant_product_id": "BP-MONITOR-001",
      "name": "Blood Pressure Monitor",
      "quantity": 1,
      "price": 4995,
      "hsa_fsa_eligible": true
    }
  ],
  "success_url": "https://yoursite.com/success",
  "cancel_url": "https://yoursite.com/cancel",
  "metadata": {
    "order_id": "ORD-12345"
  },
  "expires_at": "2026-03-12T14:30:00Z",
  "created_at": "2026-02-25T14:30:00Z"
}

Example

curl -X POST https://api.withgale.com/v2/payment-links \
  -H "Authorization: Bearer glm_test_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 2995,
    "currency": "USD",
    "description": "Digital Thermometer",
    "products": [
      {
        "merchant_product_id": "THERM-001",
        "name": "Digital Thermometer",
        "quantity": 1,
        "price": 2995
      }
    ],
    "success_url": "https://yoursite.com/success"
  }'

Subscription Intervals

Intervalinterval_countBilling Frequency
monthly1Every month
monthly3Every 3 months (quarterly)
weekly1Every week
weekly2Every 2 weeks (bi-weekly)
yearly1Every year
StatusDescription
activeLink is active and ready for payment
expiredLink has expired (past expires_at time)
paidPayment completed successfully
cancelledLink was cancelled

Webhooks

Payment links trigger the following webhook events:
  • payment_link.created — Link created
  • payment_link.paid — Payment completed
  • payment_link.expired — Link expired
  • order.created — Order created from payment
See Webhooks Reference for details.

Errors

Status CodeError CodeDescription
400invalid_requestMissing or invalid parameters
400invalid_amountAmount must be positive integer in cents
401unauthorizedInvalid or missing API key
422validation_errorField validation failed