JSFiddle - React, Tailwind, and code Playground

by Nick Karnik

HTML

<script src="https://api.sandbox.veritrans.co.id/v2/assets/js/veritrans.min.js"></script>

JavaScript

// Create the card object with the required fields
function card() {
  return {
    "card_number": "4111 1111 1111 1111",
    "card_exp_month": "01",
    "card_exp_year": "2020",
    "card_cvv": "123",
    "secure": true,
    "gross_amount": 123456
  }
};

// Create the callback function according to Veritrans response
function callback(response) {
        // Handling of Veritrans Callback Response Object explained below
				alert(JSON.stringify(response));
};

$(function() {

  //alert(JSON.stringify(card()));
	 Veritrans.url = "https://api.sandbox.veritrans.co.id/v2/token";
	Veritrans.client_key = "VT-client-48F8Ny8SvBjls0bp"
	//Get token function to be triggered when click pay
Veritrans.token(card, callback);
})