Observed since 20 Oct, 20:25 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
A Javascript-based SDK for integrating payment methods via 54Pay.
A JavaScript/TypeScript SDK for accepting payments via 54Pay. This release covers the Nigeria (NGN) checkout: Bank Transfer, OPay, PalmPay and Kuda.
npm install 54pay-payment-sdk
# or
yarn add 54pay-payment-sdk
react, react-dom and styled-components are peer dependencies — install them in your app if you haven't already:
npm install react react-dom styled-components
The SDK mounts the checkout into a DOM element you provide via its id.
import { FiftyFourPayPaymentSdk } from "54pay-payment-sdk";
FiftyFourPayPaymentSdk.setup({
targetId: "checkout-container", // id of an element already in the DOM
props: {
userData: {
amount: 1000,
transactionRef: "ORDER_12345",
merchantPublicKey: "PK-…",
countryCode: "NGA",
currencyCode: "NGN",
transactionCurrency: "NGN",
firstName: "Ada",
lastName: "Obi",
email: "ada@example.com",
phoneNumber: "8160009000",
},
config: { environment: "live", theme: "light" },
onSuccess: (transactionId) => console.log("paid", transactionId),
onError: (error) => console.error("payment failed", error),
},
});
<div id="checkout-container"></div>
<script src="https://cdn.jsdelivr.net/npm/54pay-payment-sdk/dist/index.iife.js"></script>
<div id="checkout-container"></div>
<script>
window["54PaySdk"].setup({
targetId: "checkout-container",
props: {
userData: {
amount: 1000,
transactionRef: "ORDER_12345",
merchantPublicKey: "PK-…",
countryCode: "NGA",
currencyCode: "NGN",
firstName: "Ada",
lastName: "Obi",
email: "ada@example.com",
phoneNumber: "8160009000",
},
config: { environment: "live" },
onSuccess: (transactionId) => console.log("paid", transactionId),
},
});
</script>
FiftyFourPayPaymentSdk.setup({ targetId, props })| Field | Type | Description |
|---|---|---|
targetId | string | id of the DOM element to render the checkout into. |
props | PaygateCheckoutSdkProps | Checkout configuration (see below). |
props| Field | Type | Required | Description |
|---|---|---|---|
userData | MerchantDataProps | yes | Transaction + customer details (see below). |
config | { environment?,} | no | environment: "test" | "live" (default test), theme: "light" | "dark". |
onSuccess | (transactionId?: string) => void | no | Called once when the payment completes. |
onError | (error?: unknown) => void | no | Called once when the payment fails. |
userData (MerchantDataProps)Required
| Field | Type | Notes |
|---|---|---|
amount | number | Must be a positive number. |
transactionRef | string | Your unique reference. Used as the recovery key. |
merchantPublicKey | string | Your 54Pay public key, used for API auth. |
| country / currency | string | Provide at least one of countryCode (e.g. "NGA"), currencyCode (e.g. "NGN") or transactionCurrency so the SDK can resolve the country profile. |
firstName, lastName, email, phoneNumber | string | Customer details. |
Common optional fields: merchantName, merchantReference, transactionDescription, redirectUrl, successUrl, errorUrl, cancelUrl, webhookUrl, customerAddress, customerCity, customerState, metadataOrderId, metadataProductInfo. See the exported MerchantDataProps type for the full list.
config.environment selects the backend:
"test" → 54Pay test environment"live" → 54Pay production environmentIf omitted, the SDK defaults to the test environment.
The region is resolved from userData.countryCode and/or userData.currencyCode / transactionCurrency.
| Region | Country code | Currency | Payment methods |
|---|---|---|---|
| Nigeria | NGA | NGN | Bank Transfer (dynamic virtual account), OPay, PalmPay, Kuda |
| Ghana | GHA | GHS | Mobile Money |
| Cameroon | CMR | XAF | Mobile Money |
| Kenya | KEN | KES | Mobile Money |
| Gambia | GMB | GMD | Mobile Money |
Because XAF is shared across the six-country CFA zone, Cameroon is resolved from countryCode — send "CMR" (or "CM") to get the Cameroon profile.
If you pass an unsupported country/currency, the checkout will not mount — instead onError is called with:
{ code: "UNSUPPORTED_REGION", message: "…" }
MIT
Download counts and popularity will appear here as the collector receives them.
This describes our collected data; it is not a security assessment.
Observed since 20 Oct, 20:25 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:0220f2c294c29dc8976939ddfabe07440a60f9940bfdc246fcacdd5578ce440b