Take payments
Payment links
A link you can send on WhatsApp, with no checkout page of your own.
A payment link is a page Harbour hosts, for one amount and one description, that anyone can pay without you building a checkout. Businesses create them in the dashboard or the app; you can create them through the API when the amount comes out of your system — an invoice, a deposit, a subscription renewal someone will pay by hand.
Create a link
const link = await harbour.paymentLinks.create({
amountKobo: 1_200_000,
description: 'Aso-ebi order, 12 yards',
customer: { name: 'Funke Adeyemi', phone: '+2348031234567' },
expiresInDays: 7, // 1 to 90, default 7
provider: 'auto',
});
link.id; // "lnk_…"
link.url; // "https://pay.harbour.africa/okafor-textiles/k2m9x"
link.status; // "active"
curl -s -X POST https://api.harbour.africa/v1/payment-links \
<?php
use Nordaxiz\HarbourConnect\Harbour;
$link = Harbour::links()->create(12_000_00, 'Aso-ebi order, 12 yards', [
'customer' => ['name' => 'Funke Adeyemi', 'phone' => '+2348031234567'],
'expires_in_days' => 7, // 1 to 90, default 7
'provider' => 'auto',
]);
$link->id; // "lnk_…"
$link->url; // "https://pay.harbour.africa/okafor-textiles/k2m9x"
$link->status; // "active"
The amount and description are required: the description is what the customer reads on the page, so write it the way you would in a message ("Aso-ebi order, 12 yards", not "INV-1043").
Share it
$link->url is a plain, short URL on pay.harbour.africa. Send it however the customer
already talks to the business: WhatsApp, SMS, an email, a QR code on a counter. The dashboard has a share action that
opens WhatsApp with the message written; through the API you send it yourself.
Knowing it was paid
A paid link raises link.paid, whose data is the transaction, exactly like
charge.succeeded:
import { Event } from '@nordaxiz/harbour-connect';
if (event.type === Event.LINK_PAID) {
const txn = event.transaction();
const invoice = await Invoice.findByReference(txn.merchant_reference);
await invoice?.markPaid(event.id);
}
<?php
use Nordaxiz\HarbourConnect\Webhook\Event;
if ($event->type === Event::LINK_PAID) {
$transaction = $event->transaction();
$invoice = Invoice::findByReference($transaction->merchantReference);
$invoice?->markPaid($event->id);
}
Or ask, if you are reconciling in a job rather than reacting:
const link = await harbour.paymentLinks.retrieve('lnk_…');
link.status; // active | paid | expired | cancelled
link.transaction_id; // the payment, once someone pays
curl -s https://api.harbour.africa/v1/payment-links/lnk_01k5m0r3w9 \
<?php
$link = Harbour::links()->retrieve('lnk_…');
$link->status; // active | paid | expired | cancelled
$link->transactionId; // the payment, once someone pays