PHP code example of bsecure / bsecure-payments

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

    

bsecure / bsecure-payments example snippets


return [
    'client_id' => env('BSECURE_CLIENT_ID', ''),
    'integration_type' => env('BSECURE_INTEGRATION_TYPE','sandbox'), //use 'production' for live orders and 'sandbox' for testing orders. When left empty or `null` the sandbox environment will be used
    'store_slug' => env('BSECURE_STORE_SLUG'),   //If store id is not mentioned your orders will be marked against your default store
    'merchant_id' => env('BSECURE_MERCHANT_ID'),   //If store id is not mentioned your orders will be marked against your default store
];

[
    'order_id' => '',
    'transaction_dt' => Carbon::now()->toString(),
    'sub_total_amt' => '',
    'discount_amt' => '',
    'total_amt' => '',
    'redirect_url' => '',
],

[
    'name' => '',
    'country_code' => '',
    'phone_number' => '',
    'email' => '',
],

[
    'country' => '',
    'province' => '',
    'city' => '',
    'area' => '',
    'address' => '',
],

use bSecure\Payments\BsecurePayments;

$order = new BsecurePayments();

$order->setTransactionDetails($transactionDetails);
$order->setCustomer($customer);
$order->setCustomerAddress($customerAddress);

return $order->createOrder();
return $result;

use bSecure\Payments\BsecurePayments;

$order_ref = $order->order_ref;

$orderStatusUpdate = new BsecurePayments();
$result =  $orderStatusUpdate->orderStatusUpdates($order_ref);
return $result;

if(!empty($result['checkout_url']))
return redirect($result['checkout_url']); 

if(!empty($result['order_reference']))
return $result['order_reference'];