# Using Gateway API
# Gateway API beta
The Gateway API enables you to accept payment from customers using a secure link.
# Installation
Follow the steps below to setup your site template:
Create a new file on your server. Copy the code metioned below and place it on the file you created You are good to go for adding your content now!
# HTML Structure
Paytriot follows a simple and easy to customize coding structure. This process is only for Gateway Bundle without template, If anyone wants to use with template please refer to component section. Here is the sample for your reference: The template is based on Bootstrap Framework.
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="https://pro.fontawesome.com/releases/v5.10.0/css/all.css"/>
<link rel="stylesheet"href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://gateway-api.paytriot.co.uk/Gateway/assets/css/style2.css">
</head>
<body data-spy="scroll" data-target=".idocs-navigation" data-offset="125">
<!-- Document Wrapper
=============================== -->
<div id="main-wrapper">
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#myModal"
id="popup">Submit</button>
<div class="container">
<div class="modal fade" id="myModal" role="dialog"></div>
</div>
<script src="https://gateway-api.paytriot.co.uk/Gateway/assets/js/script.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jsencrypt/2.3.1/jsencrypt.min.js"></script>
</body>
</html>
# Request
<script>
function patriot_pay_gateway(card_number, month, year, cvv, name_user) {
var ip_address = $.getJSON("https://api.ipify.org?format=json", function (data) {
return data.ip;
});
ip_address = ip_address['responseJSON']['ip'];
var user_id=""; //Enter Your Unique User Id Provided by Paytriot
var prd_name=""; //Add Your Product Name here
var amount=""; //Place the amount variable here. Please note it should be integer ex:-$18 i.e=1800
var currency=""; //You Are Allowed To Use Only These Three Currencies USD,GBP,EUR
var email=""; //Pass Email id here
var tracking_id=""; //Create a random intger of 16 digits here
var return_url="";//Place the return Url to Redirect back after Transaction is complete
$.ajax({
url:'https://gateway-api.paytriot.co.uk',
method:'post',
data:`transaction=true&type=101&user_id=${user_id}&card_number=${card_number}&month=${month}&year=${year}&cvv=${cvv}&name_user=${name_user}&prd_name=${prd_name}&amount=${amount}¤cy=${currency}&email=${email}&return_url=${return_url}&tracking_id=${tracking_id}&ip_address=${ip_address}`,
success: function (res) {
var data = jQuery.parseJSON(res);
if (data.result == true) {
location.replace(data.response);
} else if (data.result == false) {
console.log(data.response);
}
}
})
}
</script>
Please note that all the fields marked with asterisks (*) are mandatory.
# Currency codes
| Currency | Code | Availability |
|---|---|---|
| USD | 1 | Available |
| EUR | 4 | Available |