Accept Payment via your application using payment code (Onsite & Checkout).
Transfer Money to other Payzoft Members via your application.
Payzoft is integrated with most major shopping carts like woocommerce, WHMCS e.t.c
USE THIS MERCHANT DEMO CREDENTIAL FOR TEST
Merchant Key : $2y$10$Ys3XCtoocLtI.mdqVZZ9Q.t.yx1uEQPhmcSkPz4rcHKU7exylWlLS
Merchant ID : 38
Merchant Currency Code : USD
Merchant Currency Symbol : $
Merchant Request URL : https://www.payzoft.com/purchase/link
Merchant Transaction Status URL : https://www.payzoft.com/request/status
Send a CURL POST request that contains (string) => 'merchant_key', (array) => 'invoice', and (string) => 'currency_code' variables to https://www.payzoft.com/purchase/link. As a response you get an array containing the link to the checkout page
The 'invoice' array must contain the keys [ items, invoice_id, 'invoice_description', total, return_url, cancel_url] and must be converted into a Json format before making the request.
$invoice['items'] = [ [ 'name' => 'Product 1', 'price' => (float)20.000, 'desciption' => 'Product 1 description', 'qty' => 1 ], [ 'name' => 'Product 2', 'price' => (float)10.00, 'desciption' => 'Product 2 description', 'qty' => 1 ], [ 'name' => 'Product 3', 'price' => (float)10.00, 'desciption' => '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'] = url('pay/success/?'); $invoice['cancel_url'] = url('pay/cancel'); $invoice = json_encode($invoice);
The payment request for this merchant should look like the example below:
$post = array( 'merchant_key'=> '$2y$10$Ys3XCtoocLtI.mdqVZZ9Q.t.yx1uEQPhmcSkPz4rcHKU7exylWlLS', 'invoice'=> $invoice, 'currency_code' => 'USD' ); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://www.payzoft.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); curl_close($ch);
Once you’ve got the response with the link in your website, redirect your user to the received link. The user will be asked to log in and pay the invoice.
// var_dump($response); if ($response['status'] == true) { //if response status is true, that means we have a link and we redirect the user to Payzoft header('Location: '.$response['link'].''); }else{ var_dump($response); }
When the user pays the invoice, he's redirected back to the URL specified in $invoice['return_url'] with a token as a query string.
Then in your website, use that token to make another CURL POST request to payzoft to check if the token is valid or not. by comparing the merchant id from the token and your merchant id. You can even check if the invoice from the token is the same as the invoice from your website database and mark your order as completed.
if (isset($_GET['token']) and !is_null($_GET['token'])) { $post = array( 'merchant_key'=> '$2y$10$Ys3XCtoocLtI.mdqVZZ9Q.t.yx1uEQPhmcSkPz4rcHKU7exylWlLS', 'token'=> $_GET['token'] ); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://www.payzoft.com/request/status' ); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $post); //var_dump(curl_exec($ch)); $response = json_decode(curl_exec($ch),true); curl_close($ch); // var_dump($response); if ($response['status'] == true) { if ($response['data']['entity_id'] == $this->payzoft_merchant_id) { // Handle your websites code here }else{ dd('invalid_merchant_id'); } }else{ var_dump($response); } }
Have any question? Please don't hesitate to reach out to us. We’ll get back to you shortly.