Payunit SDK for Javascript applications.
This SDK is designed to support applications developed in vanilla Javascript and some popular frontend frameworks like React and VueJs. However, If you develop applications using the angular framework, you may consider using our angular sdk for Payunit.
Installation
In the terminal, run
npm install payunitjs
Usage
In your checkout js file, do as follows;
import { PayUnit } from "node_modules/payunitjs/dist/payunit.min.js";
PayUnit(
{
apiUsername: "",
apiPassword: "",
x_api_key: "",
mode: "",
},
{
return_url: " ",
notify_url: " ",
description: "",
purchaseRef: "",
total_amount: "",
name: "",
currency: "XAF"
}
);
Using the sdk from its official CDN
<script type="module">
import { PayUnit } from "https://cdn.jsdelivr.net/npm/payunitjs@1.0.8/dist/payunit.min.js";
PayUnit(
{
apiUsername: "",
apiPassword: "",
x_api_key: "",
mode: "",
},
{
return_url: " ",
notify_url: " ",
description: "",
purchaseRef: "",
total_amount: "",
name: "",
currency: "XAF"
}
);
</script>
In the template or html file, type the following
<button id = "payunit-pay"> Pay </button>
After successfully integrating and testing in sandbox, to go live, you simply need to change to live credentials and the mode to live mode.