Swipe-Pay Plugin
Introduction
Swipe-Pay is a platform that helps you buy commodities from a merchant by borrowing from Swipe, it is a fast and reliable platform that makes the transaction seamless for both user and the merchant.
For Merchant to Integrate Swipe, It is recommended that this documentation is followed carefully and Sequentially.
Features
- It helps to make transactions easier and faster.
- Implementation of Buy Now, Pay Later (BNPL).
- Flexible payback plan.
How to Install
### Using the CDN
<script src="https://cdn.jsdelivr.net/npm/swipe-pay@2.0.1"></script>
### Using NPM
npm i swipe-pay
Then integrate the Swipe-pay widget by downloading it(refer to the first section of the JavaScript), and copying the section below as a component of your application, that way you can use it in places as befitting.
<swipe-pay-widget
merchant-id="999612213216313344" //merchantid
pay-amount= 240 //number
fallback-url = 'https://google.com/' //fallbackurl //appendrefurl
>
</swipe-pay-widget>
Parameters
- Merchant-id : this is the id assigned to merchants when they register with Swipe, the data-type must be a string value.
- Pay-amount : is the amount the user intends to pay, it must be of a data-type number
- Fallback-URL : this is the URL the application returns to after every successful transaction, in which the transaction-id is attached so that the merchant can track the transaction through an endpoint that will be provided to the merchant separately.
Event Listener
The merchant application can be configured to implement some instructions by tapping into the onClose event listener when the Swipe application is closed.
The example below shows how:
// Say the merchant wants a windows alert on close of the swipe plugin
window.addEventListener("swipe.connect.on_exit", function(evt) {
// Set of instructions to be executed
alert('Event closed');
// onClose handler here
}, false);
Run the Examples
If you'd like to test-run the examples, first clone Swipe-pay into your-project (or wherever you want):
$ git clone https://github.com/SwipeTech-Limited/swipe-pay-plugin.git
Change the directory to your-project.
$ cd your-project
Run the project
$ node index.js