PHP code example of expresspaygh / exp-php-sdk

1. Go to this page and download the library: Download expresspaygh/exp-php-sdk 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/ */

    

expresspaygh / exp-php-sdk example snippets


composer 



use Expay\SDK\MerchantApi as ExpressPayMerchantApi;

/**
 * $this->merchant_id = Your expressPay merchant id
 * $this->merchant_key = Your expressPay merchant api key
 * $this->environment = Your preferred environment, allowed params ('sandbox' or 'production')
 */
$merchantApi = new ExpressPayMerchantApi($this->merchant_id, $this->merchant_key, $this->environment);

/**
 * submit
 *
 * string $currency
 * float $amount
 * string $order_id
 * string $order_desc
 * string $redirect_url
 * string $account_number
 * string | null $order_img_url
 * string | null $first_name
 * string | null $last_name
 * string | null $phone_number
 * string | null $email
 */
$response = $merchantApi->submit(
  "GHS",
  20.00,
  "0925469924813",
  "Test create invoice",
  "https://expresspaygh.com",
  "1234567890",
  "https://expresspaygh.com/images/logo.png",
  "Jeffery",
  "Osei",
  "233545512042",
  "[email protected]"
);

// print
var_dump($response);



use Expay\SDK\MerchantApi as ExpressPayMerchantApi;

/**
 * $this->merchant_id = Your expressPay merchant id
 * $this->merchant_key = Your expressPay merchant api key
 * $this->environment = Your preferred environment, allowed params ('sandbox' or 'production')
 */
$merchantApi = new ExpressPayMerchantApi($this->merchant_id, $this->merchant_key, $this->environment);

/*
* Token returned from your "Submit" request
*/
$token = "43165f2bcf90eef856.514313495f2bcf90eef8b1.85035432516432mjhyte";

/**
 * checkout
 *
 * string $token
 */
$response = $merchantApi->checkout($token);

// print
var_dump($response);



use Expay\SDK\MerchantApi as ExpressPayMerchantApi;

/**
 * $this->merchant_id = Your expressPay merchant id
 * $this->merchant_key = Your expressPay merchant api key
 * $this->environment = Your preferred environment, allowed params ('sandbox' or 'production')
 */
$merchantApi = new ExpressPayMerchantApi($this->merchant_id, $this->merchant_key, $this->environment);

/*
* Token returned from your "Submit" request
*/
$token = "43165f2bcf90eef856.514313495f2bcf90eef8b1.85035432516432mjhyte";

/**
 * checkout
 *
 * string $token
 */
$response = $merchantApi->query($token);

// print
var_dump($response);



use Expay\SDK\MerchantApi as ExpressPayMerchantApi;

/**
 * $this->merchant_id = Your expressPay merchant id
 * $this->merchant_key = Your expressPay merchant api key
 * $this->environment = Your preferred environment, allowed params ('sandbox' or 'production')
 */
$merchantApi = new ExpressPayMerchantApi($this->merchant_id, $this->merchant_key, $this->environment);

/*
* Token returned from your "Submit" request
*/
$token = "43165f2bcf90eef856.514313495f2bcf90eef8b1.85035432516432mjhyte";

/**
 * checkout
 *
 * string $token
 */
$response = $merchantApi->query($token);

// print
var_dump($response);