Subscription billing can be handled by creating a new crypto invoice for each billing cycle. The first straightforward approach is to use OxaPay’s invoicing each time payment is due:
-
Generate an invoice for each billing cycle: When a subscription payment is due (e.g. monthly or annually), use your Merchant API Key to create a new invoice for the subscription amount. Specify the amount (in crypto or fiat equivalent) and any other preferences. This gives you a payment link (URL) for that invoice.
-
Send the payment link to the subscriber: Present the invoice link to the customer – for example, email it to them or display it on their account. The customer clicks the link and is taken to OxaPay’s payment page to pay the invoice. They can choose their preferred crypto and complete the payment just like a one-time purchase.
-
Customer pays the invoice: The subscriber sends the cryptocurrency to the address provided by OxaPay for that invoice. OxaPay will handle exchange rate calculation and will monitor the transaction.
-
Receive confirmation via webhook: Once the payment is received, OxaPay sends a webhook callback to your server with the transaction details and status. Your system should listen for this callback on your specified
callback_url
(when the payment is fully confirmed, thestatus
in the callback will change to “paid”) -
Validate and activate the subscription: Verify the callback’s HMAC signature with your API key to ensure it’s from OxaPay. If the
status
is "paid", you can go ahead and mark that subscription period as paid in your system – for example, extend the user’s account access or service for the next month. This is how you automate your flow to renew the user’s subscription as soon as the payment is confirmed.
In all cases, make sure to wait for the "paid" confirmation from OxaPay before renewing a service for another period.