UNPKG

@spot-flow/checkout-inline-js

Version:

This project is an inline library that enables users to make payments seamlessly. It integrates smoothly into your application, providing a streamlined checkout experience.

219 lines (218 loc) 5.01 kB
export type Prettify<T> = { [K in keyof T]: T[K]; } & {}; export type CardDetailValueType = { pan: string; cvv: string; expiryMonth: string; expiryYear: string; cardHolderName?: string; }; export type PaymentRequestPayload = { amount: number; channel?: string; currency: string; localCurrency?: string; customer: { email?: string; name?: string; phoneNumber?: string; }; reference: string; planId?: string; callBackUrl?: string; metadata?: Record<string, unknown>; isCheckout: boolean; taxQuoteId?: string; countryCode?: string; }; export type CardDetails = { pan: string; cvv: string; expiryMonth: string; expiryYear: string; }; export type CardPaymentRequestPayload = Prettify<PaymentRequestPayload & { card?: CardDetails; encryptedCard: string; }>; export type UssdPaymentRequestPayload = Prettify<PaymentRequestPayload & { bank: Partial<{ code: string; name: string; }>; }>; export type MobileMoneyPaymentRequestPayload = Prettify<PaymentRequestPayload & { mobileMoney: Partial<{ code: string; name: string; phoneNumber: string; otp?: string; }>; }>; export type AuthorizeCardPaymentRequestPayload = { authorization: { pin?: string; otp?: string; phoneNumber?: string; avs?: { state: string; city: string; country: string; address: string; zipCode: string; }; }; reference: string; }; export type ValidateCardPaymentRequestPayload = { authorization: { otp?: string; phoneNumber?: string; pin?: string; avs?: { state: string; city: string; country: string; address: string; zipCode: string; }; }; reference: string; }; export type PaymentResponseData = { id: string; reference: string; callBackUrl?: string; spotflowReference: string; amount: number; currency: string; channel: string; status: string; bankDetails?: BankDetails; customer: Customer; provider: string; providerMessage: string; authorization: Authorization; createdAt: Date; localAmount: number; localCurrency: string; rate: number; region: string; card: { type: string; firstSix: string; lastFour: string; }; ussd: { code: string; paymentCode: string; }; totalLocalAmount?: number; totalTaxAmount?: number; }; export interface Authorization { mode: string; redirectUrl?: string | null; embeddedHtml?: string | null; } export interface BankDetails { accountName: string; accountNumber: string; bankName: string; } export interface Customer { id: string; name: string; email: string; phoneNumber: string; } export type GetPaymentRateParams = { to: string; from: string; }; export interface Rate { from: string; to: string; rate: number; } export type BankOption = { name: string; code: string; }; export type PlanDetailResponseData = { id: string; title: string; frequency: "MONTHLY" | "Daily" | "YEARLY" | "WEEKLY"; internalReference: string; status: "active" | "inactive"; createdAt: Date; regions: string; pricingOptions: Array<{ amount: number; currency: string; }>; subscribers: number; subscriptions: number; }; export type GetMerchantPlanDetail = { merchantName: string; merchantLogo: string; paymentMethods: Array<PaymentChannel>; rate: { from: string; to: string; rate: number; }; plan: PlanDetailResponseData; limits: Array<{ channel: PaymentChannel; amount: number; }>; taxEnabled: boolean; }; export type GetBanksRequestParams = { ussd: boolean; }; export type GetBanksResponse = Array<{ code: string; name: string; }>; export type GetMobileMoneyResponse = Array<{ code: string; name: string; phoneNumber: string; }>; export type CreateDisputeRequest = { transactionReference: string; reportingReason: string; disputeType?: string; disputeSource: string; supportingDocuments: string[]; }; export type RetryPaymentPayload = { reference: string; channel: string; encryptedCard?: string; mobileMoney?: { code: string; phoneNumber: string; }; }; export type PusherResponse = { amount: string; currency: string; redirectUrl: string; reference: string; spotflowReference: string; status: string; }; export type PaymentChannel = "card" | "bank_transfer" | "ussd" | "mobile_money" | "eft"; export type TaxQuoteResponse = { id: string; totalAmount: number; }; export type GetMerchantDetailsTax = GetMerchantPlanDetail & { totalAmount?: number; taxQuoteId?: string; };