Guides

How to accept Mobile Money payments on an AI-built website in Ghana

To take payments on a website you built with an AI tool, the quickest way is a button that opens a berrapay payment link, which needs no code and works in any builder. For a store that must know when each order is paid, ask the AI to add the berrapay API on the server side, with your key stored as a secret, never in the page.

Last updated 29 November 2026.

Step by step

  1. 1

    Open a berrapay account

    Create a free berrapay account at berrapay.com as a freelancer or a business, confirm your phone number, and add your Ghana Card details. berrapay reviews every account, and collecting unlocks once yours is approved.

  2. 2

    The no-code way: a pay button

    Create a payment link in berrapay, then tell your AI builder: "Add a Pay now button that opens this link in a new tab" and paste the link. Use a payment form instead if you need the customer's details.

  3. 3

    The proper way: the API

    Create a test key under Settings, then Connections, then berrapay API. Save it in your builder's secrets or environment variables as BERRAPAY_KEY.

  4. 4

    Paste the prompt below into your AI builder

    It tells the AI to keep the key on the server, create a checkout for each order and confirm payment with a webhook.

  5. 5

    Test with pretend money

    Test keys move no real money. Make one payment succeed and one fail, and check your order updates.

  6. 6

    Go live

    Swap in a live key once your berrapay account is approved.

A prompt to paste into your AI builder

Add payments with the berrapay API (Ghana: Mobile Money and card).

Rules:
- Never put the API key in browser code. Read it on the server from the secret BERRAPAY_KEY.
- Base address: https://berrapay.com/api/v1
- Send the header: Authorization: Bearer <BERRAPAY_KEY>
- Amounts are numbers in cedis (25.5 means GHS 25.50).

1. Create a server-side function "create-checkout". It receives an order id,
   reads the amount from MY database (never from the browser), then sends:
   POST /checkouts
   { "amount": <amount>, "description": "<what was bought>",
     "reference": "<order id>", "return_url": "<my site>/thanks" }
   with the header Idempotency-Key: order-<order id>
   and returns the "url" field from the response.
2. On the checkout button, call that function and redirect the browser to the url.
3. Create a public server-side endpoint "berrapay-webhook" that accepts POST.
   Verify the Berrapay-Signature header (t=<unix time>,v1=<hex>):
   v1 must equal HMAC-SHA256 of "<t>.<raw body>" using the secret
   BERRAPAY_WEBHOOK_SECRET, and t must be within 5 minutes.
   When the event type is "checkout.paid", mark the order whose id equals
   data.object.reference as paid. Ignore an event id already handled.
4. The /thanks page must read the order status from my database,
   not assume the payment succeeded.

At a glance

No-code route
A button that opens a payment link
API route
A server-side function and a webhook
Where the key goes
Your builder's secrets, never the page
Testing
Test keys, with pretend money
Networks
MTN, Telecel and AT, plus cards

Where the server code and the key go in each builder

BuilderServer-side codeWhere to save the key
LovableEdge functionsMore, then Settings, then Secrets
BoltServer functionsThe Database icon, then Secrets
Base44Backend functionsDashboard, then Secrets
ReplitThe app's server, once publishedThe Secrets tool, and production app secrets when publishing
v0Server actions and API routesSettings, then Environment Variables. Don't use the NEXT_PUBLIC_ prefix, which exposes a value to the browser

From each builder's own documentation on 29 November 2026. Menus change, so check the builder's docs if a name has moved.

Common questions

My AI builder offers Stripe. Can I use that in Ghana?

Stripe lists Ghana under its extended network and points businesses there to Paystack, and it doesn't take Mobile Money, which is how most customers in Ghana pay. The built-in payment options in these builders are made for other countries, so use a provider that works here.

The AI put my key in the page. Is that a problem?

Yes. Anyone can read it there. Revoke that key in berrapay, create a new one, and tell the AI to move the call to a server-side function.

Do I need to code?

No. The button needs none, and for the API the AI writes the code from the prompt above.

What does it cost?

Payments are in Ghana cedis (GHS). The payer is charged 1% when they pay by Mobile Money, never more than GHS 25 on one payment, or 1.95% when they pay by card. It is added to what they pay, so you receive the full amount. There is no setup or monthly fee, and topping up and withdrawing are free. The full list is at berrapay.com/fees.

Sources

Ask an AI assistant about this

Opens the assistant in a new tab with a question about this page already typed. You can change it before sending.

Related

Send. Collect. Get paid.

One app to pay anyone in Ghana and get paid by everyone. No setup fee and no monthly fee.

Get started free