PHP code example of shopid / idpay

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

    

shopid / idpay example snippets




//make idpay object
$idpay = new idPay(["apiKey"=>"6a7f99eb-7c20-4412-a972-6dfb7cd253a4","sandbox"=>true]);

//make a request

try {
$req = $idpay->apiRequest([

	    "order_id" => "1123",
            "amount" => 2000,
            "callback" => "https://www.mywebsite.com/",
            "name" => "shopid",
            "phone" => "09120000000",
            "mail" => "[email protected]",
            "desc" => "order 1123",
]);

print_r(json_decode($req));
} catch (Exception $error) {
      print_r(json_decode($error->getMessage()));
}


//verify peyment
try {
    
    $verify = $idpay->verify(
        [
	        "order_id" => "1123",        
            "id" => "350130d9fc8b5b569fecb600538f7e72",
        ]
    );
    var_dump(json_decode($verify));
} catch (Exception $error) {
          print_r(json_decode($error->getMessage()));
}