question

josh@gameforge avatar image
josh@gameforge asked

Format of userId and purchaseToken

Hey everyone, In the documentation there is information about the format of communication with the Receipt Verification Service. However, there is no information about the format of userId and purchaseToken. How long can they be? What characters can they contain? This is important because they need to be stored in a database for tracking payments that have already been processed. For that reason they must be searchable too, which is more difficult the longer the strings. Because from the examples in the documentation it looked as if the tokens are used unencoded in request URLs (and because they look like slightly modified base64), we're assuming they cannot contain various characters such as white spaces and slashes. This information would be helpful in the online documentation.
iap
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

StephenC@Amazon avatar image
StephenC@Amazon answered
Hi -- Thanks for the feedback. Both user ID and Purchase Token are encrypted strings, so the length depends on several variables including the choice of encryption techniques. That being said, here are some "safe" values to use when defining space for them in a database. User ID: 128 characters Purchase Token: 512 characters The contents of the string are alphanumeric + punctuation (e.g. :, -, _)
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

aidigame avatar image
aidigame answered
Hi josh, Have you resolved your problem?I'm encountering the same issue.I have to connect both userId and purchaseToken into a long string to send to our server,but I couldn't find such a separator as not included in userId or purchaseToken.Actually,it seems that ";" isn't contained in any of them and I'm using it as the separator,but I'm not sure if ";" is safe.I need to figure out which characters are safe and which are not.Thanks.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Dixith@Amazon avatar image
Dixith@Amazon answered
Hi aidigame, You can use the character ";" as seperator in between userid and purchase token to send to your server.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

davespacey avatar image
davespacey answered
Would it be possible to get a more specific list of what characters the IAP user id or purchase token could consist of? I'd like to be able to use a regex to filter out invalid user ids and was originally following a format suggested by another thread (ex. oxxKxXxpxxxkxIx2xrx-xlxexmxxxxxxOxKxxxx6***=) when I ran across this thread that suggests user ids could be as long as 128 characters? Are those "safe" space values still applicable now or has it changed since this question was first asked? Thank you again for your time.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Sujoy@Amazon avatar image
Sujoy@Amazon answered
Hi Davespacey, The character limit of both the fields still holds good. i,e User ID: 128 characters Purchase Token: 512 characters I am trying to confirm the specific list of punctuation character list from concerned team here. I will let you know once I receive response from them. Thanks.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Sujoy@Amazon avatar image
Sujoy@Amazon answered
Hi Davespace, Confirmed. Upper-case and lower-case letters, numbers, colon ":", equal sign "=", dash "-", and underscore "_" Thank you for detailing out the API spec.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

davespacey avatar image
davespacey answered
Hi Sujoy, Thank you for looking into and confirming that information!
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.