PHP code example of blood72 / laravel-iamport

1. Go to this page and download the library: Download blood72/laravel-iamport library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

blood72 / laravel-iamport example snippets


// in iamport.php
'id' => env('IAMPORT_ID_CODE'), // 가맹점 식별코드 (Merchant ID)
'key' => env('IAMPORT_KEY', 'imp_apikey'),
'secret' => env('IAMPORT_SECRET', 'ekKoeW8RyKuT0zgaZsUtXXTLQ4AhPFW3ZGseDA6bkA5lamv9OqDMnxyeB9wqOsuO9W3Mx9YSJ4dTqJ3f'),

$payments = app('iamport')->getPayments();
$payments = Iamport::getPayments();

    // same result
    $payment = Iamport::getPayment('imp_779297761907');
    $payment = app('iamport')->getPayment(282589766101); // method adds 'imp_' automatically

    // return \Illuminate\Support\Collection::class
    $payments = Iamport::getPayment('imp_604050400483', 'imp_993488541671');
    

    // same result (TODO)
    $payments = Iamport::getPayments('paid', ['limit' => 3]);
    // $payments = Iamport::getPayments([
    //     'status' => 'paid',
    //     'limit' => 3,
    // ]);
    

    $payment = Iamport::findPayment('merchant_1591942195747');
    

    $payment = Iamport::findPayment('merchant_1591942195747');
    

    // return \Blood72\Iamport\Payloads\PreparedPayment::class
    $payment = Iamport::setPreparePayment('b72-ae8ea2f204bd2285c03918ec321fa4ff', 124);
    $payment = Iamport::getPreparePayment('b72-ae8ea2f204bd2285c03918ec321fa4ff');
    

    // same result
    Iamport::cancelPayment($impUid, $amount, $reason);
    Iamport::cancelPayment([
        'imp_uid' => $impUid,
        'amount' => $amount,
        'reason' => $reason,
    ]);
    
bash
php artisan vendor:publish --provider="Blood72\Iamport\IamportServiceProvider"