JSFiddle - React, Tailwind, and code Playground

by jgarrido

JavaScript

var url = "https://onlinepaymentscore.azurewebsites.net/api/OnlinePayments/PostTransaction";
// var url = "https://api.sandbox.payaconnect.com/v2/transactions";
var data = {
	"transaction": {
	  "action": "sale",
    "payment_method": "cc",
    "location_id": "11e9981a9030574abb984d0e",
    "transaction_amount": 1234.00,
    "account_holder_name": "Jake",
    "billing_zip": "80134",
    "account_number": "4111111111111111",
    "exp_date": "1022",
    "cvc": "123",
    "notification_email_address": "[email protected]"
  }
};

$.ajax({
	url: url,
  type: 'POST',
  dataType: 'JSON',
  contentType: 'application/json; charset=utf-8',
  headers: {
  	'user-id': '11e9981a9146d442a60a5105', 
    'user-api-key': '11ea9d84a2ce993295c2a2a0', 
    'developer-id': '9oIk6n7v'
  },
  data: JSON.stringify(data),
  success: function (result) {
    console.log("whoo!");
  },
  error: function (error) {
  	console.log("there was an error:", error);  
  }
});