Created
January 6, 2021 18:16
-
-
Save gusLopezC/a852dee51047af03cf82401bccc8141b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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