Wrong Data returned by API

marketspays
Shopify Partner
3 0 0

Hey,

I saved the data returned by the order webhook and I am expecting to saved the exact data but when I displayed the it, it displays negative values. The Order ID is supposed to be like 4624433971357 but in my database the saved value was -1245806435, when I checked the data through postman I did not see any value like this -1245806435.

The postman returns something like this:

{
    "order": {
        "id"4624424960157, ....
And I know that my code is good since the other data are saved correctly.
Thanks.

 

Replies 3 (3)

Pcastro
Shopify Staff
15 0 4

Hello,

 

the postman value you show contains a typical order id value, so all looks good.


Not sure of what can be causing that your database stores a negative value, but could it be a data type precision issue? If your app language or database is not able to store 13-digit integers, that negative value you are seeing could be the result of a truncation. 

 

Would it be feasible for you to store the order id as a string?

 

Best regards

To learn more visit the Shopify Help Center or the Community Blog.

marketspays
Shopify Partner
3 0 0

Hi,

I changed the data type to string and make the size 255, and still the same result, so I converted the data to string like this $order_id = " ".$data['id']; And it works but with space, but that's ok and of course I want to know why.

Thanks for the reply.  

chendongyang
Shopify Partner
14 0 1

Do you know the hmac question as below?

The HMAC digest  by java differs from your generated as Verifying the webhook to authorize our app using OAuth, please check our annexes