Skip to main content

Creating A Subscription Fee For Your Extension

Use platform client to create a subscription charge. Billing API has a test parameter using which you can create a test charge and it will simulate a successful transaction.


let fdkExtension = require("./app/fdk");let platformClient = await fdkExtension.getPlatformClient(company_id);
let response = await platformClient.billing.createSubscriptionCharge({    extensionId: fdkExtension.extension.api_key,    body: {        name: plan.name,        test: true,        line_items: [            {                name: "Standard Plan",                term: "",                price: {                    amount: 200,                    currency_code: "INR"                },                pricing_type: "recurring",                recurring: {                    interval: "month",                    interval_time: 1                }            }        ],        return_url: "YOUR return after success of charge approval"    }});
// redirect user to confirmation url to approve subbscription// response.confirm_url
note

For production use-case, store the subscription id and utilize it to maintain seller subscription status on your DB for showing the features. Once the subscription is approved, it will redirect back to the return URL with a success or fail status.