uni-pay-web
v2.0.1
Published
A lightweight library for processing online payments and generating invoices with Moyasar, providing seamless payment info retrieval as well developed by UNICODE Team.
Downloads
21
Maintainers
Readme
Payment Gateway Library Crafted by the UNICODE Team.
A lightweight library for processing online payments and generating invoices with Moyasar, providing seamless payment info retrieval as well (🇸🇦💙🇧🇩❤️🇪🇬).
Features support
- Apple Pay
- Card support (Mada, Visa, AMEX and Mastercard)
- stc pay
Getting started and make your payment using the gateway.
UniPay.makePayment({
config: new UniPayConfig({
sKey: "sk_test_key",
environment: UniPayEnv.staging,
locale: UniPayLocale.ar,
}),
paymentData: new UniPayInvoiceDTO({
amount: 150.99 * 100, // (150.99 * 100) because 1 sr == 100 Halala's.
currency: UniPayCurrency.sar,
description: "Test payment",
expiredAt: "expiredAt - optional",
successUrl: "https://your-website.com/success",
backUrl: "https://your-website.com/back",
metadata: {
product_name: "your-product-name",
product_id: "abc123",
},
}),
});
Get payment transaction details from Moyasar using the paymentId or transactionId
UniPay.getPaymentTransactionById({
config: new UniPayConfig({ sKey: "sk_test_key" }),
transactionId: "abc12345",
});
Verify transaction from the callback url using the query-params, by your own if needed.
UniPay.verifyPaymentByQueryParams({
config: new UniPayConfig({
sKey: "sk_test_key",
urlSearchParams:
"Optional: you can provide your own query-params, otherwise it will use the current url as default.",
}),
});