PHP code example of deepay / deepay-php

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

    

deepay / deepay-php example snippets




use DeePay\DeePay;

$deepay = new DeePay('Merchant ID', 'Api Key');


$params = array(
  'out_trade_id' => 'E201809123',
  'price_amount' => 10.0001,
  'price_currency' => 'CNY',
  'notify_url' => 'http://example.com/notify',
  'callback_url' => 'http://example.com/',
  'title' => 'iPhone X',
  'attach' => 'additional info'
);

$order = $deepay->createOrder($params);

// $order is an instance of \DeePay\Order
var_dump($order->toArray());

$order = $deepay->checkoutOrder(array(
  'transaction_id' => '20181121113652525198',
  // or use out_trade_id
  // 'out_trade_id' => 'E52525198',
  'pay_currency' => 'BTC',
  'email' => '[email protected]',
));

var_dump($order->toArray());

$order = $deepay->checkoutOrder('20181121113652525198');
// or use out_trade_id
$order = $deepay->checkoutOrder('E113652525198');

var_dump($order->toArray());

$order = $_POST;
if ($deepay->checkSign($order) {
	if ($order['status'] == 'confirmed') {
		// process the order according to status
	}
	
	// echo 'ok' when you finish the job
	exit('ok');
} else {
	echo 'Notifycation is invalid';
}
bash
composer 

$rate = \DeePay\DeePay::getExchangeRate('ETH', 'CNY');
var_dump($rate);