Guides

How to build a payment checkout for a Ghanaian website or app

A reliable checkout for a Ghanaian website has four parts: your server creates the payment, the customer is sent to a hosted page to pay by Mobile Money or card, they are returned to your site, and your server confirms the result from a webhook. The page the customer lands on afterwards should never be what marks an order as paid.

Step by step

  1. 1

    Create the payment on your server

    Never from the browser, where the amount could be changed and your key would be exposed.

  2. 2

    Carry your order number

    Send it as the reference, so every message about the payment can be matched to the order.

  3. 3

    Send the customer to pay

    Redirect to the checkout's url. berrapay hosts the page, the network choice and the waiting screen.

  4. 4

    Treat the return as a thank-you only

    Customers close tabs and lose signal. Show a holding message and read the real status from your server.

  5. 5

    Confirm from the webhook

    Mark the order paid on checkout.paid, after checking the signature.

  6. 6

    Set an expiry

    Use expires_in_minutes so an abandoned checkout can't be paid days later at an old price.

After the customer comes back

// Node.js: the thank-you page asks your own server, which asks berrapay
const res = await fetch("https://berrapay.com/api/v1/checkouts/" + order.checkoutId, {
  headers: { Authorization: "Bearer " + process.env.BERRAPAY_KEY },
});
const checkout = await res.json();
// status is unpaid, paid, cancelled, expired or refunded
showPage(checkout.status === "paid" ? "Thank you, your order is confirmed" : "We're waiting for your payment");

At a glance

Who creates the payment
Your server
Who hosts the pay page
berrapay
What confirms an order
The checkout.paid webhook
Checkout statuses
unpaid, paid, cancelled, expired, refunded
Abandoned checkouts
Close them with expires_in_minutes

Common questions

Why not mark the order paid on the return page?

Because the customer may never reach it, or may open it without paying. Only the webhook or a status read from your server is proof.

Can I show the amount with the fee?

The pay page shows the customer the fee and total before they confirm.

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.

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