Quickstart Guide¶
Get your first Nivatio payment running in under 5 minutes.
Prerequisites¶
- A registered merchant account (sign up at dashboard.nivat.io)
- A project created in your dashboard
- API key generated for your project
Step 1: Create an Order¶
Use your API key to create a payment order:
curl -X POST https://api.nivat.io/v1/orders \
-H "x-api-key: nv_sk_live_abc123..." \
-H "Content-Type: application/json" \
-d '{
"amount": 100000,
"currency": "NUSD",
"description": "Premium Subscription",
"successUrl": "https://yourapp.com/success",
"cancelUrl": "https://yourapp.com/cancel"
}'
Response:
{
"id": "order_abc123",
"amount": 100000,
"currency": "NUSD",
"status": "PENDING",
"checkoutUrl": "https://checkout.nivat.io/order_abc123"
}
Step 2: Redirect to Checkout¶
Redirect your customer to the checkoutUrl:
window.location.href = response.checkoutUrl;
Or embed the checkout using our JavaScript SDK:
<script src="https://checkout.nivat.io/nivatio-checkout.js"></script>
<script>
NivatioCheckout.open({
orderId: 'order_abc123',
onSuccess: (data) => console.log('Payment successful!', data),
onCancel: () => console.log('Payment cancelled')
});
</script>
Step 3: Receive Webhook Notification¶
Configure your webhook URL in the dashboard, then listen for payment events:
// Example Express.js webhook handler
app.post('/webhook', (req, res) => {
const event = req.body;
if (event.type === 'payment.succeeded') {
const order = event.data;
console.log(`Payment ${order.id} succeeded!`);
// Fulfill the order
}
res.json({ received: true });
});
Step 4: Verify Payment (Optional)¶
You can also verify the payment on-chain:
curl https://api.nivat.io/v1/orders/order_abc123 \
-H "x-api-key: YOUR_API_KEY"
Testing with Sandbox¶
Use these test values in sandbox:
| Parameter | Value |
|---|---|
| Chain | Anvil Local (Chain ID: 31337) |
| Token | NUSD (6 decimals) |
| Test Wallet | 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 |
Sandbox Faucet
Use the dashboard to mint test NUSD tokens for development.