foloosi-angular
v1.0.2
Published
Foloosi Payment Gateway for your Online Business.
Downloads
4
Maintainers
Readme
foloosi-angular
Foloosi Payment Gateway for your Online Business.
Install
with npm
npm install --save foloosi-angular
Usage
Foloosi Payment Gateway uses sensible defaults, so only minimal configuration via props is necessary.
Basic configuration
How to do configuration in your Angular Project?
Step 1
Add the below script in angular-cli.json.
"scripts": [
"./node_modules/foloosi-angular/index.js"
]
Step 2
In your Typescript file. follow the instructions.
To initialize the Foloosi Payment.
//To Declare the Foloosi Payment
declare var Foloosipay: any;
// For Success and Error Handlers. You can get the Payment status in the below function, it may be success or error.
const foloosiHandler = ( function (e) {
if (e.data.status == 'success') {
console.log(e.data.status);
console.log(e.data);
}
if (e.data.status == 'error') {
console.log(e.data.status);
console.log(e.data);
}
});
window.addEventListener('message', foloosiHandler);
//To Initialize the Foloosi Payment
constructor(){
Foloosipay.init();
}
To Open the Foloosi Payment Popup. Get the Reference Token(REFERENCE_TOKEN) from Step 3.
Foloosipay.open('REFERENCE_TOKEN','MERCHANT_KEY','REDIRECT');
If you want Redirection method and ApplePay options, you need to pass REDIRECT as true.
To Close the Foloosi Payment Popup
Foloosipay.close();
Step 3
Post the following data's in below API link to requesting reference token for accessing the payment gateway.
POST API LINK :
https://foloosi.com/api/v1/api/initialize-setup
HEADERS:
merchant_key : YOUR_MERCHANT_KEY
BODY:
redirect_url : YOUR_REDIRECT_URL
transaction_amount : YOUR_TRANSACTION_AMOUNT
currency : YOUR_CURRENCY_CODE
customer_name : OPTIONAL /*note : auto render in payment popup*/
customer_email : OPTIONAL /*note : auto render in payment popup*/
customer_mobile : OPTIONAL /*note : auto render in payment popup*/
customer_address : OPTIONAL /*note : minimize form fields in card detail page*/
customer_city : OPTIONAL /*note : minimize form fields in card detail page*/
site_return_url : YOUR_RETURN_URL /*note : Needed for Redirection method and also for ApplePay.*/
Supported Currencies areas follows : AED, USD, EUR, INR If you need optional parameters, you can add it your own data option name and values in Body. The above POST request returns the Response like below. In that response, you will get Reference Token. After that you need to assign this Reference token variable globally as mentioned in Step 1.
Response
{
"message": "Application setup successfully",
"data": {
"reference_token" : "YOUR_REFERENCE_TOKEN",
"payment_qr_data" : "YOUR_PAYMENT_QR_DATA",
"payment_qr_url" : "YOUR_PAYMENT_QR_URL"
}
}
Here, we are given QR code for your transaction amount. A we mentioned in above For example: In above the response, just take payment_qr_url and show in image tag
<img src ="payment_qr_url" width ="400px" height="400px">
width and height is depending on your requirement.
Step 4
When you click place order button our popup will be loaded so you can use below test card credentials to complete the order.
Card Number 4111 1111 1111 1111
Expiry 05/20
CVV 123
Card Number 4242 4242 4242 4242
Expiry 05/23
CVV 123
Step 5 (Optional)
For Transaction List details, you can use the below Get request to get the transaction based on your merchant key.
GET API LINK:
https://foloosi.com/api/v1/api/transaction-list
HEADERS:
secret_key : YOUR_SECRET_KEY
For Transaction Details, you can use the below Get request to get the transaction detail.
GET API LINK:
http://foloosi.com/api/v1/api/transaction-detail/YOUR_TRANSACTION_ID
HEADERS:
secret_key : YOUR_SECRET_KEY
Generate QR Code
Post the following data's in below API link to requesting QR code.This option for foloosi customer can do scan and pay transaction.
POST API LINK :
https://foloosi.com/api/v1/api/generate-qr-api
HEADERS:
secret_key : YOUR_SECRET_KEY
BODY:
amount : YOUR_TRANSACTION_AMOUNT
description : DESCRIPTION
Response
{
"message": "QR created successfully",
"data": {
"payment_qr_data" : "YOUR_PAYMENT_QR_DATA",
"payment_qr_url" : "YOUR_PAYMENT_QR_URL"
}
}
Here, we are given QR code for your transaction amount. A we mentioned in above For example: In above the response, just take payment_qr_url and show in image tag
<img src ="payment_qr_url" width ="400px" height="400px">
width and height is depending on your requirement.
Author
This component is written by Muthukumar D.
License
Foloosi 2019 © All Rights Reserved. foloosi