require __DIR__.'/vendor/autoload.php';
use RevenueMonster\SDK\RevenueMonster;
use RevenueMonster\SDK\Exceptions\ApiException;
// Initialise sdk instance
$rm = new RevenueMonster([
'clientId' => '5499912462549392881',
'clientSecret' => 'pwMapjZzHljBALIGHxfGGXmiGLxjWbkT',
'privateKey' => file_get_contents(__DIR__.'/private_key.pem'),
'isSandbox' => false,
]);
// Get merchant profile
try {
$response = $rm->merchant->profile();
} catch(ApiException $e) {
echo "statusCode : {$e->getCode()}, errorCode : {$e->getErrorCode()}, errorMessage : {$e->getMessage()}";
} catch(Exception $e) {
echo $e->getMessage();
}
// Get merchant subscriptions
try {
$response = $rm->merchant->subscriptions();
} catch(ApiException $e) {
echo "statusCode : {$e->getCode()}, errorCode : {$e->getErrorCode()}, errorMessage : {$e->getMessage()}";
} catch(Exception $e) {
echo $e->getMessage();
}
// Get merchant's stores
try {
$response = $rm->store->paginate(10);
} catch(ApiException $e) {
echo "statusCode : {$e->getCode()}, errorCode : {$e->getErrorCode()}, errorMessage : {$e->getMessage()}";
} catch(Exception $e) {
echo $e->getMessage();
}
// create QR pay
try {
$response = $rm->payment->qrPay([
"currencyType" => "MYR",
"amount" => 100,
"expiry" => [
"type" => "PERMANENT",
],
"isPreFillAmount" => true,
"method" => ["WECHATPAY"],
"order" => [
"title" => "test",
"detail" => "test",
],
"redirectUrl" => "https://www.baidu.com",
"storeId" => "10946114768247530",
"type" => "DYNAMIC",
]);
} catch(ApiException $e) {
echo "statusCode : {$e->getCode()}, errorCode : {$e->getErrorCode()}, errorMessage : {$e->getMessage()}";
} catch(Exception $e) {
echo $e->getMessage();
}