PHP code example of paytring / php

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

    

paytring / php example snippets



$api_key = "test_123";
$api_secret = "secret_123";

$paytring = new  \Paytring\Php\Api($api_key, $api_secret);

$amount_in_paisa  = "100";
$receipt_number  = "10123450";
$merchant_callback_Url  = "http://localhost:8000/callback";

$customer_info = [
    'name' => 'John Doe',
    'email' => '[email protected]',
    'phone' => '9234567890',    
];

$response = $paytring->CreateOrder( 
        $amount_in_paisa,
        $receipt_number, 
        $merchant_callback_Url, 
        $customer_info
    );

var_dump($response);


$api_key = "test_123";
$api_secret = "secret_123";

$paytring = new  \Paytring\Php\Api($api_key, $api_secret);

$pg_order_id  = "d234ew32r4345fd";

$fetchResponse = $paytring->FetchOrder($pg_order_id);

var_dump($fetchResponse);