Your first payment, no code
PigaPay checkout on your website
Receive payment results safely
Test, then go live
Your first payment, no code
Take a payment today with a payment link or QR code. No website needed.
- Create your free account and confirm the code we send you.
- Open Payment Links in your dashboard and press New Link.
- Set the amount (or let the customer type it) and a short description.
- Share it: send the link on WhatsApp or SMS, or print the QR code for your shop counter.
- The customer pays by phone with M-Pesa, Mixx by Yas, Airtel Money or HaloPesa, and you see the payment in your dashboard.
PigaPay checkout on your website
Send your customer to a PigaPay payment page. PigaPay asks for the phone number, sends the prompt, lets them try again and brings them back to your site.
- Create a test key in your dashboard: API Keys, then Create key, mode Test. Copy the key and the webhook secret.
- Download the PHP library and save it next to your code.
- Create a checkout when the customer presses Pay on your site:
$pigapay = new PigaPay\Client(getenv('PIGAPAY_KEY')); $checkout = $pigapay->createCheckout([ 'amount' => $order->total, 'reference' => 'ORDER-' . $order->id, 'success_url' => 'https://yourshop.co.tz/paid', 'cancel_url' => 'https://yourshop.co.tz/cart', ]); header('Location: ' . $checkout['url']); - Show a thank-you page at your success_url. Mark the order paid only from the webhook (next guide), not from this page.
Receive payment results safely
PigaPay sends every result to your webhook URL, signed with your webhook secret.
- Set your webhook URL on the key (API Keys, Edit), for example https://yourshop.co.tz/pigapay/webhook.
- Check the signature on every request and answer 200:
$event = PigaPay\Webhook::fromRequest(getenv('PIGAPAY_WEBHOOK_SECRET')); if ($event['event'] === 'payment.completed') { markOrderPaid($event['reference'], $event['event_id']); // once per event_id } http_response_code(200); - Press Send test on the API Keys page: your server should answer 200.
- Missed one? PigaPay tries again after 1 minute, 5 minutes, 30 minutes, 2 hours... and lists every delivery on the API Keys page.
Test, then go live
With a test key no money moves and no phone is contacted. These numbers give these results:
- 255700000001 fails (not enough money), 255700000002 is cancelled, 255700000003 stays waiting; any other number completes.
- Upload your business documents (BRELA, TIN, NIDA) so you can withdraw.
- Create a live key with the same settings and your server's IP under Allowed IPs.
- Swap the keys in your settings file, then make one small real payment to check.