Using ChatGPT with NaafiPay
ChatGPT is OpenAI's general-purpose AI assistant and the most widely used coding assistant in the world. With the right context it produces excellent NaafiPay integrations, but it handles context slightly differently from Claude: ChatGPT favours system prompts and Custom GPTs for durable context, while you can rely on conversation history for one-off tasks. This page shows you how to set up a ChatGPT conversation, when to use a Custom GPT versus a regular chat, and gives you four ready-to-paste prompt templates for the most common integration tasks.
System prompt versus conversation
Claude is good at holding large conversation context. ChatGPT does this too, but for anything you reuse — a project where you ask the same kind of question many times — the cleanest setup is a Custom GPT with the NaafiPay docs in its Instructions and Knowledge files. The Custom GPT then knows your API spec on every turn without you re-pasting it.
Setting up a Custom GPT
Go to ChatGPT and click Explore GPTs → Create. In Instructions, paste a short brief like “You help me integrate the NaafiPay payment API into Node.js and PHP applications. Always read the attached docs before answering and prefer code that does not introduce new dependencies.” Under Knowledge, upload the Markdown or PDF versions of the API Overview, Create Checkout, Verify Payment, Webhooks, and Error Codes pages.
Prompt template 1 — Create a checkout
1You are integrating the NaafiPay payment API. Here is the Create Checkout endpoint:2[paste the full Create Checkout page]3 4Write a Python Flask route at POST /buy that:5- Reads order_id, amount, customer_name, customer_email from the request JSON6- Calls https://naafipay.com/api/public/v1/payments with header Authorization7- Sets success_url and cancel_url based on request.host_url8- Returns { "checkout_url": "..." }9- Uses requests and reads the key from os.environ['NAAFIPAY_KEY']10- Handles HTTP errors with abort(502)11 12Provide the complete file.Prompt template 2 — Verify payment
1Here is the NaafiPay Verify Payment endpoint:2[paste the full Verify Payment page]3 4In my Express + TypeScript app, write a GET /thank-you handler that:5- Reads invoice_id from req.query6- Calls /api/public/v1/verify-payment server-side7- Renders an EJS template called "thank-you" with a "payment" local8- Renders an EJS template called "pending" if status is "pending"9- Renders "failed" otherwise10- Adds robust TypeScript types11 12Show the complete route file.Prompt template 3 — Handle webhooks
1Here is the NaafiPay Webhooks page:2[paste the full Webhooks page]3 4Using PHP 8.2 (no framework, plain PHP), write a webhook handler at /webhooks/naafipay.php5that:6- Reads the raw POST body7- Verifies x-paygate-signature-v2 with HMAC-SHA256 of "timestamp.body"8- Rejects requests where the timestamp is more than 300 seconds old9- For event "payment.completed", inserts a row into a "payments" MySQL table10 with columns invoice_id (unique), amount, paid_at — use INSERT IGNORE for idempotency11- Returns 200 on success, 401 on signature errors12 13Provide the complete file with prepared statements.Prompt template 4 — Full payment flow
1Here are the NaafiPay docs:2[paste API Overview, Create Checkout, Verify Payment, Webhooks pages]3 4Build a complete payment flow for a Next.js 15 App Router e-commerce site:51. Server action createCheckout(productId) that creates a NaafiPay session and6 redirects to checkout_url72. /thank-you page that verifies the invoice and shows a fulfilment UI83. /api/webhooks/naafipay route handler that verifies the signature and updates9 an "orders" Postgres table (using Drizzle ORM)104. Reads NAAFIPAY_KEY and NAAFIPAY_WEBHOOK_SECRET from process.env11 12Show every file, including the Drizzle schema.stripe.checkout.sessions.create, header names like Stripe-Signature, or unfamiliar field names, stop and remind it that you are using NaafiPay, not Stripe. The field names and headers in our docs are the source of truth.