addispay-node-sdk
v1.0.1
Published
NPM
Downloads
1
Readme
Installation
NPM
npm i addispay
Yarn
yarn add addispay
usage
Once the installation process is complete, we can import the sdk in any file.
import Addispay from "addispay-checkout";
inside your component
const client = new Addispay({});
const transaction_detail = {
data={total_amount: "insert amount in birr",
tx_ref: "transaction reference",
currency: "your currency for local transaction use ETB",
first_name: "first name",
email: "email",
phone_number: "phone number",
last_name: "last name",
session_expired: "expiration delay for this transaction to expire in minutes",
nonce: unique key for this transaction,
success_url: "success url",
cancel_url: "cancel url",
error_url: "error",
order_detail: {your order detail}},
messgae:"thank you",
apiKey: "Your API KEY",
merchantName: "Your company name"};
const makePayment=()=>{
client.payNow(transaction_detail,"public key")
.then((response) => {
window.open(response);
}
});
}
Example
const client = new Addispay({});
const transaction_detail = {
data:{total_amount: "2",
tx_ref: "222",
currency: "ETB",
first_name: "abebe",
email: "[email protected]",
phone_number: "921309013",
last_name: "kebede",
session_expired: "5000",
nonce: new Date().toISOString(),
order_detail: {
items: "test item",
description: "I am testing this",
},
success_url: "Your Success URL",
cancel_url: "Your Cancel URL",
error_url: "Your Error URL",
},
messgae:"thank you",
apiKey: "Your API KEY",
merchantName: "Your company name",
};
const test = () => {
client
.payNow(
transaction_detail
)
.then((res) => {
if (transaction_detail.success_url) {
console.log({ zzzzzz: res });
} else {
window.open(res);
}
console.log({ urltosend: res });
});
};