Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <script src="https://code.jquery.com/jquery-3.3.1.min.js"
- integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
- crossorigin="anonymous"></script>
- <script src="file:///android_asset/www/js/bKash-checkout-sandbox.js"></script>
- <style type="text/css">
- @font-face {
- font-family: MyFont;
- src: url("file:///android_asset/fonts/Mark_Simonson_Proxima_Nova_Alt_Regular_webfont.ttf")
- }
- body {
- text-align:center;
- font-family: MyFont;
- }
- p {
- font-weight: bold;
- font-size: 16px;
- }
- button {
- background-color: #0099cc;
- padding: 16px;
- color: white;
- }
- </style>
- </head>
- <body>
- <img src="file:///android_asset/www/images/bkash_payment.png" width="80%"/><br><br>
- <p id="amount"></p><br><br>
- <button id="bKash_button">Pay With bKash</button>
- <script type="text/javascript">
- var paymentConfig = {
- createCheckoutURL: "",
- executeCheckoutURL: "",
- };
- var paymentID = '';
- var orderId = 0;
- bKash.init({
- paymentMode: 'checkout',
- paymentRequest: { amount: '0', intent: 'sale', orderId: 0 },
- createRequest: function (request) {
- $('#amount').html('Amount: ' + request.amount + ' BDT');
- $.ajax({
- url: paymentConfig.createCheckoutURL,
- type: 'POST',
- contentType: 'application/json',
- data: JSON.stringify(request),
- success: function (response) {
- if (response && response.response_code == 200 && response.data.paymentID != null) {
- orderId = request.orderId;
- paymentID = response.data.paymentID;
- bKash.create().onSuccess(response.data);
- } else {
- bKash.create().onError();//run clean up code
- window.location.href = "file:///android_asset/www/checkout_failed.html"
- }
- },
- error: function () {
- bKash.create().onError();//run clean up code
- window.location.href = "file:///android_asset/www/checkout_failed.html"
- }
- });
- },
- executeRequestOnAuthorization: function () {
- $.ajax({
- url: paymentConfig.executeCheckoutURL,
- type: 'POST',
- contentType: 'application/json',
- data: JSON.stringify({ "paymentID": paymentID, "orderId": orderId }),
- success: function (response) {
- if (response.data && response.response_code == 200 && response.data.paymentID != null) {
- window.location.href = "file:///android_asset/www/checkoutSuccess.html";
- } else {
- bKash.execute().onError();//run clean up code
- window.location.href = "file:///android_asset/www/checkout_failed.html"
- }
- },
- error: function () {
- bKash.execute().onError();//run clean up code
- window.location.href = "file:///android_asset/www/checkout_failed.html"
- }
- });
- }
- });
- function callReconfigure(val) {
- bKash.reconfigure(val);
- }
- function clickPayButton() {
- $("#bKash_button").trigger('click');
- }
- function setUrls(createCheckoutURL, executeCheckoutURL) {
- paymentConfig.createCheckoutURL = createCheckoutURL;
- paymentConfig.executeCheckoutURL = executeCheckoutURL;
- }
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement