Skip to content

Billing

Paylinker Billing allows you to bill customers with recurring subscriptions or one-time invoices.

Core Concepts

Key Terms

  • Product: The good or service you are selling (e.g., "Gold Plan").
  • Price: The cost and interval of the product (e.g., $10/month).
  • Subscription: The association between a Customer and a Price.

Creating a Subscription

To create a subscription, you need a Customer ID and a Price ID.

bash
curl https://api.paylinker.com/v1/subscriptions \
  -u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \
  -d customer=cus_1F7... \
  -d "items[0][price]"=price_1Gq...

Invoices

Paylinker automatically generates invoices for subscriptions. You can also create one-off invoices for custom services.

Invoice Lifecycle

  1. Draft: The invoice is created but can still be edited.
  2. Open: The invoice is finalized and awaiting payment.
  3. Paid: The invoice has been successfully paid.
  4. Void: The invoice was cancelled.
  5. Uncollectible: Payment failed multiple times and you stopped retrying.

Handling Failed Payments (Smart Dunning)

Automated Recovery

Paylinker automatically retries failed subscription payments according to your settings (e.g., 3 times over 2 weeks).

You can listen to webhooks to notify customers to update their payment method.

  • invoice.payment_failed: Triggered when a payment attempt fails.
  • customer.subscription.deleted: Triggered if the subscription is canceled due to non-payment.

Released under the MIT License.