Timestamp for this request is outside of the recvWindow - binance pay

Hi, I am using the npm library axios to try to create an order. But keep getting the error message in the title:

    headers: {
      Accept: 'application/json, text/plain, */*',
      'Content-Type': 'application/json',
      recvWindow: 100000000,
      'User-Agent': 'server-node/1.0.0',
      Host: 'bpay.binanceapi.com',
      'Accept-Encoding': 'gzip, deflate, br',
      Connection: 'keep-alive',
      'BinancePay-Timestamp': '1646787603',
      'BinancePay-Nonce': 'qEbGjbPGJSBuLIBfxvTwMbxzDXRjTYhm',
      'BinancePay-Certificate-SN': 'xxxxxxxxxxxxxxxxx',
      'BinancePay-Signature': '7AEBD092DD58D49973E3357AC6B87B2BE086BC20379292A5655A7B2C18B79229',
      'Content-Length': 378
    },
    method: 'post',
    url: 'https://bpay.binanceapi.com/binancepay/openapi/v2/order',
    data: '{"env":{"terminalType":"APP","osType":"IOS"},"merchantTradeNo":"52f61bf0b955547c8b90676311a7da63","orderAmount":"1.00","currency":"USDT","goods":{"goodsType":"01","goodsCategory":"Z000","referenceGoodsId":"52f61bf0b955547c8b90676311a7da63","goodsName":"cash","goodsUnitAmount":{"currency":"NGN","amount":"20.00"}},"returnUrl":"https://returnUrl","cancelUrl":"https://cancelUrl"}'

was wondering if anyone else has experience the same problem on binance pay.

Set the timestamp in 13 digits,

Date.now()

Also tried this:

   headers: {
      Accept: 'application/json, text/plain, */*',
      'Content-Type': 'application/json',
      'User-Agent': 'server-node/1.0.0',
      Host: 'bpay.binanceapi.com',
      'Accept-Encoding': 'gzip, deflate, br',
      Connection: 'keep-alive',
      'BinancePay-Timestamp': '1646789095',
      'BinancePay-Nonce': 'zyYoCikPLVpIQihmclkDuPEgJpyYKWuO',
      'BinancePay-Certificate-SN': 'q0r0bfc4mfav4rz7ycxkoq4o93gybmrgkfbtrvueppspcqef6focerfhrq6f6vfi',
      'BinancePay-Signature': '38FB9C0EEF06FE565E5EC63CA1A0AA339D15AAEAAFE2455D16805E57DC3C02F9',
      'Content-Length': 378
    },
    method: 'post',
    url: 'https://bpay.binanceapi.com/binancepay/openapi/v2/order',
    data: '{"env":{"terminalType":"APP","osType":"IOS"},"merchantTradeNo":"52f61bf0b955547c8b90676311a7da63","orderAmount":"1.00","currency":"USDT","goods":{"goodsType":"01","goodsCategory":"Z000","referenceGoodsId":"52f61bf0b955547c8b90676311a7da63","goodsName":"cash","goodsUnitAmount":{"currency":"NGN","amount":"20.00"}},"returnUrl":"https://returnUrl","cancelUrl":"https://cancelUrl"}'
  }

But still the same problem.

Please find this demo nodejs script for Binance Pay

Yeah that seems to work…

{
  status: 'SUCCESS',
  code: '000000',
  data: {
    prepayId: '148076275722510336',
    terminalType: 'APP',
    expireTime: 1646793789900,
    qrcodeLink: 'https://public.bnbstatic.com/static/payment/20220309/5e45562f-550e-4133-bfbe-423c6bd75344.jpg',
    qrContent: 'https://app.binance.com/qr/dplk851f894e206e4710b42d7f72100d395b',
    checkoutUrl: 'https://pay.binance.com/en/checkout/d74086f1a5c248788795fc6ed83e320f',
    deeplink: 'bnc://app.binance.com/payment/secpay?tempToken=2VxVOQ9y0G1PYCtgnFR9EO3ZEk0dEbR0&returnLink=https://pay.binance.com/en/checkout/d74086f1a5c248788795fc6ed83e320f'
  }
}

Will try removing some of the headers, otherwise this looks like exactly what I am doing…
Thanks,

@dino you are great… :slight_smile: its all working now… thank you.

hi @dino
Incase this trips some one else up,


Ignore this warning from postman :slight_smile: