Skip to main content
POST
Create Credit Top-up Purchase
Base URL: https://api.nozle.app/engine/api/v1. Auth: secret key only. The key requires credit_system:write. Publishable keys are rejected. Idempotency-Key is required and must not exceed 255 bytes.
All three fields are required. Unknown fields return 400. The Engine forwards the request to Nozle Core and returns Core’s status and body unchanged. The body is { "credit_top_up_purchase": { ... } }. The response returns the pending purchase snapshot and hosted payment_url. Navigate the same page to that URL. For a customer on Stripe, payment_url is a Stripe-hosted checkout.stripe.com page that is valid for 24 hours, and the customer must already be linked to a Stripe customer. For a customer on Razorpay, payment_url is an rzp.io payment link, payment_provider is razorpay, and the package must be priced in INR. The purchase object carries payment_status. A Razorpay top-up has no checkout ID to poll.
Creating checkout does not grant credits. Credits are materialized once the top-up invoice is fully paid, by any route: a card or provider payment, a manual payment for the full amount, a payment request, or marking the invoice paid. A partial manual payment grants nothing until the invoice is fully paid.

Errors

Core checks the customer’s payment provider before it creates anything. A provider error leaves no invoice, no purchase, no invoice.one_off_created webhook or email, and the customer’s currency stays unset, so retrying with a new Idempotency-Key after such an error creates nothing. A successful purchase is recorded in the activity log as credit_top_up_purchase.created, and its finalized one-off invoice as invoice.one_off_created.