import {z} from 'zod' export type Currency = 'AED' | 'AFN' | 'ALL' | 'AMD' | 'ANG' | 'AOA' | 'ARS' | 'AUD' | 'AWG' | 'AZN' | 'BAM' | 'BBD' | 'BDT' | 'BGN' | 'BHD' | 'BIF' | 'BMD' | 'BND' | 'BOB' | 'BRL' | 'BSD' | 'BTN' | 'BWP' | 'BYN' | 'BZD' | 'CAD' | 'CDF' | 'CHF' | 'CLF' | 'CLP' | 'CNY' | 'COP' | 'CRC' | 'CUC' | 'CUP' | 'CVE' | 'CZK' | 'DJF' | 'DKK' | 'DOP' | 'DZD' | 'EGP' | 'ERN' | 'ETB' | 'EUR' | 'FJD' | 'FKP' | 'GBP' | 'GEL' | 'GHS' | 'GIP' | 'GMD' | 'GNF' | 'GTQ' | 'GYD' | 'HKD' | 'HNL' | 'HRK' | 'HTG' | 'HUF' | 'IDR' | 'ILS' | 'INR' | 'IQD' | 'IRR' | 'ISK' | 'JMD' | 'JOD' | 'JPY' | 'KES' | 'KGS' | 'KHR' | 'KMF' | 'KPW' | 'KRW' | 'KWD' | 'KYD' | 'KZT' | 'LAK' | 'LBP' | 'LKR' | 'LRD' | 'LSL' | 'LYD' | 'MAD' | 'MDL' | 'MGA' | 'MKD' | 'MMK' | 'MNT' | 'MOP' | 'MRU' | 'MUR' | 'MVR' | 'MWK' | 'MXN' | 'MYR' | 'MZN' | 'NAD' | 'NGN' | 'NIO' | 'NOK' | 'NPR' | 'NZD' | 'OMR' | 'PAB' | 'PEN' | 'PGK' | 'PHP' | 'PKR' | 'PLN' | 'PYG' | 'QAR' | 'RON' | 'RSD' | 'RUB' | 'RWF' | 'SAR' | 'SBD' | 'SCR' | 'SDG' | 'SEK' | 'SGD' | 'SHP' | 'SLE' | 'SLL' | 'SOS' | 'SRD' | 'SSP' | 'STD' | 'STN' | 'SVC' | 'SYP' | 'SZL' | 'THB' | 'TJS' | 'TMT' | 'TND' | 'TOP' | 'TRY' | 'TTD' | 'TWD' | 'TZS' | 'UAH' | 'UGX' | 'USD' | 'UYU' | 'UZS' | 'VES' | 'VND' | 'VUV' | 'WST' | 'XAF' | 'XCD' | 'XOF' | 'XPF' | 'YER' | 'ZAR' | 'ZMW' | 'ZWL'; export type RoutableConnectors = 'absa_sanlam' | 'authipay' | 'adyenplatform' | 'stripe_billing_test' | 'phonypay' | 'fauxpay' | 'pretendpay' | 'stripe_test' | 'adyen_test' | 'checkout_test' | 'paypal_test' | 'aci' | 'adyen' | 'affirm' | 'airwallex' | 'amazonpay' | 'archipel' | 'authorizedotnet' | 'bankofamerica' | 'barclaycard' | 'billwerk' | 'bitpay' | 'bambora' | 'blackhawknetwork' | 'bamboraapac' | 'bluesnap' | 'calida' | 'boku' | 'braintree' | 'breadpay' | 'cashtocode' | 'celero' | 'chargebee' | 'custombilling' | 'checkbook' | 'checkout' | 'coinbase' | 'coingate' | 'cryptopay' | 'cybersource' | 'cybersourcedecisionmanager' | 'datatrans' | 'deutschebank' | 'digitalvirgo' | 'dlocal' | 'dwolla' | 'ebanx' | 'elavon' | 'envoy' | 'facilitapay' | 'finix' | 'fiserv' | 'fiservemea' | 'fiservcommercehub' | 'fiuu' | 'flexiti' | 'forte' | 'getnet' | 'gigadat' | 'givepayments' | 'globalpay' | 'globepay' | 'gocardless' | 'hipay' | 'helcim' | 'hyperpg' | 'iatapay' | 'imerchantsolutions' | 'inespay' | 'interpayments' | 'itaubank' | 'jpmorgan' | 'klarna' | 'loonio' | 'mifinity' | 'mollie' | 'moneris' | 'multisafepay' | 'nexinets' | 'nexixpay' | 'nmi' | 'nomupay' | 'noon' | 'nordea' | 'novalnet' | 'nuvei' | 'opennode' | 'paybox' | 'payme' | 'payload' | 'payone' | 'paypal' | 'paysafe' | 'paystack' | 'paytm' | 'payconex' | 'payu' | 'peachpayments' | 'payjustnow' | 'payjustnowinstore' | 'phonepe' | 'placetopay' | 'powertranz' | 'prophetpay' | 'rapyd' | 'razorpay' | 'recurly' | 'redsys' | 'revolv3' | 'riskified' | 'santander' | 'shift4' | 'signifyd' | 'silverflow' | 'square' | 'stax' | 'stripe' | 'stripebilling' | 'tesouro' | 'truelayer' | 'trustly' | 'trustpay' | 'trustpayments' | 'tokenio' | 'tsys' | 'tsys_transit' | 'volt' | 'wellsfargo' | 'wise' | 'worldline' | 'worldpay' | 'worldpaymodular' | 'worldpayvantiv' | 'worldpayxml' | 'xendit' | 'zen' | 'zift' | 'plaid' | 'zsl' | 'juspaythreedsserver' | 'ctp_mastercard' | 'ctp_visa' | 'netcetera' | 'cardinal' | 'threedsecureio'; export type RoutableConnectorChoice = {connector: RoutableConnectors, merchant_connector_id?: (string | null) | undefined}; export type ConnectorVolumeSplit = {connector: RoutableConnectorChoice, split: number}; export type ConnectorSelection = {type: 'priority', data: Array} | {type: 'volume_split', data: Array}; export type RuleConnectorSelection = Record; export type ProgramConnectorSelection = {defaultSelection: ConnectorSelection, rules: RuleConnectorSelection, metadata: {[key: string]: unknown}}; export type ThreeDSDecisionRule = unknown; export type RuleThreeDsDecisionRule = unknown; export type ProgramThreeDsDecisionRule = {defaultSelection: ThreeDSDecisionRule, rules: RuleThreeDsDecisionRule, metadata: {[key: string]: unknown}}; export type StaticRoutingAlgorithm = {type: 'single', data: RoutableConnectorChoice} | {type: 'priority', data: Array} | {type: 'volume_split', data: Array} | {type: 'advanced', data: ProgramConnectorSelection} | {type: 'three_ds_decision_rule', data: ProgramThreeDsDecisionRule}; export type PayoutConnectors = 'adyen' | 'adyenplatform' | 'cybersource' | 'ebanx' | 'gigadat' | 'loonio' | 'nomupay' | 'nuvei' | 'payone' | 'paypal' | 'stripe' | 'truelayer' | 'trustly' | 'wise' | 'worldpay' | 'worldpayxml' | 'envoy' | 'itaubank'; export type PayoutType = 'card' | 'bank' | 'wallet' | 'bank_redirect'; export type CardNetwork = 'Visa' | 'Mastercard' | 'AmericanExpress' | 'JCB' | 'DinersClub' | 'Discover' | 'CartesBancaires' | 'UnionPay' | 'Interac' | 'RuPay' | 'Maestro' | 'Star' | 'Pulse' | 'Accel' | 'Nyce' | 'Prop' | 'PrivateLabel' | 'Dinacard'; export type CardPayout = {card_number: string, expiry_month: string, expiry_year: string, card_holder_name: string, card_network?: (CardNetwork | null) | undefined}; export type CountryAlpha2 = 'AF' | 'AX' | 'AL' | 'DZ' | 'AS' | 'AD' | 'AO' | 'AI' | 'AQ' | 'AG' | 'AR' | 'AM' | 'AW' | 'AU' | 'AT' | 'AZ' | 'BS' | 'BH' | 'BD' | 'BB' | 'BY' | 'BE' | 'BZ' | 'BJ' | 'BM' | 'BT' | 'BO' | 'BQ' | 'BA' | 'BW' | 'BV' | 'BR' | 'IO' | 'BN' | 'BG' | 'BF' | 'BI' | 'KH' | 'CM' | 'CA' | 'CV' | 'KY' | 'CF' | 'TD' | 'CL' | 'CN' | 'CX' | 'CC' | 'CO' | 'KM' | 'CG' | 'CD' | 'CK' | 'CR' | 'CI' | 'HR' | 'CU' | 'CW' | 'CY' | 'CZ' | 'DK' | 'DJ' | 'DM' | 'DO' | 'EC' | 'EG' | 'SV' | 'GQ' | 'ER' | 'EE' | 'ET' | 'FK' | 'FO' | 'FJ' | 'FI' | 'FR' | 'GF' | 'PF' | 'TF' | 'GA' | 'GM' | 'GE' | 'DE' | 'GH' | 'GI' | 'GR' | 'GL' | 'GD' | 'GP' | 'GU' | 'GT' | 'GG' | 'GN' | 'GW' | 'GY' | 'HT' | 'HM' | 'VA' | 'HN' | 'HK' | 'HU' | 'IS' | 'IN' | 'ID' | 'IR' | 'IQ' | 'IE' | 'IM' | 'IL' | 'IT' | 'JM' | 'JP' | 'JE' | 'JO' | 'KZ' | 'KE' | 'KI' | 'KP' | 'KR' | 'KW' | 'KG' | 'LA' | 'LV' | 'LB' | 'LS' | 'LR' | 'LY' | 'LI' | 'LT' | 'LU' | 'MO' | 'MK' | 'MG' | 'MW' | 'MY' | 'MV' | 'ML' | 'MT' | 'MH' | 'MQ' | 'MR' | 'MU' | 'YT' | 'MX' | 'FM' | 'MD' | 'MC' | 'MN' | 'ME' | 'MS' | 'MA' | 'MZ' | 'MM' | 'NA' | 'NR' | 'NP' | 'NL' | 'NC' | 'NZ' | 'NI' | 'NE' | 'NG' | 'NU' | 'NF' | 'MP' | 'NO' | 'OM' | 'PK' | 'PW' | 'PS' | 'PA' | 'PG' | 'PY' | 'PE' | 'PH' | 'PN' | 'PL' | 'PT' | 'PR' | 'QA' | 'RE' | 'RO' | 'RU' | 'RW' | 'BL' | 'SH' | 'KN' | 'LC' | 'MF' | 'PM' | 'VC' | 'WS' | 'SM' | 'ST' | 'SA' | 'SN' | 'RS' | 'SC' | 'SL' | 'SG' | 'SX' | 'SK' | 'SI' | 'SB' | 'SO' | 'ZA' | 'GS' | 'SS' | 'ES' | 'LK' | 'SD' | 'SR' | 'SJ' | 'SZ' | 'SE' | 'CH' | 'SY' | 'TW' | 'TJ' | 'TZ' | 'TH' | 'TL' | 'TG' | 'TK' | 'TO' | 'TT' | 'TN' | 'TR' | 'TM' | 'TC' | 'TV' | 'UG' | 'UA' | 'AE' | 'GB' | 'UM' | 'UY' | 'UZ' | 'VU' | 'VE' | 'VN' | 'VG' | 'VI' | 'WF' | 'EH' | 'YE' | 'ZM' | 'ZW' | 'US'; export type AchBankTransfer = {bank_name?: (string | null) | undefined, bank_country_code?: (CountryAlpha2 | null) | undefined, bank_city?: (string | null) | undefined, bank_account_number: string, bank_routing_number: string, account_holder_name?: (string | null) | undefined}; export type BacsBankTransfer = {bank_name?: (string | null) | undefined, bank_country_code?: (CountryAlpha2 | null) | undefined, bank_city?: (string | null) | undefined, bank_account_number: string, bank_sort_code: string, account_holder_name?: (string | null) | undefined}; export type TrustlyBankTransfer = {iban: string, country_code: CountryAlpha2, account_number: string, bank_number: string}; export type SepaBankTransfer = {bank_name?: (string | null) | undefined, bank_country_code?: (CountryAlpha2 | null) | undefined, bank_city?: (string | null) | undefined, iban: string, bic: string, account_holder_name?: (string | null) | undefined}; export type PixBankTransfer = {bank_name?: (string | null) | undefined, bank_branch?: (string | null) | undefined, bank_account_number: string, pix_key: string, tax_id?: (string | null) | undefined, emv: string, ispb?: (string | null) | undefined}; export type OpenBanking = {account_holder_name: string, iban: string}; export type Bank = AchBankTransfer | BacsBankTransfer | TrustlyBankTransfer | SepaBankTransfer | PixBankTransfer | OpenBanking; export type ApplePayDecrypt = {dpan: string, expiry_month: string, expiry_year: string, card_holder_name: string, card_network?: (CardNetwork | null) | undefined}; export type GooglePayDecrypt = {application_primary_account_number: string, expiry_month: string, expiry_year: string, card_holder_name: string, card_network?: (CardNetwork | null) | undefined}; export type Paypal = {email: string, telephone_number: string, paypal_id: string}; export type Venmo = {telephone_number: string}; export type Wallet = {apple_pay_decrypt: ApplePayDecrypt} | {google_pay_decrypt: GooglePayDecrypt} | {paypal: Paypal} | {venmo: Venmo}; export type Interac = unknown; export type OpenBankingUk = unknown; export type BankRedirect = {interac: Interac} | {open_banking_uk: OpenBankingUk}; export type PaymentMethodType = 'ach' | 'affirm' | 'afterpay_clearpay' | 'alfamart' | 'ali_pay' | 'ali_pay_hk' | 'alma' | 'amazon_pay' | 'paysera' | 'apple_pay' | 'atome' | 'bacs' | 'bancontact_card' | 'becs' | 'benefit' | 'bizum' | 'blik' | 'bluecode' | 'boleto' | 'bca_bank_transfer' | 'bni_va' | 'breadpay' | 'bri_va' | 'bhn_card_network' | 'card_redirect' | 'cimb_va' | 'classic' | 'credit' | 'crypto_currency' | 'cashapp' | 'dana' | 'danamon_va' | 'debit' | 'duit_now' | 'efecty' | 'eft' | 'eft_debit_order' | 'eps' | 'flexiti' | 'fps' | 'evoucher' | 'giropay' | 'givex' | 'google_pay' | 'go_pay' | 'gcash' | 'ideal' | 'interac' | 'indomaret' | 'klarna' | 'kakao_pay' | 'local_bank_redirect' | 'mandiri_va' | 'knet' | 'mb_way' | 'mobile_pay' | 'momo' | 'momo_atm' | 'multibanco' | 'online_banking_thailand' | 'online_banking_czech_republic' | 'online_banking_finland' | 'online_banking_fpx' | 'online_banking_poland' | 'online_banking_slovakia' | 'oxxo' | 'pago_efectivo' | 'permata_bank_transfer' | 'open_banking_uk' | 'pay_bright' | 'payjustnow' | 'paypal' | 'paze' | 'pix' | 'pix_key' | 'pix_emv' | 'pix_qr' | 'pix_automatico_qr' | 'pix_automatico_push' | 'pay_safe_card' | 'przelewy24' | 'prompt_pay' | 'pse' | 'qris' | 'red_compra' | 'red_pagos' | 'samsung_pay' | 'sepa' | 'sepa_bank_transfer' | 'sepa_guarenteed_debit' | 'skrill' | 'sofort' | 'swish' | 'touch_n_go' | 'trustly' | 'twint' | 'upi_collect' | 'upi_intent' | 'upi_qr' | 'vipps' | 'viet_qr' | 'venmo' | 'walley' | 'we_chat_pay' | 'seven_eleven' | 'lawson' | 'mini_stop' | 'family_mart' | 'seicomart' | 'pay_easy' | 'local_bank_transfer' | 'mifinity' | 'open_banking_pis' | 'direct_carrier_billing' | 'instant_bank_transfer' | 'instant_bank_transfer_finland' | 'instant_bank_transfer_poland' | 'revolut_pay' | 'indonesian_bank_transfer' | 'open_banking' | 'network_token'; export type Passthrough = {psp_token: string, psp_customer_id: string, token_type: PaymentMethodType}; export type BankTransfer = {bank_name?: (string | null) | undefined, bank_country_code?: (CountryAlpha2 | null) | undefined, bank_city?: (string | null) | undefined, bank_account_number: string, bank_routing_number: string, account_holder_name?: (string | null) | undefined, payout_method_type: 'ach'} | {bank_name?: (string | null) | undefined, bank_country_code?: (CountryAlpha2 | null) | undefined, bank_city?: (string | null) | undefined, bank_account_number: string, bank_sort_code: string, account_holder_name?: (string | null) | undefined, payout_method_type: 'bacs'} | {bank_name?: (string | null) | undefined, bank_country_code?: (CountryAlpha2 | null) | undefined, bank_city?: (string | null) | undefined, iban: string, bic: string, account_holder_name?: (string | null) | undefined, payout_method_type: 'sepa'} | {bank_name?: (string | null) | undefined, bank_branch?: (string | null) | undefined, bank_account_number: string, tax_id?: (string | null) | undefined, ispb?: (string | null) | undefined, payout_method_type: 'pix'} | {pix_key: string, payout_method_type: 'pix_key'} | {emv: string, payout_method_type: 'pix_emv'} | {iban: string, bank_country_code: CountryAlpha2, bank_account_number: string, bank_number: string, payout_method_type: 'trustly'} | {account_holder_name: string, iban: string, payout_method_type: 'open_banking'}; export type PayoutMethodData = {card: CardPayout} | {bank: Bank} | {wallet: Wallet} | {bank_redirect: BankRedirect} | {passthrough: Passthrough} | {bank_transfer: BankTransfer}; export type AddressDetails = {city?: (string | null) | undefined, country?: (CountryAlpha2 | null) | undefined, line1?: (string | null) | undefined, line2?: (string | null) | undefined, line3?: (string | null) | undefined, zip?: (string | null) | undefined, state?: (string | null) | undefined, first_name?: (string | null) | undefined, last_name?: (string | null) | undefined, origin_zip?: (string | null) | undefined}; export type PhoneDetails = {number?: (string | null) | undefined, country_code?: (string | null) | undefined}; export type Address = {address?: (AddressDetails | null) | undefined, phone?: (PhoneDetails | null) | undefined, email?: (string | null) | undefined}; export type DocumentKind = 'cpf' | 'cnpj' | 'psn' | 'other'; export type CustomerDocumentDetails = {document_type: DocumentKind, document_number: string}; export type CustomerDetails = {id?: (string | null) | undefined, name?: (string | null) | undefined, email?: (string | null) | undefined, phone?: (string | null) | undefined, phone_country_code?: (string | null) | undefined, tax_registration_id?: (string | null) | undefined, document_details?: (CustomerDocumentDetails | null) | undefined}; export type PayoutEntityType = 'Individual' | 'Company' | 'NonProfit' | 'PublicSector' | 'NaturalPerson' | 'lowercase' | 'Personal'; export type PayoutSendPriority = 'instant' | 'fast' | 'regular' | 'wire' | 'cross_border' | 'internal'; export type PaymentMethod = 'card' | 'card_redirect' | 'pay_later' | 'wallet' | 'bank_redirect' | 'bank_transfer' | 'crypto' | 'bank_debit' | 'reward' | 'real_time_payment' | 'upi' | 'voucher' | 'gift_card' | 'open_banking' | 'mobile_payment' | 'network_token'; export type EnabledPaymentMethod = {payment_method: PaymentMethod, payment_method_types: Array}; export type UIWidgetFormLayout = 'tabs' | 'journey'; export type PayoutCreatePayoutLinkConfig = {logo?: (string | null) | undefined, merchant_name?: (string | null) | undefined, theme?: (string | null) | undefined, payout_link_id?: (string | null) | undefined, enabled_payment_methods?: (Array | null) | undefined, form_layout?: (UIWidgetFormLayout | null) | undefined, test_mode?: (boolean | null) | undefined} | null; export type BrowserInformation = {color_depth?: (number | null) | undefined, java_enabled?: (boolean | null) | undefined, java_script_enabled?: (boolean | null) | undefined, language?: (string | null) | undefined, screen_height?: (number | null) | undefined, screen_width?: (number | null) | undefined, time_zone?: (number | null) | undefined, ip_address?: (string | null) | undefined, accept_header?: (string | null) | undefined, user_agent?: (string | null) | undefined, os_type?: (string | null) | undefined, os_version?: (string | null) | undefined, device_model?: (string | null) | undefined, accept_language?: (string | null) | undefined, referer?: (string | null) | undefined}; export type PayoutsCreateRequest = {merchant_order_reference_id?: (string | null) | undefined, amount: number, currency: Currency, routing?: (StaticRoutingAlgorithm | null) | undefined, connector?: (Array | null) | undefined, confirm?: (boolean | null) | undefined, payout_type?: (PayoutType | null) | undefined, payout_method_data?: (PayoutMethodData | null) | undefined, source_bank_data?: (BankTransfer | null) | undefined, billing?: (Address | null) | undefined, auto_fulfill?: (boolean | null) | undefined, customer_id?: (string | null) | undefined, customer?: (CustomerDetails | null) | undefined, return_url?: (string | null) | undefined, business_country?: (CountryAlpha2 | null) | undefined, business_label?: (string | null) | undefined, description?: (string | null) | undefined, entity_type?: (PayoutEntityType | null) | undefined, recurring?: (boolean | null) | undefined, metadata?: (Record | null) | undefined, payout_token?: (string | null) | undefined, profile_id?: (string | null) | undefined, priority?: (PayoutSendPriority | null) | undefined, payout_link?: (boolean | null) | undefined, payout_link_config?: (PayoutCreatePayoutLinkConfig | null) | undefined, session_expiry?: (number | null) | undefined, email?: (string | null) | undefined, name?: (string | null) | undefined, phone?: (string | null) | undefined, phone_country_code?: (string | null) | undefined, payout_method_id?: (string | null) | undefined, browser_info?: (BrowserInformation | null) | undefined}; export type CreateApiPayoutsCreateArgs = {body: PayoutsCreateRequest}; export type CreateApiPayoutsCreateOptions = {baseUrl: string, apiKey?: string | undefined, fetch?: typeof fetch | undefined}; export const currency = z.enum(["AED", "AFN", "ALL", "AMD", "ANG", "AOA", "ARS", "AUD", "AWG", "AZN", "BAM", "BBD", "BDT", "BGN", "BHD", "BIF", "BMD", "BND", "BOB", "BRL", "BSD", "BTN", "BWP", "BYN", "BZD", "CAD", "CDF", "CHF", "CLF", "CLP", "CNY", "COP", "CRC", "CUC", "CUP", "CVE", "CZK", "DJF", "DKK", "DOP", "DZD", "EGP", "ERN", "ETB", "EUR", "FJD", "FKP", "GBP", "GEL", "GHS", "GIP", "GMD", "GNF", "GTQ", "GYD", "HKD", "HNL", "HRK", "HTG", "HUF", "IDR", "ILS", "INR", "IQD", "IRR", "ISK", "JMD", "JOD", "JPY", "KES", "KGS", "KHR", "KMF", "KPW", "KRW", "KWD", "KYD", "KZT", "LAK", "LBP", "LKR", "LRD", "LSL", "LYD", "MAD", "MDL", "MGA", "MKD", "MMK", "MNT", "MOP", "MRU", "MUR", "MVR", "MWK", "MXN", "MYR", "MZN", "NAD", "NGN", "NIO", "NOK", "NPR", "NZD", "OMR", "PAB", "PEN", "PGK", "PHP", "PKR", "PLN", "PYG", "QAR", "RON", "RSD", "RUB", "RWF", "SAR", "SBD", "SCR", "SDG", "SEK", "SGD", "SHP", "SLE", "SLL", "SOS", "SRD", "SSP", "STD", "STN", "SVC", "SYP", "SZL", "THB", "TJS", "TMT", "TND", "TOP", "TRY", "TTD", "TWD", "TZS", "UAH", "UGX", "USD", "UYU", "UZS", "VES", "VND", "VUV", "WST", "XAF", "XCD", "XOF", "XPF", "YER", "ZAR", "ZMW", "ZWL"]); export const payoutType = z.enum(["card", "bank", "wallet", "bank_redirect"]); export const cardNetwork = z.enum(["Visa", "Mastercard", "AmericanExpress", "JCB", "DinersClub", "Discover", "CartesBancaires", "UnionPay", "Interac", "RuPay", "Maestro", "Star", "Pulse", "Accel", "Nyce", "Prop", "PrivateLabel", "Dinacard"]); export const cardAdditionalData = z.object({card_issuer: z.string().nullable().optional(), card_network: cardNetwork.nullable().optional(), card_type: z.string().nullable().optional(), card_issuing_country: z.string().nullable().optional(), bank_code: z.string().nullable().optional(), last4: z.string().nullable().optional(), card_isin: z.string().nullable().optional(), card_extended_bin: z.string().nullable().optional(), card_exp_month: z.string(), card_exp_year: z.string(), card_holder_name: z.string()}); export const bankNames = z.enum(["absa", "american_express", "affin_bank", "agro_bank", "alliance_bank", "am_bank", "bank_of_america", "bank_of_china", "bank_islam", "bank_muamalat", "bank_rakyat", "bank_simpanan_nasional", "barclays", "blik_p_s_p", "capital_one", "chase", "citi", "cimb_bank", "discover", "navy_federal_credit_union", "pentagon_federal_credit_union", "synchrony_bank", "wells_fargo", "abn_amro", "asn_bank", "bunq", "handelsbanken", "hong_leong_bank", "hsbc_bank", "ing", "knab", "kuwait_finance_house", "moneyou", "rabobank", "regiobank", "revolut", "sns_bank", "triodos_bank", "van_lanschot", "arzte_und_apotheker_bank", "austrian_anadi_bank_ag", "bank_austria", "bank99_ag", "bankhaus_carl_spangler", "bankhaus_schelhammer_und_schattera_ag", "bank_millennium", "bank_p_e_k_a_o_s_a", "bawag_psk_ag", "bks_bank_ag", "brull_kallmus_bank_ag", "btv_vier_lander_bank", "capital_bank_grawe_gruppe_ag", "ceska_sporitelna", "dolomitenbank", "easybank_ag", "e_platby_v_u_b", "erste_bank_und_sparkassen", "friesland_bank", "hypo_alpeadriabank_international_ag", "hypo_noe_lb_fur_niederosterreich_u_wien", "hypo_oberosterreich_salzburg_steiermark", "hypo_tirol_bank_ag", "hypo_vorarlberg_bank_ag", "hypo_bank_burgenland_aktiengesellschaft", "komercni_banka", "m_bank", "marchfelder_bank", "maybank", "oberbank_ag", "osterreichische_arzte_und_apothekerbank", "ocbc_bank", "pay_with_i_n_g", "place_z_i_p_k_o", "platnosc_online_karta_platnicza", "posojilnica_bank_e_gen", "postova_banka", "public_bank", "raiffeisen_bankengruppe_osterreich", "rhb_bank", "schelhammer_capital_bank_ag", "standard_chartered_bank", "schoellerbank_ag", "sparda_bank_wien", "sporo_pay", "santander_przelew24", "tatra_pay", "viamo", "volksbank_gruppe", "volkskreditbank_ag", "vr_bank_braunau", "uob_bank", "pay_with_alior_bank", "banki_spoldzielcze", "pay_with_inteligo", "b_n_p_paribas_poland", "bank_nowy_s_a", "credit_agricole", "pay_with_b_o_s", "pay_with_citi_handlowy", "pay_with_plus_bank", "toyota_bank", "velo_bank", "e_transfer_pocztowy24", "plus_bank", "etransfer_pocztowy24", "banki_spbdzielcze", "bank_nowy_bfg_sa", "getin_bank", "blik", "noble_pay", "idea_bank", "envelo_bank", "nest_przelew", "mbank_mtransfer", "inteligo", "pbac_z_ipko", "bnp_paribas", "bank_pekao_sa", "volkswagen_bank", "alior_bank", "boz", "bangkok_bank", "krungsri_bank", "krung_thai_bank", "the_siam_commercial_bank", "kasikorn_bank", "open_bank_success", "open_bank_failure", "open_bank_cancelled", "aib", "bank_of_scotland", "danske_bank", "first_direct", "first_trust", "halifax", "lloyds", "monzo", "nat_west", "nationwide_bank", "royal_bank_of_scotland", "starling", "tsb_bank", "tesco_bank", "ulster_bank", "yoursafe", "n26", "nationale_nederlanden"]); export const countryAlpha2 = z.enum(["AF", "AX", "AL", "DZ", "AS", "AD", "AO", "AI", "AQ", "AG", "AR", "AM", "AW", "AU", "AT", "AZ", "BS", "BH", "BD", "BB", "BY", "BE", "BZ", "BJ", "BM", "BT", "BO", "BQ", "BA", "BW", "BV", "BR", "IO", "BN", "BG", "BF", "BI", "KH", "CM", "CA", "CV", "KY", "CF", "TD", "CL", "CN", "CX", "CC", "CO", "KM", "CG", "CD", "CK", "CR", "CI", "HR", "CU", "CW", "CY", "CZ", "DK", "DJ", "DM", "DO", "EC", "EG", "SV", "GQ", "ER", "EE", "ET", "FK", "FO", "FJ", "FI", "FR", "GF", "PF", "TF", "GA", "GM", "GE", "DE", "GH", "GI", "GR", "GL", "GD", "GP", "GU", "GT", "GG", "GN", "GW", "GY", "HT", "HM", "VA", "HN", "HK", "HU", "IS", "IN", "ID", "IR", "IQ", "IE", "IM", "IL", "IT", "JM", "JP", "JE", "JO", "KZ", "KE", "KI", "KP", "KR", "KW", "KG", "LA", "LV", "LB", "LS", "LR", "LY", "LI", "LT", "LU", "MO", "MK", "MG", "MW", "MY", "MV", "ML", "MT", "MH", "MQ", "MR", "MU", "YT", "MX", "FM", "MD", "MC", "MN", "ME", "MS", "MA", "MZ", "MM", "NA", "NR", "NP", "NL", "NC", "NZ", "NI", "NE", "NG", "NU", "NF", "MP", "NO", "OM", "PK", "PW", "PS", "PA", "PG", "PY", "PE", "PH", "PN", "PL", "PT", "PR", "QA", "RE", "RO", "RU", "RW", "BL", "SH", "KN", "LC", "MF", "PM", "VC", "WS", "SM", "ST", "SA", "SN", "RS", "SC", "SL", "SG", "SX", "SK", "SI", "SB", "SO", "ZA", "GS", "SS", "ES", "LK", "SD", "SR", "SJ", "SZ", "SE", "CH", "SY", "TW", "TJ", "TZ", "TH", "TL", "TG", "TK", "TO", "TT", "TN", "TR", "TM", "TC", "TV", "UG", "UA", "AE", "GB", "UM", "UY", "UZ", "VU", "VE", "VN", "VG", "VI", "WF", "EH", "YE", "ZM", "ZW", "US"]); export const achBankTransferAdditionalData = z.object({bank_account_number: z.string(), bank_routing_number: z.string(), bank_name: bankNames.nullable().optional(), bank_country_code: countryAlpha2.nullable().optional(), bank_city: z.string().nullable().optional(), account_holder_name: z.string().nullable().optional()}); export const bacsBankTransferAdditionalData = z.object({bank_sort_code: z.string(), bank_account_number: z.string(), bank_name: z.string().nullable().optional(), bank_country_code: countryAlpha2.nullable().optional(), bank_city: z.string().nullable().optional(), account_holder_name: z.string().nullable().optional()}); export const trustlyBankTransferAdditionalData = z.object({iban: z.string(), country_code: countryAlpha2, account_number: z.string(), bank_number: z.string()}); export const sepaBankTransferAdditionalData = z.object({iban: z.string(), bank_name: z.string().nullable().optional(), bank_country_code: countryAlpha2.nullable().optional(), bank_city: z.string().nullable().optional(), bic: z.string().nullable().optional(), account_holder_name: z.string().nullable().optional()}); export const pixBankTransferAdditionalData = z.object({pix_key: z.string().nullable().optional(), cpf: z.string().nullable().optional(), cnpj: z.string().nullable().optional(), source_bank_account_id: z.string().nullable().optional(), destination_bank_account_id: z.string().nullable().optional(), expiry_date: z.string().nullable().optional()}); export const openBankingAdditionalData = z.object({account_holder_name: z.string(), iban: z.string()}); export const bankAdditionalData = z.union([achBankTransferAdditionalData, bacsBankTransferAdditionalData, trustlyBankTransferAdditionalData, sepaBankTransferAdditionalData, pixBankTransferAdditionalData, openBankingAdditionalData]); export const applePayDecryptAdditionalData = z.object({card_exp_month: z.string(), card_exp_year: z.string(), card_holder_name: z.string()}); export const googlePayDecryptAdditionalData = z.object({card_exp_month: z.string(), card_exp_year: z.string(), card_holder_name: z.string()}); export const paypalAdditionalData = z.discriminatedUnion("field_type", [z.object({email: z.string(), field_type: z.literal("email")}), z.object({paypal_id: z.string(), field_type: z.literal("paypal_id")}), z.object({telephone_number: z.string().nullable().optional(), field_type: z.literal("telephone_number")})]); export const venmoAdditionalData = z.object({telephone_number: z.string().nullable().optional()}); export const walletAdditionalData = z.union([applePayDecryptAdditionalData, googlePayDecryptAdditionalData, paypalAdditionalData, venmoAdditionalData]); export const openBankingUkAdditionalData = z.object({account_holder_name: z.string(), iban: z.string()}); export const interacAdditionalData = z.object({email: z.string().nullable().optional()}); export const bankRedirectAdditionalData = z.union([openBankingUkAdditionalData, interacAdditionalData]); export const paymentMethodType = z.enum(["ach", "affirm", "afterpay_clearpay", "alfamart", "ali_pay", "ali_pay_hk", "alma", "amazon_pay", "paysera", "apple_pay", "atome", "bacs", "bancontact_card", "becs", "benefit", "bizum", "blik", "bluecode", "boleto", "bca_bank_transfer", "bni_va", "breadpay", "bri_va", "bhn_card_network", "card_redirect", "cimb_va", "classic", "credit", "crypto_currency", "cashapp", "dana", "danamon_va", "debit", "duit_now", "efecty", "eft", "eft_debit_order", "eps", "flexiti", "fps", "evoucher", "giropay", "givex", "google_pay", "go_pay", "gcash", "ideal", "interac", "indomaret", "klarna", "kakao_pay", "local_bank_redirect", "mandiri_va", "knet", "mb_way", "mobile_pay", "momo", "momo_atm", "multibanco", "online_banking_thailand", "online_banking_czech_republic", "online_banking_finland", "online_banking_fpx", "online_banking_poland", "online_banking_slovakia", "oxxo", "pago_efectivo", "permata_bank_transfer", "open_banking_uk", "pay_bright", "payjustnow", "paypal", "paze", "pix", "pix_key", "pix_emv", "pix_qr", "pix_automatico_qr", "pix_automatico_push", "pay_safe_card", "przelewy24", "prompt_pay", "pse", "qris", "red_compra", "red_pagos", "samsung_pay", "sepa", "sepa_bank_transfer", "sepa_guarenteed_debit", "skrill", "sofort", "swish", "touch_n_go", "trustly", "twint", "upi_collect", "upi_intent", "upi_qr", "vipps", "viet_qr", "venmo", "walley", "we_chat_pay", "seven_eleven", "lawson", "mini_stop", "family_mart", "seicomart", "pay_easy", "local_bank_transfer", "mifinity", "open_banking_pis", "direct_carrier_billing", "instant_bank_transfer", "instant_bank_transfer_finland", "instant_bank_transfer_poland", "revolut_pay", "indonesian_bank_transfer", "open_banking", "network_token"]); export const passthroughAdditionalData = z.object({psp_token: z.string(), token_type: paymentMethodType}); export const payoutMethodDataResponse = z.union([z.object({card: cardAdditionalData}), z.object({bank: bankAdditionalData}), z.object({wallet: walletAdditionalData}), z.object({bank_redirect: bankRedirectAdditionalData}), z.object({passthrough: passthroughAdditionalData})]); export const addressDetails = z.object({city: z.string().max(50).nullable().optional(), country: countryAlpha2.nullable().optional(), line1: z.string().max(200).nullable().optional(), line2: z.string().max(50).nullable().optional(), line3: z.string().max(50).nullable().optional(), zip: z.string().max(50).nullable().optional(), state: z.string().nullable().optional(), first_name: z.string().max(255).nullable().optional(), last_name: z.string().max(255).nullable().optional(), origin_zip: z.string().max(50).nullable().optional()}); export const phoneDetails = z.object({number: z.string().nullable().optional(), country_code: z.string().nullable().optional()}); export const address = z.object({address: addressDetails.nullable().optional(), phone: phoneDetails.nullable().optional(), email: z.string().nullable().optional()}); export const documentKind = z.enum(["cpf", "cnpj", "psn", "other"]); export const customerDocumentDetails = z.object({document_type: documentKind, document_number: z.string().max(255)}); export const customerDetailsResponse = z.object({id: z.string().min(1).max(64).nullable().optional(), name: z.string().max(255).nullable().optional(), email: z.string().max(255).nullable().optional(), phone: z.string().max(10).nullable().optional(), phone_country_code: z.string().max(2).nullable().optional(), customer_document_details: customerDocumentDetails.nullable().optional()}); export const payoutEntityType = z.enum(["Individual", "Company", "NonProfit", "PublicSector", "NaturalPerson", "lowercase", "Personal"]); export const payoutStatus = z.enum(["success", "failed", "cancelled", "initiated", "expired", "reversed", "pending", "ineligible", "requires_creation", "requires_confirmation", "requires_payout_method_data", "requires_fulfillment", "requires_vendor_account_creation"]); export const payoutSendPriority = z.enum(["instant", "fast", "regular", "wire", "cross_border", "internal"]); export const payoutAttemptResponse = z.object({attempt_id: z.string(), status: payoutStatus, amount: z.number().int(), currency: currency.nullable().optional(), connector: z.string().nullable().optional(), error_code: z.string().nullable().optional(), error_message: z.string().nullable().optional(), payment_method: payoutType.nullable().optional(), payout_method_type: paymentMethodType.nullable().optional(), connector_transaction_id: z.string().nullable().optional(), cancellation_reason: z.string().nullable().optional(), unified_code: z.string().max(255).nullable().optional(), unified_message: z.string().max(1024).nullable().optional()}); export const payoutLinkResponse = z.object({payout_link_id: z.string(), link: z.string()}); export const payoutCreateResponse = z.object({payout_id: z.string().min(30).max(30), merchant_id: z.string().max(255), merchant_order_reference_id: z.string().max(255).nullable().optional(), amount: z.number().int(), currency: currency, connector: z.string().nullable().optional(), payout_type: payoutType.nullable().optional(), payout_method_data: payoutMethodDataResponse.nullable().optional(), source_bank_data: payoutMethodDataResponse.nullable().optional(), billing: address.nullable().optional(), auto_fulfill: z.boolean(), customer_id: z.string().max(255), customer: customerDetailsResponse.nullable().optional(), client_secret: z.string(), return_url: z.string(), business_country: countryAlpha2, business_label: z.string().nullable().optional(), description: z.string().nullable().optional(), entity_type: payoutEntityType, recurring: z.boolean(), metadata: z.object({}).nullable().optional(), merchant_connector_id: z.string().nullable().optional(), status: payoutStatus, error_message: z.string().nullable().optional(), error_code: z.string().nullable().optional(), profile_id: z.string(), created: z.string().nullable().optional(), connector_transaction_id: z.string().nullable().optional(), priority: payoutSendPriority.nullable().optional(), attempts: z.array(payoutAttemptResponse).nullable().optional(), payout_link: payoutLinkResponse.nullable().optional(), email: z.string().max(255).nullable().optional(), name: z.string().max(255).nullable().optional(), phone: z.string().max(255).nullable().optional(), phone_country_code: z.string().max(255).nullable().optional(), unified_code: z.string().max(255).nullable().optional(), unified_message: z.string().max(1024).nullable().optional(), payout_method_id: z.string().nullable().optional()}); export const validateResponse = async ( schema: { readonly '~standard': { readonly validate: (value: unknown) => ({ readonly value: Output; readonly issues?: undefined } | { readonly issues: ReadonlyArray<{ readonly message: string; readonly path?: ReadonlyArray | undefined }> }) | Promise<{ readonly value: Output; readonly issues?: undefined } | { readonly issues: ReadonlyArray<{ readonly message: string; readonly path?: ReadonlyArray | undefined }> }> } }, value: unknown ): Promise => { const result = await schema['~standard'].validate(value) if (result.issues !== undefined) { const detail = result.issues .map(({ message, path }) => path?.length ? `${path.map((segment) => String(typeof segment === 'object' ? segment.key : segment)).join('.')}: ${message}` : message ) .join('; ') throw new Error(`Response does not match the schema: ${detail}`, { cause: { issues: result.issues } }) } return result.value }; /** * Payouts - Create * * POST /payouts/create */ export const createApiPayoutsCreate = async (args: CreateApiPayoutsCreateArgs, options: CreateApiPayoutsCreateOptions) => { const {baseUrl, fetch: fetchFn = fetch, apiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "application/json") if (apiKey !== undefined) headers.set("Authorization", apiKey) const url = `${baseUrl.replace(/\/+$/, '')}/payouts/create${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return validateResponse(payoutCreateResponse, await res.json()) };