Code Monkey home page Code Monkey logo

ipaymu's Introduction

Ipaymu (Payment Gateway Indonesia)

Latest Stable Version Total Downloads Latest Unstable Version License

Ipaymu API PHP Class Library berfungsi untuk melakukan request API Ipaymu.

Instalasi

Cara terbaik untuk melakukan instalasi library ini adalah dengan menggunakan Composer

composer require steevenz/ipaymu

Penggunaan

use Steevenz\Ipaymu;

/*
 * --------------------------------------------------------------
 * Inisiasi Class Ipaymu
 * --------------------------------------------------------------
 */
 // Untuk menggunakan API Ipaymu Account saja.
 $ipaymu = new Ipaymu();
 $ipaymu->setApiKey('API_KEY_ANDA');
 
 // Untuk menggunakan API Ipaymu Account dan Webstore.
 $ipaymu = new Ipaymu([
    'apiKey' => 'API_KEY_ANDA',
    
    // Konfigurasi Url diperlukan untuk melakukan transaksi ke ipaymu
    'url' => [
        'return' => 'http://www.domainanda.com/terimakasih.html'
        'notify' => ' http://www.domainanda.com/notify-ipaymu.php'
        'cancel' => 'http://www.domainanda.com/batal.html'
    ]
 ]);
 
/*
 * --------------------------------------------------------------
 * Mendapatkan informasi akun Ipaymu
 * 
 * @return array
 * --------------------------------------------------------------
 */
$account = $ipaymu->getAccount();

/*
 * --------------------------------------------------------------
 * Cek Saldo Akun
 * Untuk mengecek jumlah saldo terakhir Anda.
 *
 * @return int
 * --------------------------------------------------------------
 */
$balance = $ipaymu->checkAccountBalance();

/*
 * --------------------------------------------------------------
 * Cek Status Akun
 * Untuk mengecek status akun iPaymu.
 *
 * @return string
 * --------------------------------------------------------------
 */
$status = $ipaymu->checkAccountStatus();

/*
 * --------------------------------------------------------------
 * Cek Transaksi
 *
 * @param string $trxId Kode Unik Transaksi.
 * @return array|bool Returns FALSE if failed.
 * --------------------------------------------------------------
 */
$transaction = $ipaymu->checkTransaction('IDX-1234567890');

/*
 * --------------------------------------------------------------
 * Melakukan transaksi pembayaran dengan single produk
 *
 * @return array|bool   Returns FALSE if failed or returns array contains
 *                      Ipaymu transaction Url.
 * --------------------------------------------------------------
 */
$ipaymu->addTransaction([
   'id' => 'INV-1234567890',
   'product' => [
       'name' => 'Shoes'
       'price' => 10000,
       'quantity' => 1,
       'description' => 'Amazing Shoes'
   ]
]);

/*
 * --------------------------------------------------------------
 * Melakukan transaksi pembayaran PayPal dengan single produk
 * 
 * @return array|bool   Returns FALSE if failed or returns array contains
 *                      Ipaymu transaction Url.
 * --------------------------------------------------------------
 */
$ipaymu->addTransaction([
   'id' => 'INV-1234567890',
   'product' => [
       'name' => 'Shoes'
       'price' => 10000,
       'price_usd' => 1, // Wajib menyertakan harga dalam kurs USD
       'quantity' => 1,
       'description' => 'Amazing Shoes'
   ]
], '[email protected]');

/*
 * --------------------------------------------------------------
 * Melakukan transaksi pembayaran dengan multi produk
 * 
 * @return array|bool   Returns FALSE if failed or returns array contains
 *                      Ipaymu transaction Url.
 * --------------------------------------------------------------
 */
 $ipaymu->addTransaction([
      'id' => 'INV-1234567890',
      'products' => [
          [
              'name' => 'Shoes',
              'price' => 10000,
              'quantity' => 1,
              'description' => 'Amazing Shoes'
          ],
          [
              'name' => 'Bag',
              'price' => 5000,
              'quantity' => 2,
              'description' => 'Amazing Bag'
          ]
      ]
 ]);
 
 /*
  * --------------------------------------------------------------
  * Melakukan transaksi pembayaran PayPal dengan multi produk
  * 
  * @return array|bool   Returns FALSE if failed or returns array contains
  *                      Ipaymu transaction Url.
  * --------------------------------------------------------------
  */
  $ipaymu->addTransaction([
       'id' => 'INV-1234567890',
       'products' => [
           [
               'name' => 'Shoes',
               'price' => 10000,
               'price_usd' => 1, // Wajib menyertakan harga dalam kurs USD
               'quantity' => 1,
               'description' => 'Amazing Shoes'
           ],
           [
               'name' => 'Bag',
               'price' => 5000,
               'price_usd' => 1, // Wajib menyertakan harga dalam kurs USD
               'quantity' => 2,
               'description' => 'Amazing Bag'
           ]
       ]
  ], '[email protected]');

/*
 * --------------------------------------------------------------
 * Mendapatkan original response object.
 * --------------------------------------------------------------
 */
 $response = $ipaymu->getResponse();
 
/*
 * --------------------------------------------------------------
 * Mendapatkan informasi error.
 * --------------------------------------------------------------
 */
 $errors = $ipaymu->getErrors();

Untuk keterangan lebih lengkap dapat dibaca di Wiki

Ide, Kritik dan Saran

Jika anda memiliki ide, kritik ataupun saran, anda dapat mengirimkan email ke [email protected]. Anda juga dapat mengunjungi situs pribadi saya di steevenz.com

Bugs and Issues

Jika anda menemukan bugs atau issue, anda dapat mempostingnya di Github Issues.

Requirements

Referensi

Untuk mengetahui lebih lanjut mengenai RajaOngkir API, lihat di Dokumentasi API Ipaymu.

ipaymu's People

Contributors

steevenz avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.