Skip to main content

Schemas

Transaction

type Transaction = {
id: string;
amount: number;
refundAmount: number | undefined;
refundableAmount: number;
currency: string; // USD, EUR, etc.
status: TransactionStatus;
result: TransactionResult;
combinedStatus: TransactionResultStatusCombined | undefined;
customer: Customer;
date: Date;
type: TransactionType;
paymentType: 'one-time-payment' | 'subscription-payment';
paymentInstrument: PaymentInstrument | null;
invoices: {
id: string;
amount: number;
currency: CurrencyCode;
date: Date;
}[];
gatewayName: string;
gatewaySlug: string | null;
subscriptionId: string | undefined;
paymentLink: string | undefined;
approvalLink: string | undefined;
permissionBundle: {
isRefundable: boolean;
};
isProcessedOutside: boolean;
refundedAt: Date | undefined;
};

TransactionStatus

type TransactionStatus =
| 'completed'
| 'refunded'
| 'voided'
| 'partially-refunded'
| 'waiting'
| 'timeout'
| 'not-sent'
| 'disputed'
| 'sending'
| 'offsite'
| 'suspended';

TransactionResult

type TransactionResult =
| 'abandoned'
| 'approved'
| 'canceled'
| 'declined'
| 'unknown';

TransactionResultStatusCombined

type TransactionResultStatusCombined = TransactionStatus | 'abandoned';

Customer

type Customer = {
id: string;
name: string;
firstName: string | undefined;
lastName: string | undefined;
email: string | undefined;
phoneNumber: string | undefined;
origin: string | undefined;
language: string | undefined;
organization: string | undefined;
address: {
country: string | undefined;
address1: string | undefined;
address2: string | undefined;
city: string | undefined;
region: string | undefined;
zip: string | undefined;
};
lifetimeRevenue: {
currency: CurrencyCode;
amount: number;
amountUSD: number;
};
averageValue: {
currency: CurrencyCode;
amount: number;
amountUSD: number;
};
};

TranscationType

type TransactionType =
| '3ds-authentication'
| 'authorize'
| 'capture'
| 'credit'
| 'refund'
| 'sale'
| 'void';

PaymentInstrument

type PaymentInstrument = {
id: string;
createdAt: Date;
updatedAt: Date;
deletedAt: Date;
type: PaymentMethodEnum;
billingAddress: {
firstName: string;
lastName: string;
country: string | undefined;
address1: string | undefined;
address2: string | undefined;
city: string | undefined;
zip: string | undefined;
};
bankAccount: {
bankName: string;
lastFourDigits: string;
} | null;
creditCard: {
creditCardLastFourDigits: string;
brand: CreditCardEnum;
expireYear: number;
expireMonth: number;
expireDate: string | undefined;
stickyGatewaySlug: SupportedGatewaySlugEnum;
} | null;
};

CreditCardEnum

type CreditCardEnum =
| 'Visa'
| 'MasterCard'
| 'American-Express'
| 'Discover'
| 'Maestro'
| 'Solo'
| 'Electron'
| 'JCB'
| 'Voyager'
| 'Diners-Club'
| 'Switch'
| 'Laser'
| 'China-UnionPay'
| 'AstroPay-Card';

SupportedGatewaySlugEnum

type SupportedGatewaySlugEnum =
| 'default'
| 'paypal'
| 'klarna'
| 'coinbase'
| 'nmi'
| 'stripe';

PaymentMethodEnum

type PaymentMethodEnum =
| 'payment-card'
| 'ach'
| 'cash'
| 'check'
| 'paypal'
| 'AdvCash'
| 'Airpay'
| 'Alfa|click'
| 'Alipay'
| 'Apple Pay'
| 'AstroPay Card'
| 'AstroPay-GO'
| 'bank-transfer'
| 'bank-transfer-2'
| 'bank-transfer-3'
| 'bank-transfer-4'
| 'bank-transfer-5'
| 'bank-transfer-6'
| 'bank-transfer-7'
| 'bank-transfer-8'
| 'bank-transfer-9'
| 'Beeline'
| 'Belfius-direct-net'
| 'bitcoin'
| 'Boleto'
| 'Boleto-2'
| 'Boleto-3'
| 'cash-deposit'
| 'CASHlib'
| 'CashToCode'
| 'CCAvenue'
| 'China UnionPay'
| 'CODVoucher'
| 'Conekta-oxxo'
| 'Conekta-spei'
| 'cryptocurrency'
| 'Cupon-de-pagos'
| 'CyberSource'
| 'domestic-cards'
| 'echeck'
| 'ecoPayz'
| 'ecoVoucher'
| 'EPS'
| 'ePay.bg'
| 'Ethereum'
| 'e-wallet'
| 'ezyEFT'
| 'eZeeWallet'
| 'Flexepin'
| 'Giropay'
| 'GooglePay'
| 'Gpaysafe'
| 'iDebit'
| 'iDEAL'
| 'ING-homepay'
| 'INOVAPAY-pin'
| 'INOVAPAY-wallet'
| 'InstaDebit'
| 'instant-bank-transfer'
| 'Interac-online'
| 'Interac-eTransfer'
| 'Interac-express-connect'
| 'Interac'
| 'invoice'
| 'iWallet'
| 'Jeton'
| 'jpay'
| 'Khelocard'
| 'Klarna'
| 'Litecoin'
| 'loonie'
| 'LPG-online'
| 'LPG-payment-card'
| 'Megafon'
| 'MiFinity-eWallet'
| 'miscellaneous'
| 'Bancontact'
| 'MTS'
| 'MuchBetter'
| 'MyFatoorah'
| 'Neosurf'
| 'Netbanking'
| 'Neteller'
| 'Nordea-Solo'
| 'OchaPay'
| 'online-bank-transfer'
| 'Onlineueberweisen'
| 'oriental-wallet'
| 'OXXO'
| 'PagoEffectivo'
| 'Pagsmile-lottery'
| 'Pagsmile-deposit-express'
| 'PayCash'
| 'Payeer'
| 'PaymentAsia-crypto'
| 'Paysafecard'
| 'PayTabs'
| 'Pay4Fun'
| 'Paymero'
| 'Paymero-QR'
| 'PayULatam'
| 'Perfect-money'
| 'Piastrix'
| 'PIX'
| 'PinPay'
| 'phone'
| 'PhonePe'
| 'POLi'
| 'PostFinance-card'
| 'PostFinance-e-finance'
| 'Przelewy24'
| 'QIWI'
| 'QQPay'
| 'Resurs'
| 'SEPA'
| 'Siirto'
| 'Skrill'
| 'Skrill Rapid Transfer'
| 'SMSVoucher'
| 'Sofort'
| 'SparkPay'
| 'swift-dbt'
| 'Tele2'
| 'Terminaly-RF'
| 'Tether'
| 'ToditoCash-card'
| 'Trustly'
| 'TWINT'
| 'UniCrypt'
| 'UPayCard'
| 'UPI'
| 'VCreditos'
| 'VenusPoint'
| 'voucher'
| 'voucher-2'
| 'voucher-3'
| 'voucher-4'
| 'Webmoney'
| 'Webpay'
| 'Webpay-2'
| 'Webpay Card'
| 'WeChat Pay'
| 'XPay-P2P'
| 'XPay-QR'
| 'Yandex-money'
| 'Zotapay'
| 'Zimpler';

CurrencyCode

type CurrencyCode =
| 'AED'
| 'AFN'
| 'ALL'
| 'AMD'
| 'ANG'
| 'AOA'
| 'ARS'
| 'AUD'
| 'AWG'
| 'AZN'
| 'BAM'
| 'BBD'
| 'BDT'
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| 'UZS'
| 'VES'
| 'VND'
| 'VUV'
| 'WST'
| 'XAF'
| 'XCD'
| 'XOF'
| 'XPF'
| 'YER'
| 'ZAR'
| 'ZMW'
| 'ZWL';

Subscription

type Subscription = {
id: string;
name: string;
price: number;
status: SubscriptionStatus;
items: SubscriptionItems[];
plan_id: string;
currency: CurrencyCode;
customer: Customer;
created_at: Date;
deleted_at: Date;
order_type: 'subscription-order' | 'one-time-order';
product_id: string;
updated_at: Date;
is_auto_pay: boolean;
next_charge: Date;
billing_cycle: {
unit: 'days' | 'weeks' | 'months' | 'years';
length: number;
};
is_trial_only: boolean;
organization_id: string;
};
type SubscriptionStatus = 'pending' |
| 'active'
| 'canceled'
| 'churned'
| 'suspended'
| 'paused'
| 'unpaid'
| 'trial-ended'
| 'voided'
type SubscriptionItems = {
price: number;
planId: string;
formula: 'fixed-fee' | 'flat-rate' | 'stair-step' | 'tiered' | 'volume';
currency: CurrencyCode;
planName: string;
quantity: number;
billingCycle: {
unit: 'days' | 'weeks' | 'months' | 'years';
length: number;
};
};