Accept Payment (Inline)

Monicredit's Inline JS allows you to easily integrate our payment functionality into your websites, empowering your customers to make payments directly on your platform.

ParameterTypeRequiredDescription

public_key

string

Yes

Your Monicredit Public Key. You can get it from your dashboard.

order_id

string

Yes

Unique order ID you should provide for each transaction. It is case-sensitive.

customer

object

Yes

An object containing, basic information about the customer. e.g first_name, last_name

fee_bearer

string

Yes

Specify who will bear the Monicredit transaction fee, which can either be client or- merchant.

items

array

Yes

An array of items in this format: [{"item": "Demo Payment", "unit_cost": '500', "revenue_head_code": 'Rev_000000'}]

currency

string

No

Specify the currency you want to accept payment with. For now, we support only Naira. e.g NGN

meta_data

array

No

An array of your request meta data

paytype

string

No

Specify the method you are using for the payment. It can either be inline or standard

Specify the method you are using for the payment. It can either be inline or standard

ParameterTypeRequiredDescription

item

string

Yes

The name/title of the item to be paid for by the customer

unit_cost

string

Yes

Amount in the subunit of the supported currency you are debiting the customer.

revenue_head_code

string

Yes

Revenue head code generated from creating a revenue head.

split_details

array

No

A list of objects containing subaccount code, the sharing percentage, and a fee_flat parameter to add extra charges on the overall amount.

Sample Code

Installing the Monicredit’s Checkout Page is very easy and can be done by adding the checkout Javascript snippet to your website by copying the snippet code as shown below. The Monicredit script also has a demo version and a live version to suit your needs.

  • Demo JS: https://demo.monicredit.com/js/demo.js

  • Demo JS: https://demo.monicredit.com/js/demo.js

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Monicredit Dev</title>
  <script src="https://demo.monicredit.com/js/demo.js"></script>
    <script>
        function payWithMonicredit() {
            var handler = PayDirect.invoice({
            "public_key": "PUB_DEMO_Test",
            "order_id" : "transaction_id"
            "customer": {
                "first_name": 'Test',
                "last_name": 'Test',
                "email": 'test@test.com',
                "phone": '99000000000'
            },
            "fee_bearer": "client",
            "items": [
                {
                "item": "Demo Payment",
                "unit_cost": '500',
                "revenue_head_code": 'Rev_000000',
                "split_details": [
                    {
                        "sub_account_code": 'SB_000000',
                        "fee_percentage": 100,
                        "fee_flat": 0
                    }
	                ]
                },
            ],
            callback: function(response) {
                console.log(response);
                location.href ='/callback.php?reference='+response.reference_code;
            },
            onClose: function() {
                console.log('Window Closed.');
                location.href ='/index.php';
            }
            });
            handler.openIframe();
        }
        </script>
</head>
<body onload="payWithMonicredit()">
     
</body>
</html>

Last updated