/** * Link Card (Card on File) Types * * ⚠️ CRITICAL REQUIREMENTS: * 1. HTML forms MUST include enctype="multipart/form-data" * 2. Required fields: merchant_id, return_param, hash * 3. Hash formula: merchant_id + ctid + return_param * * Example: *
* * * *
* * See: docs/LINK-CARD-REQUIREMENTS.md for complete documentation */ /** * Link Card request parameters */ export interface LinkCardRequest { /** Merchant ID - REQUIRED. A unique merchant key provided by ABA Bank (max 30 chars) */ merchant_id: string; /** Consumer identification number - OPTIONAL. Your customer's unique ID (max 255 chars) */ ctid?: string; /** Extra information to include when payment gateway calls return_url - REQUIRED (max 255 chars) */ return_param: string; /** Consumer first name - OPTIONAL (max 50 chars) */ firstname?: string; /** Consumer last name - OPTIONAL (max 50 chars) */ lastname?: string; /** Consumer email address - OPTIONAL. Must be valid email format (max 50 chars) */ email?: string; /** Consumer phone number - OPTIONAL (max 20 chars) */ phone?: string; /** Return URL for card details - OPTIONAL. Defaults to merchant profile pushback_url if not provided. Domain must be whitelisted. MUST be base64 encoded. */ return_url?: string; /** Continue URL after card linking success - OPTIONAL. Embedded in "Done" button after user links card successfully. MUST be base64 encoded. */ continue_add_card_success_url?: string; /** HMAC SHA-512 hash (Base64 encoded) - REQUIRED. Formula: merchant_id + ctid + return_param */ hash: string; } /** * Simple link card options * * Use this interface when calling generateFormParams() method. * The SDK will automatically generate the hash and include merchant_id. */ export interface LinkCardOptions { /** Consumer identification number - OPTIONAL. Your customer's unique ID (max 255 chars) */ ctid?: string; /** Extra information to include when payment gateway calls return_url - REQUIRED (max 255 chars). Often set to user ID. */ returnParam: string; /** Consumer first name - OPTIONAL (max 50 chars) */ firstname?: string; /** Consumer last name - OPTIONAL (max 50 chars) */ lastname?: string; /** Consumer email address - OPTIONAL. Must be valid email format if provided (max 50 chars) */ email?: string; /** Consumer phone number - OPTIONAL (max 20 chars) */ phone?: string; /** Return URL for card details - OPTIONAL. Defaults to merchant profile pushback_url if not provided. Domain must be whitelisted. MUST be base64 encoded. */ returnUrl?: string; /** Continue URL after card linking success - OPTIONAL. Embedded in "Done" button. MUST be base64 encoded. */ continueAddCardSuccessUrl?: string; } /** * Link card form parameters response * Used for generating client-side HTML forms */ export interface LinkCardFormResponse { /** Form action URL (full URL to PayWay endpoint) */ formAction: string; /** Form parameters including hash */ formParams: LinkCardRequest; } /** * Link card response */ export interface LinkCardResponse { /** URL to the card linking form */ url: string; /** Token timestamp */ token_time?: number; /** Token */ token?: string; /** ABA data */ aba_data?: string; /** RSA modules */ rsa_modules?: string; /** RSA exponent */ rsa_exponent?: string; /** Expiration timestamp */ expire_in?: number; /** Merchant configuration */ merchant?: { /** Primary color for the form */ primary_color?: string; /** Continue URL after success */ continue_add_card_success_url?: string; }; /** Status object */ status: { /** Status code ('00' = success) */ code: string; /** Status message */ message: string; /** Transaction ID / Return param */ tran_id: string; }; } /** * Remove card token request parameters */ export interface RemoveCardTokenRequest { /** Merchant ID */ merchant_id: string; /** Customer token ID */ ctid: string; /** Payment way token - token generated by the payment gateway */ pwt: string; /** HMAC SHA-512 hash */ hash: string; } /** * Simple remove card token options */ export interface RemoveCardTokenOptions { /** Customer token ID */ ctid: string; /** Payment way token - token generated by the payment gateway */ pwt: string; } /** * Remove card token response */ export interface RemoveCardTokenResponse { /** Status object */ status: { /** Status code ('00' = success, '1' = invalid hash, '11' = unexpected error, '26' = invalid merchant profile, '29' = invalid ctid or pwt) */ code: string; /** Status message */ message: string; }; }