API v1 · Draft

PayHonta API documentation

These are PayHonta's proposed API contracts. Base URLs will be confirmed when the production domain and environments are established.

Authentication

Authenticate server-side requests with your secret key in the Authorization: Bearer header. Public keys (pk_) identify you in client code; secret keys (sk_) must never leave your server.

Sandbox

https://sandbox-api.payhonta.com/v1

Keys: pk_test_ / sk_test_

Production

https://api.payhonta.com/v1

Keys: pk_live_ / sk_live_ — after activation

Quick start: create a payment

Amounts are in the currency's minor unit (kobo for NGN).

curl -X POST https://sandbox-api.payhonta.com/v1/payments \
  -H "Authorization: Bearer sk_test_xxx" \
  -H "Idempotency-Key: 4f9c2b1e-inv-1042" \
  -H "Content-Type: application/json" \
  -d '{"amount": 2500000, "currency": "NGN", "method": "bank_transfer", "reference": "INV-1042"}'

Idempotency

Send a unique Idempotency-Key with every create request. Retrying with the same key returns the original result and never creates a second payment. Keys are kept for 24 hours.

API reference

Payments

  • POST/v1/paymentsCreate a payment
  • GET/v1/payments/{id}Retrieve a payment
  • GET/v1/transactionsList transactions
  • POST/v1/payments/{id}/verifyVerify a payment with the provider
  • POST/v1/payments/{id}/refundRequest a refund

Virtual accounts

  • POST/v1/virtual-accountsCreate a virtual account
  • GET/v1/virtual-accountsList virtual accounts
  • GET/v1/virtual-accounts/{id}Retrieve a virtual account

Customers

  • POST/v1/customersCreate a customer
  • GET/v1/customers/{id}Retrieve a customer

Payment links

  • POST/v1/payment-linksCreate a payment link
  • GET/v1/payment-linksList payment links
  • GET/v1/payment-links/{id}Retrieve a payment link

Crypto

  • POST/v1/crypto/paymentsCreate a crypto payment
  • GET/v1/crypto/payments/{id}Retrieve a crypto payment
  • GET/v1/crypto/ratesGet quote rates
  • POST/v1/crypto/payments/{id}/verifyVerify a crypto payment

Webhooks

  • POST/v1/webhooksRegister an endpoint
  • GET/v1/webhooksList endpoints
  • POST/v1/webhooks/{id}/testSend a test event

Settlements

  • GET/v1/settlementsList settlements
  • GET/v1/settlements/{id}Retrieve a settlement

Reports

  • GET/v1/reports/transactionsTransaction report
  • GET/v1/reports/settlementsSettlement report

Webhooks

PayHonta sends events server-to-server with a PayHonta-Signature header. Always verify the signature and timestamp, and de-duplicate by event ID. Failed deliveries are retried with exponential backoff.

Events: payment.created, payment.pending, payment.successful, payment.failed, payment.expired, payment.refunded, virtual_account.created, crypto.payment.detected, crypto.payment.confirmed, settlement.created, settlement.completed

import crypto from "node:crypto";

// Header: PayHonta-Signature: t=1732745000,v1=<hex hmac>
export function verifyPayHontaWebhook(rawBody, header, secret) {
  const parts = Object.fromEntries(header.split(",").map((p) => p.split("=")));
  const age = Math.abs(Date.now() / 1000 - Number(parts.t));
  if (age > 300) return false; // reject replays older than 5 minutes
  const expected = crypto.createHmac("sha256", secret).update(`${parts.t}.${rawBody}`).digest("hex");
  return crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(parts.v1));
}

Errors

HTTPCodeMeaning
400invalid_requestA parameter is missing or invalid
401authentication_failedAPI key missing, invalid or revoked
403permission_deniedKey lacks permission or account not activated
404not_foundResource does not exist
409idempotency_conflictKey reused with different parameters
429rate_limitedToo many requests
503provider_unavailableProvider unavailable; payment not created

Sandbox

Sandbox transactions are simulated, carry "environment": "sandbox" and never move real money. Sandbox keys never work in production.