ramomen/laravel-yapikredi-pos

Laravel Yapı Kredi POS

dev-main 2023-06-28 09:37 UTC

This package is auto-updated.

Last update: 2024-10-28 12:24:10 UTC


README

YapiKrediPosLaravel is a library that enables the integration of Yapı Kredi Posnet into Laravel projects.

This library utilizes the Yapı Kredi Posnet API to perform payment transactions.

Installation

  1. Install the library into your Laravel project using composer:
    composer require ramomen/laravel-yapikredi-pos

After the library is installed, you need to configure the following settings in your .env file:

YAPIKREDI_MERCHANT_ID=000000000000000
YAPIKREDI_TERMINAL_ID=00000000
YAPIKREDI_MODE=test

Note: The YAPIKREDI_MODE setting can be set to either test or production. In the test mode, transactions will be performed in the test environment, while in the production mode, transactions will be performed in the live environment.

In the integration area, you can use the YapiKredi class. Here is an example usage:

use Ramomen\YapikrediPosLaravel\YapiKredi;


// Create an instance of YapiKredi and pass the Posnet instance as a parameter
$yapiKredi = new YapiKredi();

// Perform a sale transaction
$result = $yapiKredi->doSale(
    '1234567890123456', // Card number
    '1221', // Expiry date
    '123', // CVC
    'ABC123', // Order ID
    '100', // Amount
    'YT' // Currency
);

// Handle the result of the transaction
if ($result->status) {
    echo 'Transaction successful!' . PHP_EOL;
    echo 'Approval code: ' . $result->approvedCode . PHP_EOL;
    echo 'Activation code: ' . $result->activationCode . PHP_EOL;
    echo 'Mode: ' . $result->mode . PHP_EOL;
} else {
    echo 'Transaction failed!' . PHP_EOL;
    echo 'Error code: ' . $result->errorCode . PHP_EOL;
    echo 'Error message: ' . $result->posnetResponse . PHP_EOL;
    // You can access additional error details using $result->merchantInfo and $result->posnetResponseXMLData
}

Please note that the example above is just a demonstration, and you may need to adapt it to fit your specific integration requirements.

You can refer to the YapıKredi Posnet Documentation for error codes and more detailed information. This package is not official and does not have any affiliation with Yapı Kredi or Posnet. The names Yapı Kredi and Posnet are owned by Yapı ve Kredi Bankası A.Ş. All rights reserved.

Feel free to customize the README file as per your project's needs and provide additional information about the library, usage instructions, and any other relevant details.