Sha256: 7dfae0b39445f8c64c91917e720d7a9f054be1af2c0db7e5f0279e47016f3708

Contents?: true

Size: 1.2 KB

Versions: 1

Compression:

Stored size: 1.2 KB

Contents

<!doctype html>
<html>
<head>
  <title>veritrans-ruby demo</title>
  <link rel="icon" type="image/x-icon" href="https://account.veritrans.co.id/favicon.ico" />
  <link rel="stylesheet" href="/style.css">
</head>
<body>

<header>
  <h3>
    <a href="/">Veritrans sinatra app</a>
  </h3>
</header>

<section>
  <h4>Veritrans Widget</h4>

  <section>
    <p>
      <label>Snap Token</label>
      <input type="text" id="token" value="<%= @token %>" readonly>
    </p>
    <button id="snap_pay">Pay Now</button>
  </section>
</section>

<script src="https://app.sandbox.midtrans.com/snap/snap.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

<script type="text/javascript">
$('#snap_pay').on('click', function (e) {
  e.preventDefault();
  snap.pay($('#token').val() + "?locale=en", {
    onSuccess: function (res) {
      console.log('onSuccess', res);
      alert(res.status_message + "\nRedirecting to confirm page...");
      window.location = "/widget/confirm/" + res.transaction_id;
    },
    onPending: function (res) {
      console.log('onPending', res);
    },
    onError: function (res) {
      console.log('onError', res);
    }
  });
});
</script>

</body>
</html>

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
veritrans-2.1.3 example/widget.erb