import {z} from 'zod' export type CustomerId = string; 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 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 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 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 CardNetwork = 'Visa' | 'Mastercard' | 'AmericanExpress' | 'JCB' | 'DinersClub' | 'Discover' | 'CartesBancaires' | 'UnionPay' | 'Interac' | 'RuPay' | 'Maestro' | 'Star' | 'Pulse' | 'Accel' | 'Nyce' | 'Prop' | 'PrivateLabel' | 'Dinacard'; export type Card = {card_number: string, card_exp_month: string, card_exp_year: string, card_holder_name: string, card_cvc: string, card_issuer?: (string | null) | undefined, card_network?: (CardNetwork | null) | undefined, card_type?: (string | null) | undefined, card_issuing_country?: (string | null) | undefined, card_issuing_country_code?: (string | null) | undefined, bank_code?: (string | null) | undefined, nick_name?: (string | null) | undefined}; export type CardWithNoCVC = {card_number: string, card_exp_month: string, card_exp_year: string, card_holder_name: string, card_issuer?: (string | null) | undefined, card_network?: (CardNetwork | null) | undefined, card_type?: (string | null) | undefined, card_issuing_country?: (string | null) | undefined, card_issuing_country_code?: (string | null) | undefined, bank_code?: (string | null) | undefined, nick_name?: (string | null) | undefined}; export type CardRedirectData = {knet: Record} | {benefit: Record} | {momo_atm: Record} | {card_redirect: Record}; export type AliPayHkRedirection = Record; export type AliPayQr = Record; export type AliPayRedirection = Record; export type AmazonPayWalletData = {checkout_session_id: string}; export type AmazonPayRedirectData = Record; export type ApplePayCryptogramData = {online_payment_cryptogram: string, eci_indicator: string}; export type ApplePayPredecryptData = {application_primary_account_number: string, application_expiration_month: string, application_expiration_year: string, payment_data: ApplePayCryptogramData}; export type ApplePayPaymentData = ApplePayPredecryptData | string; export type ApplepayPaymentMethod = {display_name: string, network: string, type: string, card_exp_month?: (string | null) | undefined, card_exp_year?: (string | null) | undefined, auth_code?: (string | null) | undefined}; export type ApplePayWalletData = {payment_data: ApplePayPaymentData, payment_method: ApplepayPaymentMethod, transaction_identifier: string}; export type ApplePayRedirectData = Record; export type ApplePayThirdPartySdkData = {token?: (string | null) | undefined}; export type CashappQr = Record; export type GcashRedirection = Record; export type GoPayRedirection = Record; export type GooglePayAssuranceDetails = {card_holder_authenticated: boolean, account_verified: boolean}; export type GooglePayCardFundingSource = 'CREDIT' | 'DEBIT' | 'PREPAID' | 'UNKNOWN'; export type GooglePayPaymentMethodInfo = {card_network: string, card_details: string, assurance_details?: (GooglePayAssuranceDetails | null) | undefined, card_funding_source?: (GooglePayCardFundingSource | null) | undefined}; export type GPayPredecryptData = {card_exp_month: string, card_exp_year: string, application_primary_account_number: string, cryptogram: string, eci_indicator: string}; export type GpayEcryptedTokenizationData = {type: string, token: string}; export type GpayTokenizationData = GPayPredecryptData | GpayEcryptedTokenizationData; export type GooglePayWalletData = {type: string, description: string, info: GooglePayPaymentMethodInfo, tokenization_data: GpayTokenizationData}; export type GooglePayRedirectData = Record; export type GooglePayThirdPartySdkData = {token?: (string | null) | undefined}; export type KakaoPayRedirection = Record; export type MbWayRedirection = {telephone_number: string}; export type MifinityData = {date_of_birth: string, language_preference?: (string | null) | undefined}; export type MobilePayRedirection = Record; export type MomoRedirection = Record; export type PaypalRedirection = {email?: (string | null) | undefined}; export type PayPalWalletData = {token: string}; export type PayseraData = Record; export type PazeWalletData = {complete_response: string}; export type RevolutPayData = Record; export type SamsungPayCardBrand = 'visa' | 'mastercard' | 'amex' | 'discover' | 'unknown'; export type SamsungPayTokenData = {type?: (string | null) | undefined, version: string, data: string}; export type SamsungPayWebWalletData = {method?: (string | null) | undefined, recurring_payment?: (boolean | null) | undefined, card_brand: SamsungPayCardBrand, card_last4digits: string, '3_d_s': SamsungPayTokenData}; export type SamsungPayAppWalletData = {'3_d_s': SamsungPayTokenData, payment_card_brand: SamsungPayCardBrand, payment_currency_type: string, payment_last4_dpan?: (string | null) | undefined, payment_last4_fpan: string, merchant_ref?: (string | null) | undefined, method?: (string | null) | undefined, recurring_payment?: (boolean | null) | undefined}; export type SamsungPayWalletCredentials = SamsungPayWebWalletData | SamsungPayAppWalletData; export type SamsungPayWalletData = {payment_credential: SamsungPayWalletCredentials}; export type SkrillData = Record; export type SwishQrData = Record; export type TouchNGoRedirection = Record; export type WeChatPayQr = Record; export type WeChatPayRedirection = Record; export type WalletData = {ali_pay_hk_redirect: AliPayHkRedirection} | {ali_pay_qr: AliPayQr} | {ali_pay_redirect: AliPayRedirection} | {amazon_pay: AmazonPayWalletData} | {amazon_pay_redirect: AmazonPayRedirectData} | {apple_pay: ApplePayWalletData} | {apple_pay_redirect: ApplePayRedirectData} | {apple_pay_third_party_sdk: ApplePayThirdPartySdkData} | {bluecode_redirect: Record} | {cashapp_qr: CashappQr} | {dana_redirect: Record} | {gcash_redirect: GcashRedirection} | {go_pay_redirect: GoPayRedirection} | {google_pay: GooglePayWalletData} | {google_pay_redirect: GooglePayRedirectData} | {google_pay_third_party_sdk: GooglePayThirdPartySdkData} | {kakao_pay_redirect: KakaoPayRedirection} | {mb_way_redirect: MbWayRedirection} | {mifinity: MifinityData} | {mobile_pay_redirect: MobilePayRedirection} | {momo_redirect: MomoRedirection} | {paypal_redirect: PaypalRedirection} | {paypal_sdk: PayPalWalletData} | {paysera: PayseraData} | {paze: PazeWalletData} | {revolut_pay: RevolutPayData} | {samsung_pay: SamsungPayWalletData} | {skrill: SkrillData} | {swish_qr: SwishQrData} | {touch_n_go_redirect: TouchNGoRedirection} | {twint_redirect: Record} | {vipps_redirect: Record} | {we_chat_pay_qr: WeChatPayQr} | {we_chat_pay_redirect: WeChatPayRedirection}; export type PayLaterData = {klarna_redirect: {billing_email?: (string | null) | undefined, billing_country?: (CountryAlpha2 | null) | undefined}} | {klarna_sdk: {token: string}} | {affirm_redirect: Record} | {afterpay_clearpay_redirect: {billing_email?: (string | null) | undefined, billing_name?: (string | null) | undefined}} | {pay_bright_redirect: Record} | {flexiti_redirect: Record} | {walley_redirect: Record} | {alma_redirect: Record} | {atome_redirect: Record} | {breadpay_redirect: Record} | {payjustnow_redirect: Record}; export type BankRedirectBilling = {billing_name: string, email: string}; export type BankNames = '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 type BankRedirectData = {bancontact_card: {card_number: string, card_exp_month: string, card_exp_year: string, card_holder_name: string, billing_details?: (BankRedirectBilling | null) | undefined}} | {bizum: Record} | {blik: {blik_code?: (string | null) | undefined}} | {eps: {billing_details?: (BankRedirectBilling | null) | undefined, bank_name: BankNames, country: CountryAlpha2}} | {giropay: {billing_details?: (BankRedirectBilling | null) | undefined, bank_account_bic?: (string | null) | undefined, bank_account_iban?: (string | null) | undefined, country: CountryAlpha2}} | {ideal: {billing_details?: (BankRedirectBilling | null) | undefined, bank_name: BankNames, country: CountryAlpha2}} | {interac: {country?: (CountryAlpha2 | null) | undefined, email?: (string | null) | undefined}} | {online_banking_czech_republic: {issuer: BankNames}} | {online_banking_finland: {email?: (string | null) | undefined}} | {online_banking_poland: {issuer: BankNames}} | {online_banking_slovakia: {issuer: BankNames}} | {open_banking_uk: {issuer: BankNames, country: CountryAlpha2}} | {przelewy24: {bank_name?: (BankNames | null) | undefined, billing_details?: (BankRedirectBilling | null) | undefined}} | {sofort: {billing_details?: (BankRedirectBilling | null) | undefined, country: CountryAlpha2, preferred_language?: (string | null) | undefined}} | {trustly: {country?: (CountryAlpha2 | null) | undefined}} | {online_banking_fpx: {issuer: BankNames}} | {online_banking_thailand: {issuer: BankNames}} | {local_bank_redirect: Record} | {eft: {provider: string}} | {open_banking: Record}; export type BankDebitBilling = {name?: (string | null) | undefined, email?: (string | null) | undefined, address?: (AddressDetails | null) | undefined}; export type BankType = 'checking' | 'savings'; export type BankDebitData = {ach_bank_debit: {billing_details?: (BankDebitBilling | null) | undefined, account_number: string, routing_number: string, bank_account_holder_name: string, bank_name: string, bank_type: string, bank_holder_type: string}} | {sepa_bank_debit: {billing_details?: (BankDebitBilling | null) | undefined, iban: string, bank_account_holder_name: string}} | {sepa_guarenteed_bank_debit: {billing_details?: (BankDebitBilling | null) | undefined, iban: string, bank_account_holder_name: string}} | {becs_bank_debit: {billing_details?: (BankDebitBilling | null) | undefined, account_number: string, bsb_number: string, bank_account_holder_name?: (string | null) | undefined}} | {bacs_bank_debit: {billing_details?: (BankDebitBilling | null) | undefined, account_number: string, sort_code: string, bank_account_holder_name: string}} | {eft_debit_order: {billing_details?: (BankDebitBilling | null) | undefined, account_number: string, branch_code?: (string | null) | undefined, bank_account_holder_name?: (string | null) | undefined, bank_name?: (BankNames | null) | undefined, bank_type?: (BankType | null) | undefined}}; export type AchBillingDetails = {email?: (string | null) | undefined}; export type SepaAndBacsBillingDetails = {email?: (string | null) | undefined, name?: (string | null) | undefined}; export type MultibancoBillingDetails = {email?: (string | null) | undefined}; export type DokuBillingDetails = {first_name?: (string | null) | undefined, last_name?: (string | null) | undefined, email?: (string | null) | undefined}; export type BankTransferData = {ach_bank_transfer: {billing_details?: (AchBillingDetails | null) | undefined}} | {sepa_bank_transfer: {billing_details?: (SepaAndBacsBillingDetails | null) | undefined, country: CountryAlpha2}} | {bacs_bank_transfer: {billing_details?: (SepaAndBacsBillingDetails | null) | undefined}} | {multibanco_bank_transfer: {billing_details?: (MultibancoBillingDetails | null) | undefined}} | {permata_bank_transfer: {billing_details?: (DokuBillingDetails | null) | undefined}} | {bca_bank_transfer: {billing_details?: (DokuBillingDetails | null) | undefined}} | {bni_va_bank_transfer: {billing_details?: (DokuBillingDetails | null) | undefined}} | {bri_va_bank_transfer: {billing_details?: (DokuBillingDetails | null) | undefined}} | {cimb_va_bank_transfer: {billing_details?: (DokuBillingDetails | null) | undefined}} | {danamon_va_bank_transfer: {billing_details?: (DokuBillingDetails | null) | undefined}} | {mandiri_va_bank_transfer: {billing_details?: (DokuBillingDetails | null) | undefined}} | {pix: {pix_key?: (string | null) | undefined, cpf?: (string | null) | undefined, cnpj?: (string | null) | undefined, source_bank_account_id?: (string | null) | undefined, destination_bank_account_id?: (string | null) | undefined, expiry_date?: (string | null) | undefined}} | {pix_emv: Record} | {pix_qr: Record} | {pix_automatico_qr: Record} | {pix_automatico_push: {account_number?: (string | null) | undefined, branch_code?: (string | null) | undefined, bank_identifier?: (string | null) | undefined}} | {pse: Record} | {local_bank_transfer: {bank_code?: (string | null) | undefined}} | {instant_bank_transfer: Record} | {instant_bank_transfer_finland: Record} | {instant_bank_transfer_poland: Record} | {indonesian_bank_transfer: {bank_name?: (BankNames | null) | undefined}}; export type RealTimePaymentData = {fps: Record} | {duit_now: Record} | {prompt_pay: Record} | {viet_qr: Record} | {qris: Record}; export type CryptoData = {pay_currency?: (string | null) | undefined, network?: (string | null) | undefined}; export type UpiSource = 'UPI_CC' | 'UPI_CL' | 'UPI_ACCOUNT' | 'UPI_CC_CL' | 'UPI_PPI' | 'UPI_VOUCHER'; export type UpiCollectData = {vpa_id?: (string | null) | undefined, upi_source?: (UpiSource | null) | undefined}; export type UpiIntentData = {upi_source?: (UpiSource | null) | undefined, app_name?: (string | null) | undefined}; export type UpiQrData = {upi_source?: (UpiSource | null) | undefined}; export type UpiData = {upi_collect: UpiCollectData} | {upi_intent: UpiIntentData} | {upi_qr: UpiQrData}; export type DocumentKind = 'cpf' | 'cnpj' | 'psn' | 'other'; export type BoletoVoucherData = {social_security_number?: (string | null) | undefined, bank_number?: (string | null) | undefined, document_type?: (DocumentKind | null) | undefined, fine_percentage?: (string | null) | undefined, fine_quantity_days?: (string | null) | undefined, interest_percentage?: (string | null) | undefined, write_off_quantity_days?: (string | null) | undefined, messages?: (Array | null) | undefined, due_date?: (string | null) | undefined}; export type AlfamartVoucherData = {first_name?: (string | null) | undefined, last_name?: (string | null) | undefined, email?: (string | null) | undefined}; export type IndomaretVoucherData = {first_name?: (string | null) | undefined, last_name?: (string | null) | undefined, email?: (string | null) | undefined}; export type JCSVoucherData = {first_name?: (string | null) | undefined, last_name?: (string | null) | undefined, email?: (string | null) | undefined, phone_number?: (string | null) | undefined}; export type VoucherData = {boleto: BoletoVoucherData} | 'efecty' | 'pago_efectivo' | 'red_compra' | 'red_pagos' | {alfamart: AlfamartVoucherData} | {indomaret: IndomaretVoucherData} | 'oxxo' | {seven_eleven: JCSVoucherData} | {lawson: JCSVoucherData} | {mini_stop: JCSVoucherData} | {family_mart: JCSVoucherData} | {seicomart: JCSVoucherData} | {pay_easy: JCSVoucherData}; export type GiftCardDetails = {number: string, cvc: string}; export type BHNGiftCardDetails = {account_number: string, pin: string, cvv2: string, expiration_date: string}; export type GiftCardData = {givex: GiftCardDetails} | {pay_safe_card: Record} | {bhn_card_network: BHNGiftCardDetails}; export type CardToken = {card_holder_name: string, card_cvc?: (string | null) | undefined, card_cvc_token?: (string | null) | undefined}; export type OpenBankingData = {open_banking_pis: Record}; export type MobilePaymentData = {direct_carrier_billing: {msisdn: string, client_uid?: (string | null) | undefined}}; export type NetworkTokenData = {network_token: string, token_exp_month: string, token_exp_year: string, token_cryptogram: string, card_network?: (CardNetwork | null) | undefined, card_type?: (string | null) | undefined, card_issuing_country?: (string | null) | undefined, bank_code?: (string | null) | undefined, card_holder_name: string, card_issuer?: (string | null) | undefined, nick_name?: (string | null) | undefined, eci?: (string | null) | undefined, par?: (string | null) | undefined}; export type ProxyCardData = {card_number: string, card_exp_month: string, card_exp_year: string, card_holder_name: string, card_cvc: string, card_issuer?: (string | null) | undefined, card_network?: (CardNetwork | null) | undefined, card_type?: (string | null) | undefined, card_issuing_country?: (string | null) | undefined, bank_code?: (string | null) | undefined, nick_name?: (string | null) | undefined, bin_number: string, last_four: string}; export type VaultCardToken = {card_holder_name: string, card_cvc?: (string | null) | undefined}; export type PaymentMethodDataRequest = {card: Card, billing?: (Address | null) | undefined} | null | {card_with_no_cvc: CardWithNoCVC, billing?: (Address | null) | undefined} | null | {card_redirect: CardRedirectData, billing?: (Address | null) | undefined} | null | {wallet: WalletData, billing?: (Address | null) | undefined} | null | {pay_later: PayLaterData, billing?: (Address | null) | undefined} | null | {bank_redirect: BankRedirectData, billing?: (Address | null) | undefined} | null | {bank_debit: BankDebitData, billing?: (Address | null) | undefined} | null | {bank_transfer: BankTransferData, billing?: (Address | null) | undefined} | null | {real_time_payment: RealTimePaymentData, billing?: (Address | null) | undefined} | null | {crypto: CryptoData, billing?: (Address | null) | undefined} | null | {upi: UpiData, billing?: (Address | null) | undefined} | null | {voucher: VoucherData, billing?: (Address | null) | undefined} | null | {gift_card: GiftCardData, billing?: (Address | null) | undefined} | null | {card_token: CardToken, billing?: (Address | null) | undefined} | null | {open_banking: OpenBankingData, billing?: (Address | null) | undefined} | null | {mobile_payment: MobilePaymentData, billing?: (Address | null) | undefined} | null | {network_token: NetworkTokenData, billing?: (Address | null) | undefined} | null | {vault_data_card: ProxyCardData, billing?: (Address | null) | undefined} | null | {vault_card_token_data: VaultCardToken, billing?: (Address | null) | undefined} | null; export type FutureUsage = 'off_session' | 'on_session'; export type AcceptanceType = 'online' | 'offline'; export type OnlineMandate = {ip_address: string, user_agent: string}; export type CustomerAcceptance = {acceptance_type: AcceptanceType, accepted_at?: (string | null) | undefined, online?: (OnlineMandate | null) | undefined}; export type CaptureMethod = 'automatic' | 'manual' | 'manual_multiple' | 'scheduled' | 'sequential_automatic'; export type AuthenticationType = 'three_ds' | 'no_three_ds'; export type PaymentType = 'normal' | 'new_mandate' | 'setup_mandate' | 'recurring_mandate' | 'installment'; export type PaymentDetails = {payment_method?: (PaymentMethod | null) | undefined, payment_method_type?: (PaymentMethodType | null) | undefined, payment_method_data?: (PaymentMethodDataRequest | null) | undefined, setup_future_usage?: (FutureUsage | null) | undefined, customer_acceptance?: (CustomerAcceptance | null) | undefined, return_url?: (string | null) | undefined, capture_method?: (CaptureMethod | null) | undefined, authentication_type?: (AuthenticationType | null) | undefined, payment_type?: (PaymentType | null) | undefined, payment_method_id?: (string | null) | undefined}; export type CreateAndConfirmSubscriptionRequest = {plan_id?: (string | null) | undefined, item_price_id: string, coupon_code?: (string | null) | undefined, customer_id: CustomerId, billing?: (Address | null) | undefined, shipping?: (Address | null) | undefined, payment_details: PaymentDetails, merchant_reference_id?: (string | null) | undefined}; export type CreateApiSubscriptionsArgs = {'X-Profile-Id': string, body: CreateAndConfirmSubscriptionRequest}; export type CreateApiSubscriptionsOptions = {baseUrl: string, apiKey?: string | undefined, fetch?: typeof fetch | undefined}; export const subscriptionId = z.string(); export const subscriptionStatus = z.enum(["active", "created", "in_active", "pending", "trial", "paused", "unpaid", "onetime", "cancelled", "failed"]); export const profileId = z.string(); export const merchantId = z.string(); export const customerId = z.string(); export const paymentId = z.string(); export const intentStatus = z.enum(["succeeded", "failed", "cancelled", "cancelled_post_capture", "processing", "requires_customer_action", "requires_merchant_action", "requires_payment_method", "requires_confirmation", "requires_capture", "partially_captured", "partially_captured_and_capturable", "partially_authorized_and_requires_capture", "partially_captured_and_processing", "conflicted", "expired", "review"]); export const minorUnit = z.number().int(); 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 dokuBankTransferInstructions = z.object({expires_at: z.string(), reference: z.string(), instructions_url: z.string()}); export const receiverDetails = z.object({amount_received: z.number().int(), amount_charged: z.number().int().nullable().optional(), amount_remaining: z.number().int().nullable().optional()}); export const achTransfer = z.object({account_number: z.string(), bank_name: z.string(), routing_number: z.string(), swift_code: z.string()}); export const sepaBankTransferInstructions = z.object({account_holder_name: z.string(), bic: z.string(), country: z.string(), iban: z.string(), reference: z.string()}); export const bacsBankTransferInstructions = z.object({account_holder_name: z.string(), account_number: z.string(), sort_code: z.string()}); export const multibancoTransferInstructions = z.object({reference: z.string(), entity: z.string()}); export const bankTransferNextStepsData = z.union([z.object({doku_bank_transfer_instructions: dokuBankTransferInstructions, receiver: receiverDetails.nullable().optional()}), z.object({ach_credit_transfer: achTransfer, receiver: receiverDetails.nullable().optional()}), z.object({sepa_bank_instructions: sepaBankTransferInstructions, receiver: receiverDetails.nullable().optional()}), z.object({bacs_bank_instructions: bacsBankTransferInstructions, receiver: receiverDetails.nullable().optional()}), z.object({multibanco: multibancoTransferInstructions, receiver: receiverDetails.nullable().optional()})]); export const nextActionCall = z.union([z.literal("post_session_tokens"), z.literal("confirm"), z.literal("sync"), z.literal("complete_authorize"), z.literal("await_merchant_callback"), z.object({deny: z.object({message: z.string()})}), z.literal("eligibility_check")]); export const sdkNextAction = z.object({next_action: nextActionCall, should_block_confirm: z.boolean().nullable().optional()}); export const gpayMerchantInfo = z.object({merchant_id: z.string().nullable().optional(), merchant_name: z.string()}); export const gpayShippingAddressParameters = z.object({phone_number_required: z.boolean()}); export const gpayBillingAddressFormat = z.enum(["FULL", "MIN"]); export const gpayBillingAddressParameters = z.object({phone_number_required: z.boolean(), format: gpayBillingAddressFormat}); export const gpayAllowedMethodsParameters = z.object({allowed_auth_methods: z.array(z.string()), allowed_card_networks: z.array(z.string()), billing_address_required: z.boolean().nullable().optional(), billing_address_parameters: gpayBillingAddressParameters.nullable().optional(), assurance_details_required: z.boolean().nullable().optional(), allow_credit_cards: z.boolean().nullable().optional()}); export const gpayTokenParameters = z.object({gateway: z.string().nullable().optional(), gateway_merchant_id: z.string().nullable().optional(), "stripe:version": z.string().nullable().optional(), "stripe:publishableKey": z.string().nullable().optional(), protocol_version: z.string().nullable().optional(), public_key: z.string().nullable().optional()}); export const gpayTokenizationSpecification = z.object({type: z.string(), parameters: gpayTokenParameters}); export const gpayAllowedPaymentMethods = z.object({type: z.string(), parameters: gpayAllowedMethodsParameters, tokenization_specification: gpayTokenizationSpecification}); 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 gpayTransactionInfo = z.object({country_code: countryAlpha2, currency_code: currency, total_price_status: z.string(), total_price: z.string()}); export const secretInfoToInitiateSdk = z.object({display: z.string(), payment: z.string()}); export const samsungPayMerchantPaymentInformation = z.object({name: z.string(), url: z.string().nullable().optional(), country_code: countryAlpha2}); export const samsungPayAmountFormat = z.enum(["FORMAT_TOTAL_PRICE_ONLY", "FORMAT_TOTAL_ESTIMATED_AMOUNT"]); export const samsungPayAmountDetails = z.object({option: samsungPayAmountFormat, currency_code: currency, total: z.string()}); export const samsungPayProtocolType = z.literal("PROTOCOL3DS"); export const paypalFlow = z.literal("checkout"); export const paypalTransactionInfo = z.object({flow: paypalFlow, currency_code: currency, total_price: z.string()}); export const paypalCaptureMethod = z.enum(["capture", "authorize"]); export const thirdPartySdkSessionResponse = z.object({secrets: secretInfoToInitiateSdk}); export const nullObject = z.unknown(); export const applePaySessionResponse = z.union([thirdPartySdkSessionResponse, z.unknown(), nullObject]); export const amountInfo = z.object({label: z.string(), type: z.string().nullable().optional(), amount: z.string()}); export const applePayAddressParameters = z.enum(["postalAddress", "phone", "email"]); export const applePayBillingContactFields = z.array(applePayAddressParameters); export const applePayShippingContactFields = z.array(applePayAddressParameters); export const applePayPaymentTiming = z.enum(["immediate", "recurring"]); export const recurringPaymentIntervalUnit = z.enum(["year", "month", "day", "hour", "minute"]); export const applePayRegularBillingRequest = z.object({amount: z.string(), label: z.string(), payment_timing: applePayPaymentTiming, recurring_payment_start_date: z.string().nullable().optional(), recurring_payment_end_date: z.string().nullable().optional(), recurring_payment_interval_unit: recurringPaymentIntervalUnit.nullable().optional(), recurring_payment_interval_count: z.number().int().nullable().optional()}); export const applePayRecurringPaymentRequest = z.object({payment_description: z.string(), regular_billing: applePayRegularBillingRequest, billing_agreement: z.string().nullable().optional(), management_u_r_l: z.string()}); export const applePayPaymentRequest = z.object({country_code: countryAlpha2, currency_code: currency, total: amountInfo, merchant_capabilities: z.array(z.string()).nullable().optional(), supported_networks: z.array(z.string()).nullable().optional(), merchant_identifier: z.string().nullable().optional(), required_billing_contact_fields: applePayBillingContactFields.nullable().optional(), required_shipping_contact_fields: applePayShippingContactFields.nullable().optional(), recurring_payment_request: applePayRecurringPaymentRequest.nullable().optional()}); 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 ctpServiceProvider = z.enum(["visa", "mastercard"]); export const amazonPayPaymentIntent = z.enum(["Confirm", "Authorize", "AuthorizeWithCapture"]); export const amazonPayDeliveryPrice = z.object({amount: minorUnit, currency_code: currency}); export const amazonPayShippingMethod = z.object({shipping_method_name: z.string(), shipping_method_code: z.string()}); export const amazonPayDeliveryOptions = z.object({id: z.string(), price: amazonPayDeliveryPrice, shipping_method: amazonPayShippingMethod, is_default: z.boolean()}); export const sessionToken = z.discriminatedUnion("wallet_name", [z.object({delayed_session_token: z.boolean(), connector: z.string(), sdk_next_action: sdkNextAction, wallet_name: z.literal("google_pay")}), z.object({merchant_info: gpayMerchantInfo, shipping_address_required: z.boolean(), email_required: z.boolean(), shipping_address_parameters: gpayShippingAddressParameters, allowed_payment_methods: z.array(gpayAllowedPaymentMethods), transaction_info: gpayTransactionInfo, delayed_session_token: z.boolean(), connector: z.string(), sdk_next_action: sdkNextAction, secrets: secretInfoToInitiateSdk.nullable().optional(), wallet_name: z.literal("google_pay")}), z.object({version: z.string(), service_id: z.string(), order_number: z.string(), merchant: samsungPayMerchantPaymentInformation, amount: samsungPayAmountDetails, protocol: samsungPayProtocolType, allowed_brands: z.array(z.string()), billing_address_required: z.boolean(), shipping_address_required: z.boolean(), wallet_name: z.literal("samsung_pay")}), z.object({session_token: z.string(), session_id: z.string(), wallet_name: z.literal("klarna")}), z.object({connector: z.string(), session_token: z.string(), sdk_next_action: sdkNextAction, client_token: z.string().nullable().optional(), transaction_info: paypalTransactionInfo.nullable().optional(), data_user_id_token: z.string().nullable().optional(), currency: currency.nullable().optional(), intent: paypalCaptureMethod.nullable().optional(), wallet_name: z.literal("paypal")}), z.object({session_token_data: applePaySessionResponse.nullable().optional(), payment_request_data: applePayPaymentRequest.nullable().optional(), connector: z.string(), delayed_session_token: z.boolean(), sdk_next_action: sdkNextAction, connector_reference_id: z.string().nullable().optional(), connector_sdk_public_key: z.string().nullable().optional(), connector_merchant_id: z.string().nullable().optional(), wallet_name: z.literal("apple_pay")}), z.object({open_banking_session_token: z.string(), wallet_name: z.literal("open_banking")}), z.object({client_id: z.string(), client_name: z.string(), client_profile_id: z.string(), transaction_currency_code: currency, transaction_amount: z.string(), email_address: z.string().max(255).nullable().optional(), wallet_name: z.literal("paze")}), z.object({dpa_id: z.string(), dpa_name: z.string(), locale: z.string(), card_brands: z.array(cardNetwork), acquirer_bin: z.string(), acquirer_merchant_id: z.string(), merchant_category_code: z.string().nullable().optional(), merchant_country_code: z.string(), transaction_amount: z.string(), transaction_currency_code: currency, phone_number: z.string().max(255).nullable().optional(), email: z.string().max(255).nullable().optional(), phone_country_code: z.string().nullable().optional(), provider: ctpServiceProvider.nullable().optional(), dpa_client_id: z.string().nullable().optional(), wallet_name: z.literal("click_to_pay")}), z.object({merchant_id: z.string(), ledger_currency: currency, store_id: z.string(), payment_intent: amazonPayPaymentIntent, total_shipping_amount: z.string(), total_tax_amount: z.string(), total_base_amount: z.string(), delivery_options: z.array(amazonPayDeliveryOptions), wallet_name: z.literal("amazon_pay")}), z.object({wallet_name: z.literal("no_session_token_received")})]); export const pollConfig = z.object({delay_in_secs: z.number().int().gte(0), frequency: z.number().int().gte(0)}); export const threeDsMethodKey = z.enum(["threeDSMethodData", "JWT"]); export const threeDsMethodData = z.object({three_ds_method_data_submission: z.boolean(), three_ds_method_data: z.string().nullable().optional(), three_ds_method_url: z.string().nullable().optional(), three_ds_method_key: threeDsMethodKey.nullable().optional(), consume_post_message_for_three_ds_method_completion: z.boolean()}); export const pollConfigResponse = z.object({poll_id: z.string(), delay_in_secs: z.number().int(), frequency: z.number().int()}); export const threeDsData = z.object({three_ds_authentication_url: z.string(), three_ds_authorize_url: z.string(), three_ds_method_details: threeDsMethodData, poll_config: pollConfigResponse, message_version: z.string().nullable().optional(), directory_server_id: z.string().nullable().optional(), card_network: cardNetwork.nullable().optional(), three_ds_connector: z.string().nullable().optional()}); export const sdkNextActionData = z.object({next_action: nextActionCall, order_id: z.string().nullable().optional()}); export const mobilePaymentConsent = z.enum(["consent_required", "consent_not_required", "consent_optional"]); export const iframeData = z.object({three_ds_method_url: z.string(), three_ds_method_data_submission: z.boolean(), three_ds_method_data: z.string().nullable().optional(), directory_server_id: z.string(), message_version: z.string().nullable().optional(), method_key: z.literal("threeDSMethodData")}); export const dDCData = z.object({iframe_url: z.string(), timeout_ms: z.number().int().nullable().optional()}); export const nextActionData = z.discriminatedUnion("type", [z.object({redirect_to_url: z.string(), type: z.literal("redirect_to_url")}), z.object({bank_transfer_steps_and_charges_details: bankTransferNextStepsData, type: z.literal("display_bank_transfer_information")}), z.object({session_token: sessionToken.nullable().optional(), type: z.literal("third_party_sdk_session_token")}), z.object({image_data_url: z.string(), display_to_timestamp: z.number().int().nullable().optional(), qr_code_url: z.string(), display_text: z.string().nullable().optional(), border_color: z.string().nullable().optional(), raw_qr_data: z.string().nullable().optional(), type: z.literal("qr_code_information")}), z.object({qr_code_fetch_url: z.string(), type: z.literal("fetch_qr_code_information")}), z.object({sdk_uri: z.string(), display_from_timestamp: z.number().int(), display_to_timestamp: z.number().int().nullable().optional(), poll_config: pollConfig.nullable().optional(), type: z.literal("invoke_upi_intent_sdk")}), z.object({qr_code_url: z.string(), display_from_timestamp: z.number().int(), display_to_timestamp: z.number().int().nullable().optional(), poll_config: pollConfig.nullable().optional(), type: z.literal("invoke_upi_qr_flow")}), z.object({voucher_details: z.string(), type: z.literal("display_voucher_information")}), z.object({display_from_timestamp: z.number().int(), display_to_timestamp: z.number().int().nullable().optional(), poll_config: pollConfig.nullable().optional(), type: z.literal("wait_screen_information")}), z.object({three_ds_data: threeDsData, type: z.literal("three_ds_invoke")}), z.object({next_action_data: sdkNextActionData, type: z.literal("invoke_sdk_client")}), z.object({consent_data_required: mobilePaymentConsent, type: z.literal("collect_otp")}), z.object({iframe_data: iframeData, type: z.literal("invoke_hidden_iframe")}), z.object({ddc_data: dDCData, type: z.literal("invoke_ddc")})]); export const paymentExperience = z.enum(["redirect_to_url", "invoke_sdk_client", "display_qr_code", "one_click", "link_wallet", "invoke_payment_app", "display_wait_screen", "collect_otp"]); 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 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 paymentType = z.enum(["normal", "new_mandate", "setup_mandate", "recurring_mandate", "installment"]); export const paymentResponseData = z.object({payment_id: paymentId, status: intentStatus, amount: minorUnit, currency: currency, profile_id: profileId.nullable().optional(), connector: z.string().nullable().optional(), payment_method_id: z.string().nullable().optional(), return_url: z.string().nullable().optional(), next_action: nextActionData.nullable().optional(), payment_experience: paymentExperience.nullable().optional(), error_code: z.string().nullable().optional(), error_message: z.string().nullable().optional(), payment_method_type: paymentMethodType.nullable().optional(), client_secret: z.string().nullable().optional(), billing: address.nullable().optional(), shipping: address.nullable().optional(), payment_type: paymentType.nullable().optional(), payment_token: z.string().nullable().optional()}); export const invoiceId = z.string(); export const merchantConnectorAccountId = z.string(); export const invoiceStatus = z.enum(["invoice_created", "payment_pending", "payment_pending_timeout", "payment_succeeded", "payment_failed", "payment_canceled", "invoice_paid", "manual_review", "voided"]); export const invoice = z.object({id: invoiceId, subscription_id: subscriptionId, merchant_id: merchantId, profile_id: profileId, merchant_connector_id: merchantConnectorAccountId, payment_intent_id: paymentId.nullable().optional(), payment_method_id: z.string().nullable().optional(), customer_id: customerId, amount: minorUnit, currency: currency, status: invoiceStatus, billing_processor_invoice_id: z.string().nullable().optional()}); export const subscriptionResponse = z.object({id: subscriptionId, merchant_reference_id: z.string().nullable().optional(), status: subscriptionStatus, plan_id: z.string().nullable().optional(), item_price_id: z.string().nullable().optional(), profile_id: profileId, client_secret: z.string().nullable().optional(), merchant_id: merchantId, coupon_code: z.string().nullable().optional(), customer_id: customerId, payment: paymentResponseData.nullable().optional(), invoice: invoice.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 }; /** * Subscription - Create and Confirm * * POST /subscriptions */ export const createApiSubscriptions = async (args: CreateApiSubscriptionsArgs, options: CreateApiSubscriptionsOptions) => { 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 (args['X-Profile-Id'] != null) headers.set("X-Profile-Id", String(args['X-Profile-Id'])) if (apiKey !== undefined) headers.set("Authorization", apiKey) const url = `${baseUrl.replace(/\/+$/, '')}/subscriptions${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(subscriptionResponse, await res.json()) };