Payments

Initialize a payment

Create a payment request and receive an HPN code.

Bash
POST /v1/transactions/initialize

Scope: transactions:write or transactions:initialize

Request

FieldTypeRequiredDescription
amountstringYesAmount, e.g. "150.00"
phone_numberstringYesCustomer’s phone (local or E.164)
currencystringNoDefault "GHS"
customer_namestringNoCustomer’s name
descriptionstringNoTransaction description
webhook_urlstringNoOverride default webhook (secret keys only)
redirect_urlstringNoWhere to send the customer after hosted checkout
idempotency_keystringNoDedup key (24h window). Header Idempotency-Key works too.
client_referencestringNoYour own ID (e.g. order ID). Max 100 chars.
metaobjectNoArbitrary JSON, max 4 KB
expires_in_hoursintegerNoExpiry in hours, 1–24. Default 24.
expected_telco_transaction_idstringNoMatch a specific transaction ID — same-network only
expected_payer_phonestringNoAnti-spoofing. Payments from other numbers go to manual review.
send_sms_to_payerbooleanNoSMS the HPN code to the customer once verified. Default true.

Example

Bash
curl -X POST https://api.harpoonsms.com/v1/transactions/initialize 
  -H "Authorization: Bearer hpn_live_sk_xxxxxxxxxxxxx" 
  -H "Content-Type: application/json" 
  -d '{
    "amount": "150.00",
    "phone_number": "0244123456",
    "customer_name": "John Doe",
    "description": "Order #1234",
    "client_reference": "order_1234"
  }'

Response

JSON
{
  "success": true,
  "data": {
    "reference": "hpn_trx_a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6",
    "hpn_code": "K7M3F6",
    "public_slug": "a1b2c3d4e5f6a7b8",
    "amount": "150.00",
    "currency": "GHS",
    "status": "PENDING",
    "expires_at": "2026-04-30T12:00:00Z",
    "created_at": "2026-04-29T12:00:00Z",
    "payer_sms_sent": false,
    "checkout_url": "https://harpoonsms.com/pay/a1b2c3d4e5f6a7b8",
    "client_reference": "order_1234"
  },
  "meta": {
    "request_id": "req_c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8",
    "idempotency_key": null
  }
}
FieldDescription
referenceStable Harpoon ID for the payment request
hpn_codeWhat the customer types in the MoMo reference field
public_slugUsed in the hosted checkout_url
checkout_urlHosted page if you don’t want to build your own UI

The customer pays your MoMo number with the HPN code as the reference. When the payment is verified, your webhook fires.