blood72/laravel-iamport

This package is abandoned and no longer maintained. No replacement package was suggested.

Iamport API for Laravel 7

v1.1.0 2020-11-23 16:50 UTC

This package is auto-updated.

Last update: 2023-09-24 20:51:49 UTC


README

아임포트(Iamport)는 국내 주요 PG사들을 쉽게 연동할 수 있도록 도와주는 서비스입니다.
Iamport is a service that helps major PG integrations easily.

이 패키지는 공식적으로 지원받는 패키지가 아닙니다.
This package is not officially supported.

Index

Requirement

  • PHP ^7.4
  • Laravel ^7.0 | ^8.0
  • Guzzle ^6.3 | ^7.0

Installation

composer를 통해 설치할 수 있습니다.
Install using the composer.

composer require blood72/laravel-iamport

설정 파일을 배포할 수 있습니다.
You can publish config file.

php artisan vendor:publish --provider="Blood72\Iamport\IamportServiceProvider"

Configuration

IAMPORT_KEYIAMPORT_SECRET 값이 필요합니다.
It requires IAMPORT_KEY and IAMPORT_SECRET.

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

Usage

Facade 혹은 resolve 메서드를 통해 사용할 수 있습니다.
You can use Facade or resolve methods.

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

메서드 구성은 Reference의 API 문서를 보면 도움이 됩니다.
It is helpful to understand method for seeing API documents of reference.

  1. getPayment(...$impUid)
    // 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');
  2. getPayments($status = 'all', $options = [])
    // same result (TODO)
    $payments = Iamport::getPayments('paid', ['limit' => 3]);
    // $payments = Iamport::getPayments([
    //     'status' => 'paid',
    //     'limit' => 3,
    // ]);
  3. findPayment($merchantUid, $status = null, array $options = [])
    $payment = Iamport::findPayment('merchant_1591942195747');
  4. findPayments($merchantUid, $status = null, array $options = [])
    $payment = Iamport::findPayment('merchant_1591942195747');
  5. setPreparePayment($merchantUid, $amount) & getPreparePayment($merchantUid)
    // return \Blood72\Iamport\Payloads\PreparedPayment::class
    $payment = Iamport::setPreparePayment('b72-ae8ea2f204bd2285c03918ec321fa4ff', 124);
    $payment = Iamport::getPreparePayment('b72-ae8ea2f204bd2285c03918ec321fa4ff');
  6. cancelPayment($impUid, ?int $amount = null, ?string $reason = null, array $options = [])
    // same result
    Iamport::cancelPayment($impUid, $amount, $reason);
    Iamport::cancelPayment([
        'imp_uid' => $impUid,
        'amount' => $amount,
        'reason' => $reason,
    ]);

TODO

Reference

License

이 패키지는 MIT 라이선스가 부여된 오프 소스 소프트웨어입니다.
This package is open-sourced software licensed under the MIT license.