3. Web App Setup

This section details the setup of the VPay JS Payment Dropin for desktop and mobile responsive web apps. All examples are made with reference to the SANDBOX environment.

With a few lines of code, you can integrate the VPay Javascript Dropin library and start accepting payments on your web and mobile web sites. The library is available at:

Sandbox: https://dropin-sandbox.vpay.africa/dropin/v1/initialise.js

Live: https://dropin.vpay.africa/dropin/v1/initialise.js

HTML Code Snippet (For Sandbox)

<!DOCTYPE html>
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Order Checkout Page</title>
        <script src="https://dropin-sandbox.vpay.africa/dropin/v1/initialise.js"></script>
        <!--Your HTML Content goes here-->
            (() => {
                const options = {
                    amount: 119,
                    currency: 'NGN',
                    domain: 'sandbox',
                    key: 'fdcdb195-6553-4890-844c-ee576b7ea715',
                    email: 'orderbuyer@givmail.com',
                    transactionref: 'z31zs098zas8w3774h44344f8yg',
                    customer_service_channel: '+2348030007000, support@org.com',
                    txn_charge: 6,
                    txn_charge_type: 'flat',
                    onSuccess: function(response) { console.log('Hello World!', response.message); },
                    onExit: function(response) { console.log('Hello World!', response.message); }
                    const {open, exit} = VPayDropin.create(options);

Each transactionref that you generate should be unique, alphanumeric and different from previously used ones. You may generate a ref using any scheme of your preference.

When setting up for your live web app, remember to edit the head <script> reference from the SANDBOX library used above, to the LIVE library i.e. https://dropin.vpay.africa/dropin/v1/initialise.js

Last updated