Skip to content

Instantly share code, notes, and snippets.

@gusLopezC
Created January 6, 2021 18:16
Show Gist options
  • Save gusLopezC/a852dee51047af03cf82401bccc8141b to your computer and use it in GitHub Desktop.
Save gusLopezC/a852dee51047af03cf82401bccc8141b to your computer and use it in GitHub Desktop.
var axios = require('axios');
const { performance } = require('perf_hooks');
var data = JSON.stringify({"card_number":"4111111111111111",
"holder_name":"Juan Perez Ramirez","expiration_year":"21","expiration_month":"12","cvv2":"110","device_session_id":"kR1MiQhz2otdIuUlQkbEyitIqVMiI16f"});
var config = {
method: 'post',
url: 'https://sandbox-api.openpay.mx/v1/mdrhnprmsmxkgxtegzhk/cards',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Basic c2tfYzcxYmFiZDg2NWZkNDIwYjk0YmM1ODhhODU4NWMxMjI6'
},
data : data
};
let time = performance.now();
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
console.log(`${(performance.now() - time) / 1000} seconds`);
})
.catch(function (error) {
console.log(error);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment