### Basic Usage Example Source: https://github.com/gnahotelsolutions/laravel-paycomet/blob/main/README.md A placeholder for basic usage. Actual implementation details will depend on the Paycomet API and package features. ```php // TODO ``` -------------------------------- ### Install Laravel Paycomet Source: https://github.com/gnahotelsolutions/laravel-paycomet/blob/main/README.md Install the package using Composer. This command adds the necessary dependencies to your Laravel project. ```bash composer require gnahotelsolutions/laravel-paycomet ``` -------------------------------- ### Register Card Token with addUser Source: https://context7.com/gnahotelsolutions/laravel-paycomet/llms.txt Register a new card in the Paycomet system to get a tokenized user ID for future transactions. Requires CVV, expiration date, PAN, order details, and language. ```php addUser( cvv: '123', expirationYear: '25', expirationMonth: '12', pan: '4111111111111111', order: 'ORDER-001', productDescription: 'Premium Subscription', language: 'en' ); // Response contains idUser and tokenUser for future transactions // $result->idUser - User identifier for stored card // $result->tokenUser - Token to use in subsequent payments ``` -------------------------------- ### User Authentication and Initialization Source: https://context7.com/gnahotelsolutions/laravel-paycomet/llms.txt Demonstrates how to initialize the ApiRest client with Paycomet credentials and outlines available payment method constants. ```APIDOC ## ApiRest Class ### Description The main class for interacting with the Paycomet REST API. Handles authentication, request execution, and provides methods for card management and payment processing. ### Initialization Example ```php executePurchase( order: 'ORDER-12345', amount: 9999, // Amount in cents (99.99 EUR) currency: 'EUR', ip: '192.168.1.100', // Customer IP address userId: '12345678', // idUser from addUser userToken: 'abc123xyz', // tokenUser from addUser description: 'Hotel Booking - 2 nights', urlOk: 'https://mysite.com/payment/success', urlKo: 'https://mysite.com/payment/failed', email: 'customer@example.com', paymentMethod: ApiRest::PAYMENT_METHOD_CARD, insecure: false // Use 3D Secure ); // Response contains transaction result // $payment->errorCode - 0 for success // $payment->authCode - Authorization code // $payment->challengeUrl - 3DS challenge URL (if applicable) ``` -------------------------------- ### Generate Payment URL with executePurchaseUrl Source: https://context7.com/gnahotelsolutions/laravel-paycomet/llms.txt Creates a secure URL for redirecting customers to the Paycomet hosted payment page. Requires valid API credentials and order details. ```php executePurchaseUrl( order: 'ORDER-67890', amount: 15000, // Amount in cents (150.00 EUR) currency: 'EUR', locale: 'en', // Payment page language urlOk: 'https://mysite.com/payment/success', urlKo: 'https://mysite.com/payment/failed' ); // Redirect customer to the payment URL // return redirect($paymentUrl); // Example generated URL: // https://api.paycomet.com/gateway/ifr-bankstore?MERCHANT_MERCHANTCODE=...&MERCHANT_TERMINAL=...&... ``` -------------------------------- ### Process Payment with executePurchase (Insecure/MIT) Source: https://context7.com/gnahotelsolutions/laravel-paycomet/llms.txt Execute an insecure payment transaction (Merchant Initiated Transaction) using a tokenized card, suitable for recurring or subscription payments. Does not use 3D Secure. ```php // For recurring/subscription payments (MIT - Merchant Initiated) $recurringPayment = $api->executePurchase( order: 'SUB-12345', amount: 1999, currency: 'EUR', ip: '192.168.1.100', userId: '12345678', userToken: 'abc123xyz', description: 'Monthly Subscription', urlOk: '', // Not used in insecure mode urlKo: '', email: 'customer@example.com', paymentMethod: ApiRest::PAYMENT_METHOD_CARD, insecure: true // MIT transaction, no 3DS ); ``` -------------------------------- ### addUser - Register Card Token Source: https://context7.com/gnahotelsolutions/laravel-paycomet/llms.txt Registers a new card in the Paycomet system and returns a tokenized user ID for secure storage and future transactions. ```APIDOC ## POST /api/users (addUser) ### Description Registers a new card in the Paycomet system and returns a tokenized user ID. This allows secure storage of card details for future transactions without handling sensitive card data directly. ### Method POST ### Endpoint /api/users ### Parameters #### Request Body - **cvv** (string) - Required - The CVV of the card. - **expirationYear** (string) - Required - The expiration year of the card (e.g., '25'). - **expirationMonth** (string) - Required - The expiration month of the card (e.g., '12'). - **pan** (string) - Required - The primary account number (card number). - **order** (string) - Required - An order identifier. - **productDescription** (string) - Required - A description of the product being purchased. - **language** (string) - Optional - The language for the transaction (e.g., 'en'). ### Request Example ```json { "cvv": "123", "expirationYear": "25", "expirationMonth": "12", "pan": "4111111111111111", "order": "ORDER-001", "productDescription": "Premium Subscription", "language": "en" } ``` ### Response #### Success Response (200) - **idUser** (string) - User identifier for the stored card. - **tokenUser** (string) - Token to use in subsequent payments. #### Response Example ```json { "idUser": "12345678", "tokenUser": "abc123xyz" } ``` ``` -------------------------------- ### Retrieve Card Information with infoUser Source: https://context7.com/gnahotelsolutions/laravel-paycomet/llms.txt Retrieve information about a previously tokenized card using its user ID and token. Returns masked card details and expiration information. ```php infoUser( id: '12345678', // idUser from addUser response token: 'abc123xyz' // tokenUser from addUser response ); // Response contains masked card details // $cardInfo->pan - Masked card number (e.g., "411111******1111") // $cardInfo->expiryDate - Card expiration date ``` -------------------------------- ### Process Bizum Payments with executePurchase Source: https://context7.com/gnahotelsolutions/laravel-paycomet/llms.txt Executes a payment transaction using the Bizum method. Ensure the paymentMethod parameter is set to ApiRest::PAYMENT_METHOD_BIZUM. ```php executePurchase( order: 'BIZUM-001', amount: 2500, // 25.00 EUR currency: 'EUR', ip: '192.168.1.100', userId: null, // No stored user for Bizum userToken: null, description: 'Restaurant Bill', urlOk: 'https://mysite.com/payment/success', urlKo: 'https://mysite.com/payment/failed', email: 'customer@example.com', paymentMethod: ApiRest::PAYMENT_METHOD_BIZUM, insecure: false ); ``` -------------------------------- ### executePurchase - Process Payment Source: https://context7.com/gnahotelsolutions/laravel-paycomet/llms.txt Executes a payment transaction using a tokenized card, supporting both secure (3D Secure) and insecure (MIT) modes. ```APIDOC ## POST /api/purchase (executePurchase) ### Description Executes a payment transaction using a tokenized card. Supports both secure (3D Secure) and insecure (MIT - Merchant Initiated Transaction) modes. ### Method POST ### Endpoint /api/purchase ### Parameters #### Query Parameters - **order** (string) - Required - An order identifier. - **amount** (integer) - Required - The transaction amount in cents (e.g., 9999 for 99.99 EUR). - **currency** (string) - Required - The currency code (e.g., 'EUR'). - **ip** (string) - Required - The customer's IP address. - **userId** (string) - Required - The user ID obtained from `addUser`. - **userToken** (string) - Required - The token obtained from `addUser`. - **description** (string) - Required - A description of the purchase. - **urlOk** (string) - Required - The URL to redirect to upon successful payment. - **urlKo** (string) - Required - The URL to redirect to upon failed payment. - **email** (string) - Required - The customer's email address. - **paymentMethod** (integer) - Required - The payment method (e.g., `ApiRest::PAYMENT_METHOD_CARD`). - **insecure** (boolean) - Required - Set to `true` for MIT transactions (no 3DS), `false` for secure 3D Secure transactions. ### Request Example (Secure Payment) ```json { "order": "ORDER-12345", "amount": 9999, "currency": "EUR", "ip": "192.168.1.100", "userId": "12345678", "userToken": "abc123xyz", "description": "Hotel Booking - 2 nights", "urlOk": "https://mysite.com/payment/success", "urlKo": "https://mysite.com/payment/failed", "email": "customer@example.com", "paymentMethod": 1, "insecure": false } ``` ### Request Example (Insecure/MIT Payment) ```json { "order": "SUB-12345", "amount": 1999, "currency": "EUR", "ip": "192.168.1.100", "userId": "12345678", "userToken": "abc123xyz", "description": "Monthly Subscription", "urlOk": "", "urlKo": "", "email": "customer@example.com", "paymentMethod": 1, "insecure": true } ``` ### Response #### Success Response (200) - **errorCode** (integer) - 0 indicates success. - **authCode** (string) - The authorization code for the transaction. - **challengeUrl** (string) - The URL for 3D Secure authentication challenges (if applicable). #### Response Example ```json { "errorCode": 0, "authCode": "123456", "challengeUrl": "https://secure.paycomet.com/challenge?token=..." } ``` ``` -------------------------------- ### infoUser - Retrieve Card Information Source: https://context7.com/gnahotelsolutions/laravel-paycomet/llms.txt Retrieves information about a previously tokenized card using its user ID and token. ```APIDOC ## GET /api/users/{id}/{token} (infoUser) ### Description Retrieves information about a previously tokenized card. Returns masked card details and expiration information for display purposes. ### Method GET ### Endpoint /api/users/{id}/{token} ### Parameters #### Path Parameters - **id** (string) - Required - The user ID obtained from the `addUser` method. - **token** (string) - Required - The token obtained from the `addUser` method. ### Response #### Success Response (200) - **pan** (string) - Masked card number (e.g., "411111******1111"). - **expiryDate** (string) - Card expiration date. #### Response Example ```json { "pan": "411111******1111", "expiryDate": "12/25" } ``` ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.