Create a Recurring Invoices
Copperx allows you to create recurring invoices for subscriptions, memberships, and services that require periodic payments.
🔧 How It Works
Create a Recurring Invoice: Provide the relevant customer, amount, and recurrence details.
Invoice Generation & Automation: Copperx’s system automatically generates new invoices at the defined interval.
Notifications & Webhooks: Stay updated with webhooks for successful payments, failures, or other events.
✅ Step 1: Create a Customer
Before creating an invoice, you’ll need to create a customer:
curl --request POST \
--url https://api.copperx.dev/api/v1/customers \
--header 'Authorization: Bearer {API_KEY}' \
--header 'Content-Type: application/json' \
--data-raw '{
"email": "customer@example.com",
"name": "John Doe",
"metadata": {
"customerType": "SaaS"
}
}'✅ Save the customerId from the response.
✅ Step 2: Create a Product
Next, create the product to be billed:
✅ Save the productId from the response.
✅ Save the defaultPrice.id as a priceId from the response.
✅ Step 3: Create a Recurring Invoice
Use the customerId and productId and priceId in the invoice creation request:
✅ Save the invoiceId from the response.
✅ Step 4: Finalize the Invoice
Finalize the invoice to make it active and ready for payment collection:
🛠️ Best Practices
✅ Validate Customer Details: Make sure the customer information is accurate before generating invoices.
✅ Use Webhooks: Listen for events like invoice.paid, customer.subscription.started, and invoice.marked_as_paid to keep your system up to date.
✅ Secure API Calls: Always use HTTPS and a valid API key.
✅ Clear Terms: Clearly communicate the subscription and billing terms to customers.
Last updated
Was this helpful?