PHP code example of passimpay / passimpay-php-api

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

    

passimpay / passimpay-php-api example snippets


$ composer 

$secretKey = '123';

$hash = $_POST['hash'];

$data = [
  'platform_id'  => (int) $_POST['platform_id'],  // Platform ID
  'payment_id'   => (int) $_POST['payment_id'],   // currency ID
  'order_id'     => (int) $_POST['order_id'],     // Payment ID of your platform
  'amount'       => $_POST['amount'],             // transaction amount
  'txhash'       => $_POST['txhash'],             // Hash or transaction ID. You can find the transaction ID in the PassimPay transaction history in your account.
  'address_from' => $_POST['address_from'],       // sender address
  'address_to'   => $_POST['address_to'],         // recipient address
  'fee'          => $_POST['fee'],                // network fee
];

if (isset($_POST['confirmations']))
{
  $data['confirmations'] = $_POST['confirmations']; // number of network confirmations (Bitcoin, Litecoin, Dogecoin, Bitcoin Cash)
}

$payload = http_build_query($data);

if (!isset($hash) || hash_hmac('sha256', $payload, $secretKey) != $hash)
{
  return false;
}

// payment credited
// your code...