I'm trying to create a stripe token using GAS. my code is below
function createToken(){
var url = "https://api.stripe.com/v1/tokens";
var payload = {
"Card": {
"Number" : "4242424242424242",
"Exp_month" : "10",
"Exp_year": "2021",
"Cvc": "314",
}
};
var options = {
"method" : "post",
"payload" : payload
};
options.headers = {
"Authorization" : "Basic " + Utilities.base64Encode("sk_test_4eC***7dc:")
};
var res = UrlFetchApp.fetch(url, options);
Logger.log(res.getContentText())
}
But I keep getting the following error, what am I missing?
[20-10-22 12:39:19:452 EDT] Exception: Request failed for https://api.stripe.com returned code 400.
Truncated server response: { "error": { "code": "parameter_missing", "doc_url": "https://stripe.com/docs/error-codes/parameter-missing", "message": "You must su... (use muteHttpExceptions option to examine full response) at createToken(Code:43:27)