PHP code example of ratapay / ratapayphp

1. Go to this page and download the library: Download ratapay/ratapayphp 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/ */

    

ratapay / ratapayphp example snippets


$valid = hash_equals($_POST['hash'], hash_hmac('sha256', $_POST['data'], $merchant_key));
 php
 php
$invoice = new \ratapay\ratapayphp\Invoice($data);
 php
$item = new \ratapay\ratapayphp\Item($data);
 php
$beneficiary = new \ratapay\ratapayphp\Beneficiary($data);
 php
$client = new \ratapay\ratapayphp\Client($merchant_id, $merchant_secret, $api_key, $api_secret, $sandbox);
 php
$result = $client->createTransaction($invoice);
 php
$result = $client->listTransaction($reference = '', $invoice_id = '', $creation_time = [], $paid_time = [], $offset = 0, $limit = 5);
 php
$result = $client->confirmSplit($reference, $item_ids = []);
 php
$result = $client->extendRefund($reference, $period, $item_ids = []);
 php
$result = $client->confirmRefund($reference, $params);
 php
$result = $client->getAccount();
 php
$result = $client->registerAccount(['email'=>$email,'name'=>$name,'password'=>$password]);
 php
$result = $client->getAccount(['email' => $email]);
 php
$result = $client->linkAccount($email, $username);
 php
$result = $client->addBeneficiaries($ref, $beneficiaries);