在 Cardpointe API 调用中不断收到响应代码 500

Keep getting response code 500 in Cardpointe API call

我在对 Cardpointe 网关 (cardconnect) 的 API 调用中不断收到 500 响应代码,任何见解都会有所帮助。 (我能够通过在没有 auth 端点的情况下发布到 URL 来验证测试凭据)

这是我在 Google 应用程序脚本中的代码:

function myFunction() {

  var messagesUrl = "https://fts-uat.cardconnect.com/cardconnect/rest/auth";
  var cred = "testing:testing123";
    
  var payload = JSON.stringify({
  "merchid" : "496160873888",
  "account": "4788250000121443",
  "expiry": "1218",
  "cvv2": "123",
  "amount": "100",
  "phone": "15558889999",
  "capture": "y"
  });

  
  var options = {
    "method" : "put",
   "payload" : payload
  };
  
  options.headers = {    
    "Authorization" : "Basic " + Utilities.base64Encode(cred)
    },{
    "Content-Type" : "application/json"
    }
  var res = UrlFetchApp.fetch(messagesUrl, options);
  
  Logger.log(res);
  
}
options.headers = {    
    "Authorization" : "Basic " + Utilities.base64Encode(cred)
    },{
    "Content-Type" : "application/json"
    }

此处内容类型未设置为options.headers

/*<ignore>*/console.config({maximize:true,timeStamps:false,autoScroll:false});/*</ignore>*/ 
const options ={};
options.headers = {    
"Authorization" : "Basic " + "b64"
},{
"Content-Type" : "application/json"
}
console.log(options)
<!-- https://meta.whosebug.com/a/375985/ -->    <script src="https://gh-canon.github.io/stack-snippet-console/console.min.js"></script>

headers 应该是具有多个键的单个对象:

options.headers = {    
    "Authorization" : "Basic " + Utilities.base64Encode(cred),
    "Content-Type" : "application/json"
    }

/*<ignore>*/console.config({maximize:true,timeStamps:false,autoScroll:false});/*</ignore>*/ 
const options={}
options.headers = {    
"Authorization" : "Basic " + "b64",
"Content-Type" : "application/json"
}
console.log(options)
<!-- https://meta.whosebug.com/a/375985/ -->    <script src="https://gh-canon.github.io/stack-snippet-console/console.min.js"></script>

/*<ignore>*/console.config({maximize:true,timeStamps:false,autoScroll:false});/*</ignore>*/ 
let a;
a = 1,3;
console.log(a);// no 3
<!-- https://meta.whosebug.com/a/375985/ -->    <script src="https://gh-canon.github.io/stack-snippet-console/console.min.js"></script>