RKFL create an invoice in their system before processing the payment. Once the payment is processed, the invoice turns into an order.
The merchant website must send the cart info to RKFL for creating an invoice. The API returns a redirect URL with a UUID. The merchant website can save this redirect URL for future purposes.
There are two ways of integration
Redirect: If merchant wants to use redirect approach, they can redirect shopper to the redirect link
Widget (Popup): In case merchant wants to use inline experience(without redirection), they can use UUID with JavaScript SDK. See here for the
The RKFL also supports recurring payments on subscribed products. If the shopper subscribed to a product and paid from the connected exchange, the RKFL can manage the recurring payment on the defined frequency and update the merchant server through a registered webhook. The subscription facility is only available on exchange payment.
The request payload also supports receiving some custom parameters from the merchant website. These custom parameters will return in the transaction status update webhook. The merchant can also define the HTTP method (GET/POST) to receive the webhook.
The length of the complete payload, including the custom parameters, must not exceed the max length of "GET" and "POST" requests.
The max length of the "GET" request is 2048 characters, and the max length of the "POST" request is 2M.
The merchants who want to integrate the RKFL-hosted checkout experience redirect the shopper to this URL.
The RKFL-hosted checkout page is the simplest way to use the RKFL services
Subscription
To add a subscription product to the invoice, you must pass additional details with the product object in the cart.
These details include
"isSubscription" - This should be set to true if the product is a subscription product
"frequency" - This describes how frequently the subscription will be charged
"subscriptionPeriod" - The duration for which the subscription will be active
"merchantSubscriptionId" - The unique subscription Id generated by the merchant
// Here is the sample of the request payload.
{
"amount": "",
"cart":[{
"id": "",
"price": "",
"name": "",
"quantity": "",
"key": "",
"totalPrice": "",
//only add the below, if the product is a subscription item.
"isSubscription": "",
"frequency": "",
"subscriptionPeriod":""
"merchantSubscriptionId": "",
"autoRenewal": true/false, // pass false on null for subscription item
}],
"currency": "",
"order": "",
"redirectUrl": "",
"customParameter": {
"returnMethod": "POST/GET",
"params": [
{
"name": "var",
"value": "1302*6649c8793fa687fe708618ae52344e26*1685*2*1*128*76"
},
{
"name": "custom",
"value": "1302|6649c8793fa687fe708618ae52344e26|2|1|128|2|1685"
}
]
},
customerInfo{
name: required (string)
email: required (string)
phone: optional (string)
address: optional (string)
},
shippingAddress{
firstname:optional (string)
lastname: optional (string)
phoneNo: optional (string)
address1: required (string)
address2: optional (string)
state: required (string)
city: required (string)
zipcode: optional (string)
country: required (string)
landmark: optional (string)
email: optional (string)
}
}
// isSubscription: true/false
// subscriptionPeriod: [number][period] - for example 1y, 2m, 3w
// autoRenewal: true/false // if false is passed merchants can manage the debit of subscription items
on their own or if passed true Rocketfuel will manage the subscriptions based on the frequency passed.
// frequency: weekly/monthly/quarterly/half-yearly/yearly
// merchantSubscriptionId: Subscription id for merchant system. This key will use to communicate the recurring payment status.
// If no shipping details are available, shippingAddress can be assigned null
i.e., shippingAddress : null
You can use siteInfo in the parameter to generate invoices from different websites/stores.
3. Once Merchant received the response as a True, then send the UUID as the response to the Merchant site.
On click of [Pay for your order with RocketFuel] paste below Code Snippet.
Code Snippet--
const request=require('request');
var options = {
method: "POST",
url: process.env.API_ENDPOINT + "auth/login",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
email: process.env.MERCHANT_EMAIL,
password: process.env.MERCHANT_PASS,
}),
};
request(options, function (error, response) {
if (error) throw new Error(error);
let accessToken = JSON.parse(response.body).result.access;
//place the order API Call
var options = {
method: "POST",
url: process.env.API_ENDPOINT + "hosted-page",
headers: {
authorization: "Bearer " + accessToken,
"Content-Type": "application/const"
}
},
body: JSON.stringify({
amount: "11.00",
merchant_id: process.env.MERCHANT_ID,
cart: [
{
id: "23",
name: "Album",
price: "11",
quantity: "1",
},
],
currency: "USD",
order: "390",
redirectUrl: "",
}),
};
request(options, function (error, response) {
if (error) throw new Error(error);
let resp = JSON.parse(response.body);
if(resp.result !== undefined && resp.result.url !==undefined){
let urlArr = resp.result.url.split("/");
let uuid = urlArr[urlArr.length - 1];
res.status(200).send({ uuid: uuid });
}else{
res.status(400).send({ error: "Failed to place order" });
}
});
});
Javascript Library
4.2 Once we get the response with the uuid. We will initialise an object of the above included script, while initialising the object we will pass following :-