/** * Link Card Service (Card on File) * Handles card linking operations for Card on File feature */ import { BaseService } from './BaseService'; import { LinkCardFormResponse, LinkCardOptions, RemoveCardTokenRequest, RemoveCardTokenResponse, RemoveCardTokenOptions } from '../types'; /** * Service for Card on File (Link Card) operations */ export declare class LinkCardService extends BaseService { /** * Generate form parameters for client-side HTML form submission * * This method generates the form parameters that can be used to build an HTML form * that submits directly to PayWay. This is useful for client-side implementations * where you want to avoid sending the API key to the client. * * ⚠️ CRITICAL REQUIREMENTS: * - HTML forms MUST include: enctype="multipart/form-data" * - Required fields: merchant_id, return_param, hash * - Example:
* * Without the correct enctype, PayWay will reject the request. * * @param options - Link card options * @returns Form parameters including hash and formAction URL * * @example * // Generate form parameters * const formParams = linkCardService.generateFormParams({ * returnParam: 'rp-1582083583', * ctid: '239acf04eace99ea1590857c7066acf260e', * firstname: 'Samnang', * lastname: 'Sok', * email: 'sok.samnang@gmail.com', * phone: '0123456789', * returnUrl: 'https://yourapp.com/api/card-linked' * }); * * // Use in HTML form * // * // * // * // * // ... other fields ... * //
*/ generateFormParams(options: LinkCardOptions): LinkCardFormResponse; /** * Remove a customer's linked card token (simplified API) * * Removes a customer's linked card token from your platform. Once the token * is removed, this action cannot be undone, and the token will no longer be * valid for purchases. * * NOTE: Before using this API, ensure your profile has enabled the Card on File feature. * * @param options - Remove card token options * @returns Remove card token response * @throws {PayWayError} If request fails or validation errors occur * * @example * const result = await linkCardService.removeCardToken({ * ctid: '522235F63E4998...ABC270FC9FE07409F6ACD716B88', * pwt: '5222359B5394FF7B...259BFE3868B08461F' * }); * * if (result.status.code === '00') { * console.log('Card token removed successfully'); * } */ removeCardToken(options: RemoveCardTokenOptions): Promise; /** * Remove card token (low-level API) * * @param params - Full request parameters * @returns Remove card token response * @throws {PayWayError} If API request fails */ removeCard(params: RemoveCardTokenRequest): Promise; }