Skip to content

Instantly share code, notes, and snippets.

@gusLopezC
Created January 18, 2021 18:09
Show Gist options
  • Save gusLopezC/1986693c4cc5485b88e0004dc5d28ce9 to your computer and use it in GitHub Desktop.
Save gusLopezC/1986693c4cc5485b88e0004dc5d28ce9 to your computer and use it in GitHub Desktop.
pruebaAxios() {
//Remplazar Merchant_id
axios.post('https://api.openpay.mx/v1/MERCHANT/customers', {
name: "Alta cliente SPEI", //varEmail is a variable which holds the email
last_name: "Integracion",
email: "customer_email@me.com"
},
{
headers: {
'Content-Type': 'application/json',
/*Es necesario convertir Y remplazar su llave privada a Base64 y agregando dos puntos
quedando de la siguiente manera y agregar dos puntos al final con la pagina
https://www.convertstring.com/es/EncodeDecode/Base64Encode
Ejemplo:
sk_fe4d4000000000000000f7:
La cadena final la remplazamos despues de la palabra Basic
*/
'Authorization': 'Basic c2tfZmU0ZDQ5Yjk3ZDg4NDkyODhlOTc2NTNmZTY1NzhmZjc6',
'User-Agent': 'openpay-java/1.4.0-SNAPSHOT'
}
}).then(response => {
console.log('Response', response.data)
})
.catch(e => {
console.log('Error: ', e.response.data)
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment