GithubHelp home page GithubHelp logo

kipolaboratory / kipo-kpg Goto Github PK

View Code? Open in Web Editor NEW
0.0 0.0 0.0 17 KB

Kipopay payment gateway library OOP (PHP)

Home Page: https://kipopay.com

License: MIT License

PHP 100.00%
php payment kipo-pay oop php-library php-class

kipo-kpg's Introduction

PHP Kipo KPG Library: make payment easy with kipo

Latest Stable Version

PHP Kipo KPG Library make it easy to stablish payment with kipo gateway.

KipoPay Company logo



Installation

To install PHP Kipo KPG Library, simply:

$ composer require kipolaboratory/kipo-kpg

For latest commit version:

$ composer require kipolaboratory/kipo-kpg @dev

Requirements

PHP Kipo KPG Library works with PHP 5.6, 7.0, 7.1, 7.2.

Quick Start and Examples

Initial Kipo KPG and request shoping key from kipo server.

use kipolaboratory\KipoPay\KipoKPG;

/**
 * Initial Kipo Library and craete object from that class
 * Merchant key is merchant phone number
 */
$kipo = new KipoKPG(['merchant_key' => '09*********']);

/**
 * Replace "YOUR CALLBACK URL" and "AMOUNT" with what you want
 * KPGInitiate return ARRAY for result
 * Successful - ['status' => true, 'shopping_key' => SHOPING_KEY]
 * Failed - ['status' => false, 'message' => ERROR_MESAGE, 'code' => ERROR_CODE]
 */
$kpg_initiate = $kipo->KPGInitiate(AMOUNT, 'YOUR CALLBACK URL');

if ($kpg_initiate['status']) {
    /**
     * Store $kpg_initiate['shopping_key'] to session to verfiy
     * payment after user came back from gateway
     *
     * Call renderForm function to render a html form and send
     * user to Kipo KPG Gateway (you can create this form manually
     * where you want - form example is at the end of Quick Start
     */
     $kipo->renderForm($kpg_initiate['shopping_key']);
} else {
    /**
     * Show error to user
     *
     * You can call getErrorMessage and send error code to that
     * and get error message
     * $kipo->getErrorMessage(ERROR_CODE)
     */
}

Verify payment after user return back to CALLBACK URL

/**
 * Replace "SHOPPING_KEY" with your SHOPPING_KEY that you taken from
 * Initiate function
 *
 * KPGInquery return ARRAY for result
 * Successful - ['status' => true, 'referent_code' => REFERENT_CODE, 'amount' => PAYMENT_AMOUNT]
 * Failed - ['status' => false, 'message' => ERROR_MESAGE, 'code' => ERROR_CODE]
 */
$kpg_inquery = $kipo->KPGInquery(SHOPPING_KEY);
// Get shopping key after KPGInitiate called
$curl->getShoppingKey();
// Get referent code after KPGInquery called
$curl->getReferentCode();

Properties

// URL of Kipo KPG - https://webgate.kipopay.com/
// Shopping key must post to this url with SK name
$kipo->kipo_webgate_url;

HTML Form to transfer user to KPG

<form id="kipopay-gateway" method="post" action="KIPO_WEBGATE_URL" style="display: none;">
    <input type="hidden" id="sk" name="sk" value="SHOPING_KEY"/>
</form>
<script language="javascript">document.forms['kipopay-gateway'].submit();</script>

Error code and messages

  • -1: There is a problem with request parameters, please check them out (initial payment)
  • -2: There is a problem with parse requested data (please request again later)
  • -3: Connection error, API can't connect to KIPO server
  • -4: There is a problem with request parameters, please check them out (verify payment)
  • -5: Payment canceled by user or there is a problem
  • -6: Invalid Merchant key (Merchant mobile number)
  • -7: Minimum payment must be atleast 1.000 Rials
  • -8: Maximum payment must be 100.000.000 Rials
  • -9: Invalid payment token (shoping key) format

kipo-kpg's People

Contributors

kipolaboratory 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.