Catalog npm
PACKAGE EXPLORERView in registry

54pay-payments-sdk

npm

A Javascript-based SDK for integrating payment methods via 54Pay.

Versions collected10
Direct dependencies56From release 1.1.3
Last observed20 Oct, 20:25 UTC

README

Current package documentation

54pay-payment-sdk

A JavaScript/TypeScript SDK for accepting payments via 54Pay. This release covers the Nigeria (NGN) checkout: Bank Transfer, OPay, PalmPay and Kuda.

Installation

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

Usage

The SDK mounts the checkout into a DOM element you provide via its id.

ES module / bundler (React, Vite, Next.js, etc.)

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 tag (CDN / global)

<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>

API

FiftyFourPayPaymentSdk.setup({ targetId, props })

FieldTypeDescription
targetIdstringid of the DOM element to render the checkout into.
propsPaygateCheckoutSdkPropsCheckout configuration (see below).

props

FieldTypeRequiredDescription
userDataMerchantDataPropsyesTransaction + customer details (see below).
config{ environment?,}noenvironment: "test" | "live" (default test), theme: "light" | "dark".
onSuccess(transactionId?: string) => voidnoCalled once when the payment completes.
onError(error?: unknown) => voidnoCalled once when the payment fails.

userData (MerchantDataProps)

Required

FieldTypeNotes
amountnumberMust be a positive number.
transactionRefstringYour unique reference. Used as the recovery key.
merchantPublicKeystringYour 54Pay public key, used for API auth.
country / currencystringProvide 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, phoneNumberstringCustomer 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.

Environments

config.environment selects the backend:

  • "test" → 54Pay test environment
  • "live" → 54Pay production environment

If omitted, the SDK defaults to the test environment.

Supported regions

The region is resolved from userData.countryCode and/or userData.currencyCode / transactionCurrency.

RegionCountry codeCurrencyPayment methods
NigeriaNGANGNBank Transfer (dynamic virtual account), OPay, PalmPay, Kuda
GhanaGHAGHSMobile Money
CameroonCMRXAFMobile Money
KenyaKENKESMobile Money
GambiaGMBGMDMobile 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: "…" }

License

MIT

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Versions 10

Collected releases
VersionPublishedDirect dependenciesOpen version
1.1.3Registry latest8 Oct 202656
1.1.217 Sept 202656
1.1.115 Sept 202656
1.1.08 Sept 202656
1.0.1128 Aug 202656
1.0.1027 Aug 202656
1.0.918 Aug 202656
1.0.86 Aug 202656
1.0.73 Aug 202656
1.0.63 Aug 202656

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Repository

PENDING
mypaygate/web-sdk

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 20:25 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:0220f2c294c29dc8976939ddfabe07440a60f9940bfdc246fcacdd5578ce440b