0.2.6 • Published 1 year ago
fleek-checkout v0.2.6
fleek-checkout
// Import the package
import UseFleekPay from "fleek-checkout";
// Send these three values from your webapp if you have SKU ID.
const options = {
clientID: "YOUR_KEY_ID", // Enter Client Key ID
clientSecret: "YOUR_SECRET_KEY", // Enter Client Secret Key
skuID: "YOUR_SKU_ID", // Enter SKU ID
phoneNo: "YOUR_PHONE_NUMBER", // Enter Phone Number (optional)
userName: "USER_NAME", // Enter User Name (optional)
userEmail: "USER_EMAIL_ID", // Enter User Email ID (optional)
duration: "DURATION", // Enter duration (optional)
durationType: "DURATION_TYPE", // Enter duration method (optional)
vendorOrderDetails: {} // Enter Vendor Order Details (optional)
};
OR
// Send these three values from your webapp if you have SKU Details.
const options = {
clientID: "YOUR_KEY_ID", // Enter Client Key ID
clientSecret: "YOUR_SECRET_KEY", // Enter Client Secret Key
phoneNo: "YOUR_PHONE_NUMBER", // Enter Phone Number (optional)
userName: "USER_NAME", // Enter User Name (optional)
userEmail: "USER_EMAIL_ID", // Enter User Email ID (optional)
duration: "DURATION", // Enter duration (optional)
durationType: "DURATION_TYPE", // Enter duration method (optional)
vendorOrderDetails: {} // Enter Vendor Order Details (optional)
skuDetails: {
add_on_amount: 0, // Enter add-on ammount
duration: 1, // Enter duration
duration_type: "M", // Enter duration type
name: "", // Enter plan name
amount: 550, // Enter amount
product_image: "" // Enter image url
}
};
// Call this method to open payment modal
const childRef = useRef(null);
const handlePaymentModal = () => {
childRef.current.openPaymentModal(options);
};
// Call this method to check the payment status
const checkPaymentStatus = function(paymentStatus) {
//paymentStatus will give an object with status and payment attribute, status shows that upi is validated and payment shows the status of the payment and will return two values ("paid" or "failed")
console.log('fleek payment status', paymentStatus);
}
// Add this in your render to open the Fleek payment plugin in your webapp.
<UseFleekPay ref={childRef} checkout={checkPaymentStatus} />