"bkash payment getway" Code Answer's

You're definitely familiar with the best coding language Whatever that developers use to develop their projects and they get all their queries like "bkash payment getway" answered properly. Developers are finding an appropriate answer about bkash payment getway related to the Whatever coding language. By visiting this online portal developers get answers concerning Whatever codes question like bkash payment getway. Enter your desired code related query in the search bar and get every piece of information about Whatever code related question on bkash payment getway. 

bkash payment getway

By Homely HamerkopHomely Hamerkop on May 17, 2021
let paymentID;

let createCheckoutUrl = 'https://merchantserver.sandbox.bka.sh/api/checkout/v1.2.0-beta/payment/create';
let executeCheckoutUrl = 'https://merchantserver.sandbox.bka.sh/api/checkout/v1.2.0-beta/payment/execute';

$(document).ready(function () {
    initBkash();
});

function initBkash() {
    bKash.init({
      paymentMode: 'checkout', // Performs a single checkout.
      paymentRequest: {"amount": '85.50', "intent": 'sale'},

      createRequest: function (request) {
        $.ajax({
          url: createCheckoutUrl,
          type: 'POST',
          contentType: 'application/json',
          data: JSON.stringify(request),
          success: function (data) {
              
            if (data && data.paymentID != null) {
              paymentID = data.paymentID;
              bKash.create().onSuccess(data);
            } 
            else {
              bKash.create().onError(); // Run clean up code
              alert(data.errorMessage + " Tag should be 2 digit, Length should be 2 digit, Value should be number of character mention in Length, ex. MI041234 , supported tags are MI, MW, RF");
            }

          },
          error: function () {
            bKash.create().onError(); // Run clean up code
            alert(data.errorMessage);
          }
        });
      },
      executeRequestOnAuthorization: function () {
        $.ajax({
          url: executeCheckoutUrl,
          type: 'POST',
          contentType: 'application/json',
          data: JSON.stringify({"paymentID": paymentID}),
          success: function (data) {

            if (data && data.paymentID != null) {
              // On success, perform your desired action
              alert('[SUCCESS] data : ' + JSON.stringify(data));
              window.location.href = "/success_page.html";

            } else {
              alert('[ERROR] data : ' + JSON.stringify(data));
              bKash.execute().onError();//run clean up code
            }

          },
          error: function () {
            alert('An alert has occurred during execute');
            bKash.execute().onError(); // Run clean up code
          }
        });
      },
      onClose: function () {
        alert('User has clicked the close button');
      }
    });

    $('#bKash_button').removeAttr('disabled');

}

Source: laptrinhx.com

Add Comment

0

All those coders who are working on the Whatever based application and are stuck on bkash payment getway can get a collection of related answers to their query. Programmers need to enter their query on bkash payment getway related to Whatever code and they'll get their ambiguities clear immediately. On our webpage, there are tutorials about bkash payment getway for the programmers working on Whatever code while coding their module. Coders are also allowed to rectify already present answers of bkash payment getway while working on the Whatever language code. Developers can add up suggestions if they deem fit any other answer relating to "bkash payment getway". Visit this developer's friendly online web community, CodeProZone, and get your queries like bkash payment getway resolved professionally and stay updated to the latest Whatever updates. 

Whatever answers related to "bkash payment getway"

View All Whatever queries

Whatever queries related to "bkash payment getway"

Browse Other Code Languages

CodeProZone