bitpay / node-bitpay-client

A Node.js module and command line client for interacting with BitPay's Cryptographically Secure API
102 stars 95 forks source link

invoice Creation always returns the same invoice Id #88

Closed gofreddo closed 7 years ago

gofreddo commented 7 years ago

No matter what I pass on subsequent calls I always get the same response.

This was the body of my POST invoice request: options.body "{"fullNotifications":"false","physical":false,"posData":"{ \"ref\" : 711454, \"affiliate\" : \"spring112\" }","price":41,"currency":"USD","orderID":"ahb3c","itemDesc":"ah","buyerName":"ah","buyerAddress1":"ah","buyerAddress2":"a","buyerCity":"a","buyerState":"a","buyerZip":"a","buyerEmail":"a","buyerCountry":"a","guid":"522ca6be-e4c4-1f9b-036f-94fedc724eda","token":"FG5vjmpkL2edgdUkzeLZc8AbAXrMqMsKn8Bikoc4Ryt9"}"

And this is the response: res.body "{"facade":"pos/invoice","data":{"url":"https://test.bitpay.com/invoice?id=V8Whuq34SLridy1iMC65xH","posData":"{ \"ref\" : 711454, \"affiliate\" : \"spring112\" }","status":"new","btcPrice":"0.000419","btcDue":"0.000419","price":1,"currency":"USD","exRates":{"USD":2386.01},"buyerTotalBtcAmount":"0.000419","itemDesc":"ah","orderId":"ahb3c","invoiceTime":1499925606832,"expirationTime":1499926506832,"currentTime":1499925964603,"guid":"522ca6be-e4c4-1f9b-036f-94fedc724eda","id":"V8Whuq34SLridy1iMC65xH","lowFeeDetected":false,"btcPaid":"0.000000","rate":2386.01,"exceptionStatus":false,"refundAddressRequestPending":false,"paymentUrls":{"BIP21":"bitcoin:mgKFD2MQyiEjBV6TaoRvvmwrxPoWLMjikr?amount=0.000419","BIP72":"bitcoin:mgKFD2MQyiEjBV6TaoRvvmwrxPoWLMjikr?amount=0.000419&r=https://test.bitpay.com/i/V8Whuq34SLridy1iMC65xH","BIP72b":"bitcoin:?r=https://test.bitpay.com/i/V8Whuq34SLridy1iMC65xH","BIP73":"https://test.bitpay.com/i/V8Whuq34SLridy1iMC65xH"},"bitcoinAddress":"mgKFD2MQyiEjBV6TaoRvvmwrxPoWLMjikr","token":"R34k27T27mdfkjDDEfHNMsoqG51MLgdMGtFwZtcRC46pxtHy481GZBcpF3L5x45Kt"}}"

The price is even different. Once I restart the app I will get a single new invoice ID but then all responses until I restart will return the same response.

What's going on? Why am I not getting new invoices?

Thanks

gofreddo commented 7 years ago

The guid parameter gets set by the client and by default uses the same guid for ever request. Once I provided a new guid for each request it started working.