SomPayKit

Payment status

Waiting for PIN, awaiting confirmation, paid, failed and expired screens, plus a status badge.

Live preview

Install

npx shadcn@latest add https://sompaykit.aoubak.com/r/payment-status.json

Usage

Pair PaymentStatusCard with usePaymentStatus():

'use client';

import { usePaymentStatus } from '@sompaykit/react';
import { PaymentStatusCard } from '@/components/sompaykit/payment-status';

export function OrderStatus({ referenceId }: { referenceId: string }) {
  const { status, errorCode, requestError } = usePaymentStatus(referenceId, {
    check: '/api/pay/status',
  });

  return (
    <PaymentStatusCard
      status={status}
      errorCode={errorCode}
      requestError={requestError}
      amount={18}
      currency="USD"
      wallet="evc"
      locale="so"
      onRetry={() => location.reload()}
    />
  );
}

Every state has an icon, a title and text, never color alone. Green means paid and nothing else. While checks fail (weak signal), the card shows a gentle notice and polling continues.

PaymentStatusBadge is the small pill on its own, for order tables:

import { PaymentStatusBadge } from '@/components/sompaykit/payment-status';

<PaymentStatusBadge status="awaiting_confirmation" locale="en" />;

Props

PaymentStatusCard

PropTypeDefault
statusPaymentStatus | null—Null shows "Checking your payment…".
errorCodeErrorCode | nullnullWhy it failed.
requestErrorErrorCode | nullnullShows the weak-connection notice.
amountnumber—
currency'USD' | 'SLSH''USD'
walletWallet—
phonestring—Shown as +252 61 234 5678.
expiresAtnumber | Date—While pending: shows a countdown.
locale'so' | 'en' | 'ar''so'
onRetry() => void—"Try again" when failed or expired.
onChangeWallet() => void—"Use another wallet" when failed or expired.
childrenReactNode—Extra content, e.g. order details.
classNamestring—

PaymentStatusBadge

PropTypeDefault
statusPaymentStatus—
locale'so' | 'en' | 'ar''so'
classNamestring—