Last active
August 14, 2020 18:01
-
-
Save gusLopezC/1ec84d7e32583094424db91169d91c46 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 Openpay = require('openpay'); | |
//instantiation | |
var openpay = new Openpay('mdrhnprmsmxkgxtegzhk', 'sk_c71babd865fd420b94bc588a8585c122'); | |
console.log('=============================================================================='); | |
console.log('OBTENER TOKEN'); | |
console.log('=============================================================================='); | |
// Crear previamente la tarjeta | |
var request = require('request'); | |
var options = { | |
'method': 'GET', | |
'url': 'https://sandbox-api.openpay.mx/v1/mdrhnprmsmxkgxtegzhk/tokens/kgo1dltczlxncgu4yt7j', | |
'headers': { | |
'Content-Type': 'application/json', | |
'Accept': 'application/json', | |
'Authorization': 'Basic c2tfYzcxYmFiZDg2NWZkNDIwYjk0YmM1ODhhODU4NWMxMjI6' | |
} | |
}; | |
request(options, function (error, response) { | |
if (error) throw new Error(error); | |
console.log(response.body); | |
}); | |
console.log('=============================================================================='); | |
console.log('OBTENER PUNTOS'); | |
console.log('=============================================================================='); | |
var request = require('request'); | |
var options = { | |
'method': 'GET', | |
'url': 'https://sandbox-api.openpay.mx/v1/mdrhnprmsmxkgxtegzhk/cards/k4yqya5z1cxnq7z4getv/points', | |
'headers': { | |
'Content-Type': 'application/json', | |
'Authorization': 'Basic c2tfYzcxYmFiZDg2NWZkNDIwYjk0YmM1ODhhODU4NWMxMjI6' | |
} | |
}; | |
request(options, function (error, response) { | |
if (error) throw new Error(error); | |
console.log(response.body); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment