Skip to content
This repository has been archived by the owner on Aug 19, 2024. It is now read-only.

Latest commit

 

History

History
80 lines (58 loc) · 1.84 KB

README.md

File metadata and controls

80 lines (58 loc) · 1.84 KB
$api = new HitPay\HitPay(API_KEY);

Installing via Composer

$ php composer.phar require Hit-pay/hitpay_php_wrapper

Usage - Sandbox

$api = new HitPay\HitPay(API_KEY, true);

Create a new Payment Request

try {
    $response = $api->paymentRequestCreate(array(
        'amount'    =>  '1.00',
        'currency'  =>  'sgd'
        ));
    print_r($response);
}
catch (Exception $e) {
    print('Error: ' . $e->getMessage());
}

This will give you JSON object containing details of the Payment Request that was just created.

Get the details of a Payment Request

try {
    $response = $api->paymentRequestStatus('[PAYMENT REQUEST KEY]');
    print_r($response);
}
catch (Exception $e) {
    print('Error: ' . $e->getMessage());
}

This will give you JSON object containing details of the Payment Request.

Here ['PAYMENT REQUEST KEY'] is the value of 'key' key returned by the paymentRequestStatus() query.

Get a list of all Payment Request

try {
    $response = $api->paymentRequestsList();
    print_r($response);
}
catch (Exception $e) {
    print('Error: ' . $e->getMessage());
}

This will give you an array containing Payment Requests created so far.

Available Payment Request Functions

You have these functions to interact with the Payment Request API:

  • paymentRequestCreate(array $paymentRequest) Create a new Payment Request.
  • paymentRequestStatus($key) Get details of Payment Request specified by its unique key.
  • paymentRequestsList() Get a list of all Payment Requests.

Payment Request Creation Parameters

Required

  • amount: Payment Request ID for which Payment Request is being requested.
  • currency: A three letter currency-code.

Further documentation is available at https://staging.hit-pay.com/docs.html