The Email and Password refer to the email/password you use in signing into your merchant portal on https://merchant.rocketfuel.inc or equivalent.
The environment refers to the type of details you are using. You should choose production for real transactions and select sandbox when you are testing.
require_once(PATH_TO_RKFL.'../src/WEBHOOK_CLASS.php');
use RKFL\Client\WEBHOOK_CLASS as rkflWebhook
/**
* $_REQUEST wont work because the webhook is application/json format and not formdata format
*/
$payload = file_get_contents('php://input'); //use for receiving payload from RKFL SERVER
$payload = json_decode($payload);
$result = rkflWebhook::verify_callback($payload->data->data, $payload->signature);
if ($result) {
echo "verified \n";
} else {
echo 'not verified';
return;
}
rkflWebhook::validate_payment($payload->data);
// In case of Bank/Exchange payment
{
paymentMode: 'Bank/Exchange',
txn_id:
status:
meta:
},
Sample response:
{
paymentMode: 'Bank/Exchange',
txn_id: "7df55d22-fa5e-4ca2-9af4-a39c95f18b3a"
status: 0
meta: {offerId: "1630402767550"}
},
// In case of Wallet payment
{
paymentMode: 'Wallet',
status:
recievedAmount:
currency:
},
Sample response:
{
paymentMode: 'Wallet',
status:"completed",
recievedAmount:10.00,
currency:"ETH"
}
### JS Code snippet
var merchantAuth = function(merchantId) {
var buffer = Buffer.from(merchantId);
var encrypted = crypto.publicEncrypt(process.env.PUBLIC_KEY, buffer);
return encrypted.toString("base64");
}
const payload = {
firstName: firstName,
lastName, lastName,
email: email,
merchantAuth: "<%= merchantAuth %>",
}
rkfl = new RocketFuel({ environment: "<%= developmentEnv %>", });
rkfl.rkflAutoSignUp(payload, environment = "<%= developmentEnv %>").then((res) => {
// save this rkflToken for reference in the DB
// It is unique to each customer
res.result.rkflToken;
})})