Created
September 8, 2023 03:07
-
-
Save rickithadi/4207a58a04d1d8bf7e9885b485c61ef1 to your computer and use it in GitHub Desktop.
client side dpay checkout init
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { | |
data: { access_token, id }, | |
} = await createDurianPayOrder(); | |
console.log(access_token, id); | |
// @ts-ignore | |
let dpay = await window.Durianpay.init({ | |
locale: "id", | |
environment: "production", // Value should be 'production' for both sandbox and live mode | |
access_key: access_token, | |
// access_key:'dp_test_XXXXXXXXX', | |
order_info: { | |
id, | |
customer_info: { | |
id: currentUser.uid, | |
email: currentUser.email, | |
}, | |
}, | |
onClose: function (response: any) { | |
console.log('closed', response) | |
}, | |
onSuccess: function (response: any) { | |
// this happens after the payment is completed successfully | |
console.log("success", response); | |
}, | |
onFailure: function (error: any) { | |
console.log("paymentFailed", error); | |
}, | |
}); | |
dpay.checkout(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment