Skip to main content

Installation

Alternatively, load the SDK directly via CDN — no build step required.

Integration

Option 1 — CDN (HTML)

Include the Payaza bundle script and call PayazaCheckout.setup() when the customer initiates checkout.

Option 2 — npm / yarn (JavaScript)


Option 3 — npm / yarn (TypeScript)

If setup conflicts with a function name in your codebase, import it under an alias: import { setup as PayazaSetup } from "payaza-web-sdk";

Phone number format

The phone_number field must be in international format — country code followed by the subscriber number, with no spaces, dashes, or + prefix.
Strip the leading 0 from the local number and prepend the country code. For Nigeria: 07012345678+2347012345678.

Callback response

The callback function fires when the payment flow completes. It receives a single response object:
Always verify the payment server-side using the transaction_reference before fulfilling an order. The callback fires on the client and can be intercepted. Use the Transaction Status Query API or listen for a webhook to confirm the final state.

Errors

Ensure all required parameters are present and correctly formatted before calling showPopup().

Invalid merchant key

Validation error

Environment mismatch


Parameters

Required

string
required
Your public API key from the Payaza dashboard. Do not Base64-encode this — pass the raw key directly.
string
required
Environment for the transaction. Accepts "Live" or "Test". Must match the environment of your merchant_key.
number
required
Amount to charge the customer. Pass as a number — e.g. 5000. Do not pass as a string.
string
required
ISO currency code — e.g. "NGN", "GHS", "USD".
string
required
The customer’s email address. Used for payment receipts and customer identification.
string
required
The customer’s first name.
string
required
The customer’s last name.
string
required
The customer’s phone number in international format — country code followed by the number, no spaces or dashes. Example: "+2347012345678" for Nigeria. See the phone number format table above.
string
required
A unique identifier you generate for each transaction. Must be unique per payment attempt — reusing a reference will cause an error.

Optional

string
Required only for CIV and BEN collections. Pass the ISO country code — e.g. "CIV" or "BEN". Not needed for NGN, GHS, or other standard currencies.
string
Overrides the business name shown on the checkout page. Defaults to your registered Payaza business name if omitted.
object
Controls the bank transfer option in the checkout modal. Set expires_in_minutes to define how long the virtual account stays active. Min: 15, max: 480. Defaults to 30 if omitted.
object
Set plan_id to the value that was created using the Create Subscription Plan API or from your Payaza Dashboard which acts as a unique identifier for your subscription plan.
array
An array containing the split account values and corresponding ratios.

Field Parameters

  • code (string): Set this to the unique split account identifier value that was generated using the Create Split Account API.
  • ratio (integer): Defines the relative weighted portion used to calculate how the transaction remainder is divided between the split accounts.

Ratio Rules

The calculation matches integers directly to decimal percentage scales where 1 represents 10%, 2 represents 20%, 3 represents 30%, and 4 represents 40% allocations.
Critical Rule: When assigning multiple split account elements inside this configuration array, the cumulative sum of all ratio values must equal exactly 10 in total (representing 100%).
Example Payload
object
Custom metadata attached to the transaction — e.g. order ID, user ID, ticket reference. Returned in the callback response. Must be a valid JSON object.
function
Called when the payment flow completes (success or failure). Receives the transaction outcome object. See Callback response above.
function
Called when the user closes the checkout modal before completing payment.