Hello, world!.




Payment Button


PHP Integration Code

          
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

$invoice['items'] = [
    [
        'name' => 'Product 1',
        'price' => (float)20.000,
        'description'    =>  'Product 1 description',
        'qty' => 1
    ],
    [
        'name' => 'Product 2',
        'price' => (float)10.00,
        'description'    =>  'Product 2 description',
        'qty' => 1
    ],
    [
        'name' => 'Product 3',
        'price' => (float)10.00,
        'description'    =>  'Product 3 description',
        'qty' => 1
    ]
];

$invoice['invoice_id'] = rand(1,50); // should be the same invoice id as the one in your store database
$invoice['invoice_description'] = "Order with Invoice ".  $invoice['invoice_id'] ;
$invoice['total'] = 40.00;
$invoice['return_url'] = 'https://bitmetical.com/success.php';
$invoice['cancel_url'] = 'https://bitmetical.com/fail.php';

$invoice = json_encode($invoice);

$post = array(
'merchant_key'=> '$2y$10$JcgKXDDgk1JuZjYkcV0EAuxUMJYsYan.Fz32OlUNyggYYgrg1rqUu',
'invoice'=> $invoice,
'currency_code' =>  'USD'
);



$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://devv2.bitmetical.com/purchase/link' );
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);

$response = json_decode(curl_exec($ch),true);
var_dump($response);
curl_close($ch);
      

Request Response


          NULL
      

Payment link

Link