How to use MOBILEMONEY to submit a payin in Kenya.
Initialize the SDK using setPublishableKey method by providing the necessary parameters.
Pagsmile.setPublishableKey({
app_id: "166****044", //Use your own app_id taken from the dashboard.
public_key: "Pagsmile_sk_47****59728d70e9a", //Use your own key taken from the dashboard.
env: "sandbox",
region_code: "EAK",
prepay_id:
"dlFUbmtzUnN*****JQbz0=-c1420962",
})
.then((clientInstance) => {
console.log("successfully initiated!");
document
.getElementById("submit-pay")
.addEventListener("click", function (e) {
clientInstance
.createOrder()
.then((res) => {
console.log("res: ", res);
})
.catch((err) => {
console.log("Error: ", err);
});
});
})
.catch((err) => {
console.log("Error: ", err);
});
Use createOrder method of clientInstance; the user may need to enter OTP, (SDK automatically triggers OTP prompt)
Analyse the response
{
status: "success", // successfully created order
query: true, // use backend query for transaction status
auth_type: "STK_PROMPT", // user needs to confirm the transaction on mobile app
}
Note: 162************38 is pagsmile's test app id for sandbox, and MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ== is authorization token associated with the test app id.
Please use your own app_id and generate your own authorization token when testing.