代码之家  ›  专栏  ›  技术社区  ›  John doe

Paypal REST API错误400:开始日期无效

  •  0
  • John doe  · 技术社区  · 7 年前

    当我将用户重定向到paypal支付页面时,我的应用程序经常崩溃。我有以下错误:

    Error: Response Status : 400

    [ { field: 'start_date', issue:
     'start date is required, should be valid and greater than the current date. Should be consistent with ISO 8601 Format' } ] 
    

    然而,我将日期格式化为Github示例文件中所示的格式

     var isoDate = new Date(Date.now())
        isoDate.setSeconds(isoDate.getSeconds() + 4);
        isoDate.toISOString().slice(0, 19) + 'Z';
    

    我甚至添加了一些秒以确保日期大于当前日期

    var isoDate=新日期(Date.now()+10000) isoDate.setSeconds(isoDate.getSeconds()+4); isoDate.toISOString().slice(0,19)+'Z';

    控制台日志(isoDate);

    我不理解这个错误,不是每次都发生,而是经常发生,所以我真的无法在不修复它的情况下发布我的应用程序。

    0 回复  |  直到 7 年前