Skip to content

RodosGrup/iyzi-laravel

Repository files navigation

Improved iyzico payment service for Laravel 💳

It is an iyzico payment service package developed for Laravel Library.

Installation 🚀

"repositories": [
        {
          "type": "vcs",
          "url": "https://github.com/RodosGrup/iyzi-laravel.git"
        }
    ],
composer require rodosgrup/iyzi-laravel
php artisan vendor:publish
IYZI_API_KEY=
IYZI_SECRET_KEY=
IYZI_BASE_URL=https://sandbox-api.iyzipay.com
IYZI_RETURN_URL=

BILLING_NAME="RODOS GRUP"
BILLING_CITY="SAKARYA"
BILLING_ADDRESS="Arabacıalanı mah. Mehmet Akif Ersoy Cad No 33 /J-K Serdivan /SAKARYA"

IYZI_RETURN_URL It is the route name you defined in the route file. Sample code is given below.

//web.php
Route::get('/return-test', [TestController::class, 'returnTest'])->name('returnTest');

//TestController in function
public function returnTest()
{
    return json_decode(collect(session('content')));
}

Working Status 🚀

  • Single Payment ✓
  • Card Transactions ✓
    • Card Storage
    • Query Stored Card
    • Delete Stored Card
    • Keep Second Card
  • Get paid with a storage card. ✓
  • Adding the stored cards to the database. ✓

Usage 💵 💴 💶 💷

Application Launch

$iyzi = app()->iyzico;

Single Payment

//Parameters to Send Single Payment
$data = [
    'Price' => '1',
    'BasketId' => 'TR3999',
    'CardHolderName' => 'Rodos Grup',
    'CardNumber' => '4059030000000009',
    'ExpireMonth' => '12',
    'ExpireYear' => '2030',
    'Cvc' => '322',
    'BuyerId' => 'Rodos Grup',
    'Name' => 'Batuhan',
    'Surname' => 'Haymana',
    'GsmNumber' => '536*******',
    'Email' => 'batuhan@rodosgrup.com',
    'IdentityNumber' => '12345678912',
    'Address' => 'Arabacıalanı mah. Mehmet Akif Ersoy Cad No 33 /J-K Serdivan /SAKARYA',
    'idItem' => '1',
    'Pname' => 'Aile Danışmanlığı Eğitimi Sertifika Programı',
    'Category' => 'Eğitim'
];

$start = $iyzi->startSinglePayment($data);

Card Storage

//Parameters to Send for Credit Card Storage
$data = [
    'Email' => 'batuhan@rodosgrup.com',
    'ExternalId' => 'TR-231231111123',
    'User_Id' => '673883839',
    'Alias' => 'Burası benim ilk kartım',
    'CardHolderName' => 'Batuhan Haymana',
    'CardNumber' => '4059030000000009',
    'ExpireMonth' => '12',
    'ExpireYear' => '2030'
];

$start = $iyzi->storageCard($data);

Storage Card Payment

//Parameters to Send Storage Card Payment
$data = [
    'Price' => '1',
    'BasketId' => 'TR3999',
    'UserKey' => 'WIN9SoDhzmqMKAOQ174GoSW63Iw=',
    'CardToken' => 'qLm9Ler4ThhY0hE8xRnhT67maX0=',
    'BuyerId' => 'Rodos Grup',
    'Name' => 'Batuhan',
    'Surname' => 'Haymana',
    'GsmNumber' => '536*******',
    'Email' => 'batuhan@rodosgrup.com',
    'IdentityNumber' => '12345678912',
    'Address' => 'Arabacıalanı mah. Mehmet Akif Ersoy Cad No 33 /J-K Serdivan /SAKARYA',
    'idItem' => '1',
    'Pname' => 'Aile Danışmanlığı Eğitimi Sertifika Programı',
    'Category' => 'Eğitim'
];

$start = $iyzi->paymentStorageCard($data);

Delete Card

//Parameters to Send to Delete Credit Card
$UserKey = 'WIN9SoDhzmqMKAOQ174GoSW63Iw=';
$cardToken = 'qLm9Ler4ThhY0hE8xRnhT67maX0=';

$start = $iyzi->deleteCard($UserKey,$cardToken);

Query Registered Card

//Parameters to Send for Registered Card Inquiry
$UserKey = 'WIN9SoDhzmqMKAOQ174GoSW63Iw=';

$start = $iyzi->cardList($UserKey);

Storing the second card belonging to the user

//Parameters required to store the second card of the user
$data = [
    'UserKey' => 'WIN9SoDhzmqMKAOQ174GoSW63Iw=',
    'User_Id' => '673883839',
    'Alias' => 'Bu benim ikinci kartım',
    'CardHolderName' => 'Batuhan Haymana',
    'CardNumber' => '4987490000000002',
    'ExpireMonth' => '12',
    'ExpireYear' => '2030'
];

$start = $iyzi->storingSecondCard($data);

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT