UNPKG

@tamara-solution/checkout

Version:

Script will be embedded in merchant's site to checkout. The merchant's don't need to redirect to tamara's site.

151 lines (146 loc) 5.04 kB
<html> <head> <meta charset="utf-8" /> <meta name="theme-color" content="#6DC8BF" /> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> <meta name="renderer" content="webkit" /> <meta name="mobile-web-app-capable" content="yes" /> <meta name="apple-mobile-web-app-capable" content="yes" /> <meta name="viewport" content="width=device-width, height=device-height, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0 shrink-to-fit=no" /> <!-- Bootstrap CSS only --> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous" /> <script> let partnerToken = '' </script> </head> <body> <div class="container"> <h1 class="text-center">Tamara Checkout Frame Demo</h1> <div id="message"></div> <form style="max-width: 370px" class="mx-auto mt-3" id="partner-login-form" > <div class="form-group"> <label for="exampleInputEmail1">Merchant's Email</label> <input type="email" name="email" class="form-control" id="exampleInputEmail1" value="" aria-describedby="emailHelp" /> <small id="emailHelp" class="form-text text-muted"> We'll never share your email with anyone else. </small> </div> <div class="form-group"> <label for="exampleInputPassword1">Password</label> <input type="password" name="password" class="form-control" id="exampleInputPassword1" value="" /> </div> <div class="form-group"> <span id="form-message" class="text-danger"></span> </div> <button type="submit" class="btn btn-primary">Submit</button> </form> <div style=" z-index: 1999; display: flex; align-items: center; justify-items: center; max-width: 100vw; max-height: 100vh; display: none; " id="cart-checkout" > <div class="mb-3 d-flex flex-row justify-content-end"> <select class="custom-select" style="max-width: 200px" id="select-language" > <option selected value="en_US">English</option> <option value="ar_SA">Arabic</option> </select> </div> <div class="mb-3"> <textarea class="cart-data w-100" disabled="true" rows="16" spellcheck="false" ></textarea> </div> <div class="mb-3 d-flex flex-row justify-content-center align-items-center" > <button type="button" class="btn btn-primary" id="checkoutButton"> Checkout </button> </div> </div> </div> <!-- JS, Popper.js, and jQuery --> <script src="https://code.jquery.com/jquery-3.5.1.min.js" crossorigin="anonymous" ></script> <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js" integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN" crossorigin="anonymous" ></script> <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV" crossorigin="anonymous" ></script> <script src="https://staging-tamara-cdn.s3.me-south-1.amazonaws.com/checkout/example/js/simple.js"></script> <!-- END Bootstrap config --> <script> function success() { document.getElementById('cart-checkout').remove() document.getElementById('message').innerHTML = "Merchant's site has received the event SUCCESS from tamara" } function failed() { document.getElementById('cart-checkout').remove() document.getElementById('message').innerHTML = "Merchant's site has received the event FAILED from tamara" } function cancel() { document.getElementById('cart-checkout').remove() document.getElementById('message').innerHTML = "Merchant's site has received the event CANCELED from tamara" } function init() { TamaraFrame.addEventHandlers(TamaraFrame.Events.SUCCESS, success) TamaraFrame.addEventHandlers(TamaraFrame.Events.FAILED, failed) TamaraFrame.addEventHandlers(TamaraFrame.Events.CANCELED, cancel) } var tamaraCKOConfig = { namespace: 'TamaraFrame', init: init, } </script> <script src="https://staging-tamara-cdn.s3.me-south-1.amazonaws.com/checkout/checkoutFrame.min.js"></script> </body> </html>