Quick Start
This guide takes you from zero to a working payment-management flow in under five minutes. You will create a NaafiPay account, claim a free storefront subdomain, generate your first API key, and make a checkout request from your terminal. By the end you will have a real checkout URL in test mode that you can open in a browser and pay with simulated bKash or Nagad credentials. No production setup, KYC or live business payment account is required to follow along.
Step 1. Create your account
Visit naafipay.com and click Start Now. Sign up with your email address and a password, verify your email, and choose a storefront name. Your storefront URL will be https://your-name.naafipay.app until you connect a custom domain.
Step 2. Generate an API key
From the dashboard, navigate to Settings → API Keys and clickCreate key. The key starts with pg_test_ (test mode) orpg_live_ (live mode) and is shown only once — copy it and store it in your password manager or a server-side environment variable. Keys are SHA-256 hashed at rest, so we can never show it to you again.
Step 3. Create your first payment record
Open a terminal and run the following request. Replace pg_test_xxx with the key you just copied. The response returns a payment object with a reference_idand id you will use to check its status.
1curl -X POST https://naafipay.com/api/public/v1/payments \2 -H "Authorization: Bearer pg_test_xxx" \3 -H "Content-Type: application/json" \4 -d '{5 "amount": 1500,6 "currency": "BDT",7 "customer_name": "Tasin Fahim",8 "customer_email": "tasin@example.com",9 "reference_id": "ORD-1001",10 "metadata": { "order_id": "ORD-1001" }11 }'Step 4. Verify the payment
Before delivering the goods, call POST /api/public/v1/verify-payment with theinvoice_id tied to the payment link. Only deliver the goods or unlock the account when the response status is COMPLETED. This guards against URL tampering, where a customer manually navigates to your success page without actually paying.
1curl -X POST https://naafipay.com/api/public/v1/verify-payment \2 -H "Authorization: Bearer pg_test_xxx" \3 -H "Content-Type: application/json" \4 -d '{ "invoice_id": "udp_01HZX..." }'What you have built
- A NaafiPay merchant account on a free storefront subdomain
- A test API key for local development
- A working checkout request that returns a hosted checkout URL
- A verification request you can wire into your success page