PHP code example of payrex / payrex-php

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

    

payrex / payrex-php example snippets






$client = new \Payrex\PayrexClient('Your PayRex secret api key');
$paymentIntent = $client->paymentIntents->create([
    'amount' => 10000,
    'currency' => 'PHP',
    'payment_methods' => ['card']
]);

echo $paymentIntent->id;

try {
    $client = new \Payrex\PayrexClient('Your PayRex secret api key');
    $paymentIntent = $client->paymentIntents->create([
        'amount' => 10000,
        'currency' => 'PHP',
        'payment_methods' => ['card']
    ]);
} catch(\Payrex\Exceptions\InvalidRequestException $e) {
   print "<pre>";
   print_r($e->getError());
   print "</pre>";
}
bash
composer