Closed kokteyldev closed 6 years ago
"app_item_id" field is string
I guess your receipt is iOS 6 style.
This library supports the receipt style for iOS7 or above.
However this library doesn't enforce our receipt definition on you, because I implemented the response as interface{}
So you can use your original receipt definition to solve it.
I got an error in production. my phone is iOS11. For now, I turned off the validation It seemed to work fine with sandbox and beta... I am confused
Failed ValidateIosReceipt: json: cannot unmarshal string into Go struct field Receipt.app_item_id of type int64
@jun06t Great fix! But would you mind explaining the background of this issue a bit? Did Apple change anything recently?
As stated here Apple Receipt Fields "app_item_id" field should be a string but in the library it is mapped to int64. This causes an error during json decoding.
EDIT: Apparently Apple is giving out different responses some has app_item_id as string and some has it as a number. In this case a custom type that implements Unmarshaler interface would be better suited for this. Something like the following: