PHP code example of bsecure / bsecure-php

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

    

bsecure / bsecure-php example snippets


\bSecure\bSecure::setClientId('<YOUR-CLIENT-ID>');
\bSecure\bSecure::setClientSecret('<YOUR-CLIENT-SECRET>');
\bSecure\bSecure::setAppEnvironment('<YOUR-APP-ENVIRONMENT>');
\bSecure\bSecure::getAuthToken();

\bSecure\Order::setOrderId('<YOUR-ORDER-ID>');
\bSecure\Order::setCustomer($customer);
\bSecure\Order::setShipmentDetails($shipment);
\bSecure\Order::setCartItems($products);
\bSecure\Order::setCharges($charges);
$result = \bSecure\Order::createOrder();
return $result;

$order_ref = $order->order_ref;

$result =  \bSecure\Order::orderStatus($order_ref);
return $result;

$client = bSecure\SSO::clientAuthenticate($state);
return redirect($client['redirect_url']); 


return bSecure\SSO::customerProfile('<AUTH-CODE>');

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

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

array (
  "redirect_url": "<SSO-REDIRECT-LINK>",
)