Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.tender.cash/llms.txt

Use this file to discover all available pages before exploring further.

Overview

This page contains full documentation for both JavaScript SDK tracks:
  • Latest SDK: @tender-cash/js-sdk
  • Legacy SDK (Old Version): @tender-cash/agent-sdk-react

Package

@tender-cash/js-sdk

Current JavaScript SDK package

Installation

npm install @tender-cash/js-sdk

Usage in React

Use TenderSdk as the primary component. TenderAgentSdk is still exported as a backward-compatible alias.
import { TenderSdk, onFinishResponse } from '@tender-cash/js-sdk';

function PaymentComponent() {
  const handleEventResponse = (response: onFinishResponse) => {
    console.log('SDK Response:', response);
  };

  return (
    <TenderSdk
      accessId="YOUR_ACCESS_ID"
      fiatCurrency="USD"
      env="test"
      onEventResponse={handleEventResponse}
      amount={150}
      referenceId="unique-payment-reference-123"
      paymentExpirySeconds={1800}
    />
  );
}
When referenceId and amount are provided, the modal auto-opens on component mount.

API Reference

Component Props (TenderAgentProps)

Applies to both TenderSdk and TenderAgentSdk.

Required Props

PropTypeDescription
accessIdstringYour Tender merchant Access ID.
fiatCurrencystringFiat code, e.g. "USD", "EUR", "NGN".
env"test" | "live" | "local"Target environment.

Optional Props

PropTypeDescription
onEventResponse(data: onFinishResponse) => voidCalled when payment state changes.
referenceIdstringPayment reference. Required for auto-open mode.
amountnumberPayment amount in fiat. Required for auto-open mode.
paymentExpirySecondsnumberPayment expiration in seconds.
theme"light" | "dark"Modal theme.
closeModal() => voidCallback fired when modal closes.

Ref Usage

import { useRef } from 'react';
import { TenderSdk, TenderRef } from '@tender-cash/js-sdk';

function PaymentComponent() {
  const tenderRef = useRef<TenderRef>(null);

  const openPayment = () => {
    tenderRef.current?.initiatePayment({
      amount: 150,
      referenceId: `order-${Date.now()}`,
      paymentExpirySeconds: 1800
    });
  };

  const closePayment = () => {
    tenderRef.current?.dismiss();
  };

  return (
    <>
      <button onClick={openPayment}>Open Payment</button>
      <button onClick={closePayment}>Close Modal</button>
      <TenderSdk ref={tenderRef} accessId="YOUR_ACCESS_ID" fiatCurrency="USD" env="test" />
    </>
  );
}

Ref Methods (TenderRef)

MethodDescription
initiatePaymentOpens modal and starts payment with provided parameters.
dismissCloses the modal.

Callback Data (onFinishResponse)

interface onFinishResponse {
  status: "partial-payment" | "completed" | "overpayment" | "pending" | "error" | "cancelled";
  message: string;
  data: IPaymentData | undefined;
}

Features

  • Shadow DOM style isolation
  • Auto-open mode from props
  • Programmatic control with refs
  • TypeScript support
  • Works across desktop and mobile

Next Steps

API Reference

Explore the full API documentation

Webhooks

Set up webhook notifications

GitHub

View source repositories

Support

Contact our support team