PHP code example of mobbex / sdk
1. Go to this page and download the library: Download mobbex/sdk 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/ */
mobbex / sdk example snippets
try {
$mb = new MB('API_KEY', 'ACCESS_TOKEN');
} catch (Exception $e) {
echo $e->getMessage() . ' ' . $e->getCode();
}
$checkout_data = array(
'total' => 100.5,
'currency' => 'ARS',
'description' => 'Checkout description',
'return_url' => 'https://www.yourstore.com/mobbex-custom-return-url',
'reference' => 'QJYZ1234',
'webhook' => 'https://www.yourstore.com/mobbex-custom-webhook-url',
'redirect' => false,
'test' => true, // True, testing, false, production
'options' => array(
'theme' => array(
'type' => 'light', // dark or light color scheme
'showHeader' => true,
'header' => array(
'name' => 'Your brand name',
'logo' => 'https://www.yourstore.com/store-logo.jpg', // Must be https!
),
),
),
);
$result = $mb->mobbex_checkout($checkout_data);
print_r($result);
$result = $mb->get_transaction_status('TRANSACTION_ID');
print_r($result);