export type CardInfo = {card_number: string, card_holder_name: string, expiry_month: string, expiry_year: string, cvv: string}; export type BillingDataSerializerField = {name?: (string | null) | undefined, first_name?: (string | null) | undefined, last_name?: (string | null) | undefined, email?: (string | null) | undefined, phone_number?: (string | null) | undefined, address?: string | undefined, address1?: string | undefined, apartment?: string | undefined, floor?: string | undefined, building?: string | undefined, street?: string | undefined, city?: string | undefined, state?: (string | null) | undefined, country?: string | undefined, postal_code?: string | undefined, mobile_wallet_number?: (string | null) | undefined}; export type ShippingData = {phone_number?: (string | null) | undefined, first_name?: string | undefined, last_name?: string | undefined, email?: (string | null) | undefined, address?: string | undefined, country?: string | undefined, state?: string | undefined, city?: string | undefined, postal_code?: string | undefined, street?: string | undefined, floor?: string | undefined, building?: string | undefined, apartment?: string | undefined, description?: (string | null) | undefined, shipping_method?: string | undefined, area?: string | undefined, created: string, modified: string}; export type UniversalCardFields = {card_holder_name?: (string | null) | undefined, last_four_digits: string, first_six_digits: string, first_eight_digits?: string | undefined, expiry_month: string, expiry_year: string, card_scheme?: (string | null) | undefined, access_token: string, cvv?: (string | null) | undefined, save_card?: boolean | undefined, fingerprint?: (string | null) | undefined, network_token_data: unknown, card_token: string}; export type GeneralAmountsTitle = {en: string, ar?: string | undefined, fr?: string | undefined}; export type Discount = {title: GeneralAmountsTitle, value: unknown, type: 'percentage' | 'amount'}; export type ProductItems = {name: string, amount: unknown, unit_amount?: unknown | undefined, description: string, quantity: number, category?: ('Animals & Pet Supplies' | 'Apparel & Accessories' | 'Arts & Entertainment' | 'Baby & Toddler' | 'Business & Industrial' | 'Cameras & Optics' | 'Electronics' | 'Food, Beverages & Tobacco' | 'Furniture' | 'Hardware' | 'Health & Beauty' | 'Home & Garden' | 'Luggage & Bags' | 'Mature' | 'Media' | 'Office Supplies' | 'Religious & Ceremonial' | 'Software' | 'Sporting Goods' | 'Toys & Games' | 'Vehicles & Parts' | 'Crypto') | undefined, subcategory?: ('Live Animals' | 'Pet Supplies' | 'Clothing' | 'Clothing Accessories' | 'Costumes & Accessories' | 'Handbag & Wallet Accessories' | 'Handbags, Wallets & Cases' | 'Jewelry' | 'Shoe Accessories' | 'Shoes' | 'Event Tickets' | 'Hobbies & Creative Arts' | 'Party & Celebration' | 'Baby Bathing' | 'Baby Gift Sets' | 'Baby Health' | 'Baby Safety' | 'Baby Toys & Activity Equipment' | 'Baby Transport' | 'Baby Transport Accessories' | 'Diapering' | 'Nursing & Feeding' | 'Potty Training' | 'Swaddling & Receiving Blankets' | 'Advertising & Marketing' | 'Agriculture' | 'Automation Control Components' | 'Construction' | 'Dentistry' | 'Film & Television' | 'Finance & Insurance' | 'Food Service' | 'Forestry & Logging' | 'Hairdressing & Cosmetology' | 'Heavy Machinery' | 'Hotel & Hospitality' | 'Industrial Storage' | 'Industrial Storage Accessories' | 'Janitorial Carts & Caddies' | 'Law Enforcement' | 'Manufacturing' | 'Material Handling' | 'Medical' | 'Mining & Quarrying' | 'Piercing & Tattooing' | 'Retail' | 'Science & Laboratory' | 'Signage' | 'Work Safety Protective Gear' | 'Camera & Optic Accessories' | 'Cameras' | 'Optics' | 'Photography' | 'Arcade Equipment' | 'Audio' | 'Circuit Boards & Components' | 'Communications' | 'Components' | 'Computers' | 'Electronics Accessories' | 'GPS Accessories' | 'GPS Navigation Systems' | 'GPS Tracking Devices' | 'Marine Electronics' | 'Networking' | 'Print, Copy, Scan & Fax' | 'Radar Detectors' | 'Speed Radars' | 'Toll Collection Devices' | 'Video' | 'Video Game Console Accessories' | 'Video Game Consoles' | 'Beverages' | 'Food Items' | 'Tobacco Products' | 'Baby & Toddler Furniture' | 'Beds & Accessories' | 'Benches' | 'Cabinets & Storage' | 'Carts & Islands' | 'Chair Accessories' | 'Chairs' | 'Entertainment Centers & TV Stands' | 'Furniture Sets' | 'Futon Frames' | 'Futon Pads' | 'Futons' | 'Office Furniture' | 'Office Furniture Accessories' | 'Ottomans' | 'Outdoor Furniture' | 'Outdoor Furniture Accessories' | 'Room Divider Accessories' | 'Room Dividers' | 'Shelving' | 'Shelving Accessories' | 'Sofa Accessories' | 'Sofas' | 'Table Accessories' | 'Tables' | 'Building Consumables' | 'Building Materials' | 'Fencing & Barriers' | 'Fuel' | 'Fuel Containers & Tanks' | 'Hardware Accessories' | 'Hardware Pumps' | 'Heating, Ventilation & Air Conditioning' | 'Locks & Keys' | 'Plumbing' | 'Power & Electrical Supplies' | 'Small Engines' | 'Storage Tanks' | 'Tool Accessories' | 'Tools' | 'Health Care' | 'Jewelry Cleaning & Care' | 'Personal Care' | 'Bathroom Accessories' | 'Business & Home Security' | 'Decor' | 'Emergency Preparedness' | 'Fireplace & Wood Stove Accessories' | 'Fireplaces' | 'Flood, Fire & Gas Safety' | 'Household Appliance Accessories' | 'Household Appliances' | 'Household Supplies' | 'Kitchen & Dining' | 'Lawn & Garden' | 'Lighting' | 'Lighting Accessories' | 'Linens & Bedding' | 'Parasols & Rain Umbrellas' | 'Plants' | 'Pool & Spa' | 'Smoking Accessories' | 'Umbrella Sleeves & Cases' | 'Wood Stoves' | 'Backpacks' | 'Briefcases' | 'Cosmetic & Toiletry Bags' | 'Diaper Bags' | 'Dry Boxes' | 'Duffel Bags' | 'Fanny Packs' | 'Garment Bags' | 'Luggage Accessories' | 'Messenger Bags' | 'Shopping Totes' | 'Suitcases' | 'Train Cases' | 'Erotic' | 'Weapons' | 'Books' | 'Carpentry & Woodworking Project Plans' | 'DVDs & Videos' | 'Magazines & Newspapers' | 'Music & Sound Recordings' | 'Product Manuals' | 'Sheet Music' | 'Book Accessories' | 'Desk Pads & Blotters' | 'Filing & Organization' | 'General Office Supplies' | 'Impulse Sealers' | 'Lap Desks' | 'Name Plates' | 'Office & Chair Mats' | 'Office Carts' | 'Office Equipment' | 'Office Instruments' | 'Paper Handling' | 'Presentation Supplies' | 'Shipping Supplies' | 'Memorial Ceremony Supplies' | 'Religious Items' | 'Wedding Ceremony Supplies' | 'Computer Software' | 'Digital Goods & Currency' | 'Video Game Software' | 'Athletics' | 'Exercise & Fitness' | 'Indoor Games' | 'Outdoor Recreation' | 'Game Timers' | 'Games' | 'Outdoor Play Equipment' | 'Puzzles' | 'Toys' | 'Vehicle Parts & Accessories' | 'Vehicles' | 'Cryptocurrency' | 'Token') | undefined, type?: ('Physical' | 'Digital') | undefined, image_url?: (string | null) | undefined, sku?: string | undefined, tax?: unknown | undefined, extra_information: unknown, discount?: (Discount | null) | undefined}; export type NativeForm = {card_details?: CardInfo | undefined, billing_fields: BillingDataSerializerField, shipping_fields?: ShippingData | undefined, card_embed?: UniversalCardFields | undefined, product_items_fields?: ProductItems | undefined}; export type ExternalPayWithMethod = {native_form?: NativeForm | undefined, use_wallet?: boolean | undefined}; export type CreateApiApiV14DirectPaymentsIntentsIntentIdPaymentMethodArgs = {intent_id: string, payment_method: 'AMAN_MASARY' | 'APPLE_PAY' | 'ATOME' | 'BANK_INSTALLMENTS' | 'BANK_TRANSFERS' | 'BENEFIT' | 'BOOST' | 'CAPITEC_PAY' | 'CARD' | 'CAREEM_PAY' | 'CASH_COLLECTION' | 'CASH_ON_DELIVERY' | 'CASH_OUTLET' | 'CLICK2PAY' | 'CRYPTO_WALLET' | 'EFAWATEERCOM' | 'EFT' | 'FORSA' | 'GETGO' | 'GOOGLE_PAY' | 'GRABPAY' | 'GRABPAYPAYLATER' | 'ININAL' | 'KNET' | 'MADA' | 'MOBILE_MONEY' | 'MOBILE_WALLET' | 'MOKAFAA' | 'M_PESA' | 'NAPS' | 'OMANNET' | 'PAYNOW' | 'PAYPAL' | 'PAY_AT_FAWRY' | 'PAY_FLEX' | 'QITAF' | 'QPAY' | 'RAZER' | 'REFERENCE_NUMBER' | 'SADAD' | 'SAMSUNG_PAY' | 'SELFSERVE_WALLET' | 'SHAHRY' | 'SHOPEEPAY' | 'SHOPEEPAYPAYLATER' | 'SOUHOOLA' | 'STC' | 'SYMPL' | 'TABBY' | 'TAMARA' | 'TAPTOPAY' | 'TOUCHNGO' | 'UPI' | 'USSD' | 'VALU' | 'WALAONE' | 'ZAINCASH', body: ExternalPayWithMethod}; export type CreateApiApiV14DirectPaymentsIntentsIntentIdPaymentMethodOptions = {baseUrl?: string | undefined, ApiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Pay with method * * POST /api/v1.4/direct/payments/intents/{intent_id}/{payment_method}/ * * Also accepts auth: AccessTokenAuth */ export const createApiApiV14DirectPaymentsIntentsIntentIdPaymentMethod = async (args: CreateApiApiV14DirectPaymentsIntentsIntentIdPaymentMethodArgs, options?: CreateApiApiV14DirectPaymentsIntentsIntentIdPaymentMethodOptions) => { const {baseUrl = "https://web.moneyhash.io", fetch: fetchFn = fetch, ApiKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (ApiKeyAuth !== undefined) headers.set("X-Api-Key", ApiKeyAuth) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1.4/direct/payments/intents/${encodeURIComponent(String(args.intent_id))}/${encodeURIComponent(String(args.payment_method))}/${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 undefined };