Google order number changed to merchant number???

Since December 7 I’ve been having trouble with my payment system. Turns out the order number being reported is no longer the 15 digit Google order number, but the 20 digit + 16 digit merchant order number.

After transaction is complete, transaction.receipt is now a 20 digit + 16 digit number, instead of 15 digits.

Do anyone know what caused this change and how do I get to have the Google order number to be reported again?

We need the Google order number to be able to cross reference and grant items on the server end. We couldn’t do this with merchant order number because Google’s API doesn’t support look-up with it.

Any insight would be greatly appreciated.
[import]uid: 159488 topic_id: 34153 reply_id: 334153[/import]

I looked this up on Google’s website and apparently they made this change as of December 5th. They’ve documented it here…
http://developer.android.com/google/play/billing/billing_admin.html#orderId

You are not the only person who doesn’t like this change. A few people have written this up as a bug report to Google (see the link below), but as noted above, this change appears to be by design.
http://code.google.com/p/marketbilling/issues/detail?id=81

Hmm… I’m not sure what we can do to help you with this. The purchase notification that we receive from Google comes in as a JSON string, like the example below. Do you see anything in the below JSON that you can use and that maybe we need to provide?
[lua]{ “nonce” : 1836535032137741465,
“orders” :
[{ “notificationId” : “android.test.purchased”,
“orderId” : “12999556515565155651.5565135565155651”
“packageName” : “com.example.dungeons”,
“productId” : “android.test.purchased”,
“developerPayload” : “bGoa+V7g/yqDXvKRqq+JTFn4uQZbPiQJo4pf9RzJ”,
“purchaseTime” : 1290114783411,
“purchaseState” : 0,
“purchaseToken” : “rojeslcdyyiapnqcynkjyyjh” }]
}[/lua]
[import]uid: 32256 topic_id: 34153 reply_id: 135857[/import]

I looked this up on Google’s website and apparently they made this change as of December 5th. They’ve documented it here…
http://developer.android.com/google/play/billing/billing_admin.html#orderId

You are not the only person who doesn’t like this change. A few people have written this up as a bug report to Google (see the link below), but as noted above, this change appears to be by design.
http://code.google.com/p/marketbilling/issues/detail?id=81

Hmm… I’m not sure what we can do to help you with this. The purchase notification that we receive from Google comes in as a JSON string, like the example below. Do you see anything in the below JSON that you can use and that maybe we need to provide?
[lua]{ “nonce” : 1836535032137741465,
“orders” :
[{ “notificationId” : “android.test.purchased”,
“orderId” : “12999556515565155651.5565135565155651”
“packageName” : “com.example.dungeons”,
“productId” : “android.test.purchased”,
“developerPayload” : “bGoa+V7g/yqDXvKRqq+JTFn4uQZbPiQJo4pf9RzJ”,
“purchaseTime” : 1290114783411,
“purchaseState” : 0,
“purchaseToken” : “rojeslcdyyiapnqcynkjyyjh” }]
}[/lua]
[import]uid: 32256 topic_id: 34153 reply_id: 135857[/import]

Hi there,

We are trying to implement this system: http://stackoverflow.com/questions/10384142/verify-android-in-app-purchase-in-c-sharp

And JSON you posted is exactly what we need. How can we get it from corona? Now corona returns just seperate items. Is it possible to get the whole JSON info?

[import]uid: 27699 topic_id: 34153 reply_id: 139338[/import]

Currently, we do not provide the above JSON via our APIs. But we can change it do so.
So, do you not need the “order number” to verify the purchase like lanzer22 has state up above?
Because that information is missing in the received JSON response.

Admittedly, I haven’t had a hard look on what it takes to verify an in-app purchase yet, so I apologize for my ignorance here. Been too busy working on other things in the Android world. :slight_smile: [import]uid: 32256 topic_id: 34153 reply_id: 139375[/import]

Hi Joshua,

Thanks for getting back to us.

Let me elaborate what we need for the in-app billing feature. After making a purchase, the Google Play server should respond with the following:

inapp_signed_data - a String representing the signed JSON string.
inapp_signature - a String representing the signature.

To verify the integrity of the response from Google, we need the entire JSON string without any manipulation. We need to send the entire string, along with the signature, to my own server, which will validate the data through our product ID and the public key obtained from our own Google market account portal.

The whole point to this is so that hackers can’t manipulate fake purchases, or fake item granting calls to our servers. Google, unfortunately, just took away their API which allows immediate query of past purchases (we can only query purchases made 5+ minutes ago), so the only way to verify purchases now is to check for integrity of the data saying “I paid $5 for item A”, and this data can only be signed and packaged by the Google play server.

Some reference information is below. Starting with the Google server response object

http://developer.android.com/google/play/billing/billing_testing.html#billing-testing-static

"There are four reserved product IDs for testing static In-app Billing responses:  
android.test.purchased  
When you make an In-app Billing request with this product ID, Google Play responds as though you successfully purchased an item. The response includes a JSON string, which contains fake purchase information (for example, a fake order ID). In some cases, the JSON string is signed and the response includes the signature so you can test your signature verification implementation using these responses."  

One note on making sure that you get signature data from Google. You don’t do this you don’t get any signature, which won’t allow you to verify data

http://crazyviraj.blogspot.com/2011/06/some-notes-on-implementing-in-app.html

"If you want valid signatures for the JSON responses as suggested by the table here, the 'debuggable' attribute in the app manifest should be set to false, even if you're using a release-key-signed APK and static responses. I was a little annoyed by this un-documented restriction because it basically meant that I had to resort to using logging as the only real means of debugging my code. If there is indeed some way to debug this using a debugger (and yet receive valid signatures), it’s definitely not obvious to me. Again, not a terribly big deal once you realize that this attribute actually seems to affect signatures, but that isn't documented anywhere."  

Lastly, on the server side, here’s code example of how we would verify the data passed down by Google.

http://code.google.com/p/android-market-license-verification/source/browse/trunk/samples/verify.php

We need to do all this work because the public key is posessed only at Google’s server and our own server. The client never keep a copy so no hackers can generate fake signatures. When item or progressed is granted not on the client but on the publisher’s servers, this is the only way to ensure security.

12 days after Google removed the API to verify purchase history, hackers immediately found ways to fake purchases on our site. We’re now in a cat and mouse chase to shut down these hackers until a permanent solution is in place. [import]uid: 159488 topic_id: 34153 reply_id: 139388[/import]

Currently, we do split the received JSON packet by orders internally in our code. The reason is that a single JSON packet can contain multiple purchased items (this is especially true for restores), so we split the JSON by purchased products since our Lua store transaction listener is designed to only handle one product at a time. This means you’ll lose the “nonce” in the JSON packet.

So, the following JSON packet received from Google…
[lua]{ “nonce” : 1836535032137741465,
“orders” :
[{ “notificationId” : “android.test.purchased”,
“orderId” : “12999556515565155651.5565135565155651”
“packageName” : “com.example.dungeons”,
“productId” : “android.test.purchased”,
“developerPayload” : “bGoa+V7g/yqDXvKRqq+JTFn4uQZbPiQJo4pf9RzJ”,
“purchaseTime” : 1290114783411,
“purchaseState” : 0,
“purchaseToken” : “rojeslcdyyiapnqcynkjyyjh” }]
}[/lua]
Will turn into this in Corona if we were to provide the JSON via the signature property…
[lua]{ “notificationId” : “android.test.purchased”,
“orderId” : “12999556515565155651.5565135565155651”
“packageName” : “com.example.dungeons”,
“productId” : “android.test.purchased”,
“developerPayload” : “bGoa+V7g/yqDXvKRqq+JTFn4uQZbPiQJo4pf9RzJ”,
“purchaseTime” : 1290114783411,
“purchaseState” : 0,
“purchaseToken” : “rojeslcdyyiapnqcynkjyyjh”
}[/lua]

So, is this going to be a problem?
[import]uid: 32256 topic_id: 34153 reply_id: 139393[/import]

You’re right Joshua, it won’t work for verification purpose. It’s been mentioned that even if the order of the properties are altered, it would produce a different signature hence failing verification.

It’s difficult if the listener automatically parse out JSON strings. The only thing I can imagine is providing some sort of a flag or differentiation for payment related callbacks since a nonce was provided, and include an additional property called something like ‘rawdata’ and that’d be the entire original JSON string. Note that the signature from Google would also be needed or the whole thing won’t work.

Hope this will be addressed soon. As of today, all games developed in Corona are prone to simple hacks for faking payments. Not a huge deal for single instanced games but a huge deal for multiplayer or MMO games. [import]uid: 159488 topic_id: 34153 reply_id: 139401[/import]

I suppose we can provide the entire JSON string unaltered via event.transaction. Even if it contains multiple products. I hope it won’t be confusing to other Corona developers, but that’s exactly how Google delivers it.

Now, that JSON string does *not* include the “inapp_signature” string, which you’ll definitely need.

So, since we need to provide 2 strings, it sounds like we need to add a new property to the “event.transcation” table.

I don’t think you’ll need the “nonce” value. [import]uid: 32256 topic_id: 34153 reply_id: 139405[/import]

Hi there,

We are trying to implement this system: http://stackoverflow.com/questions/10384142/verify-android-in-app-purchase-in-c-sharp

And JSON you posted is exactly what we need. How can we get it from corona? Now corona returns just seperate items. Is it possible to get the whole JSON info?

[import]uid: 27699 topic_id: 34153 reply_id: 139338[/import]

Currently, we do not provide the above JSON via our APIs. But we can change it do so.
So, do you not need the “order number” to verify the purchase like lanzer22 has state up above?
Because that information is missing in the received JSON response.

Admittedly, I haven’t had a hard look on what it takes to verify an in-app purchase yet, so I apologize for my ignorance here. Been too busy working on other things in the Android world. :slight_smile: [import]uid: 32256 topic_id: 34153 reply_id: 139375[/import]

Hi Joshua,

Thanks for getting back to us.

Let me elaborate what we need for the in-app billing feature. After making a purchase, the Google Play server should respond with the following:

inapp_signed_data - a String representing the signed JSON string.
inapp_signature - a String representing the signature.

To verify the integrity of the response from Google, we need the entire JSON string without any manipulation. We need to send the entire string, along with the signature, to my own server, which will validate the data through our product ID and the public key obtained from our own Google market account portal.

The whole point to this is so that hackers can’t manipulate fake purchases, or fake item granting calls to our servers. Google, unfortunately, just took away their API which allows immediate query of past purchases (we can only query purchases made 5+ minutes ago), so the only way to verify purchases now is to check for integrity of the data saying “I paid $5 for item A”, and this data can only be signed and packaged by the Google play server.

Some reference information is below. Starting with the Google server response object

http://developer.android.com/google/play/billing/billing_testing.html#billing-testing-static

"There are four reserved product IDs for testing static In-app Billing responses:  
android.test.purchased  
When you make an In-app Billing request with this product ID, Google Play responds as though you successfully purchased an item. The response includes a JSON string, which contains fake purchase information (for example, a fake order ID). In some cases, the JSON string is signed and the response includes the signature so you can test your signature verification implementation using these responses."  

One note on making sure that you get signature data from Google. You don’t do this you don’t get any signature, which won’t allow you to verify data

http://crazyviraj.blogspot.com/2011/06/some-notes-on-implementing-in-app.html

"If you want valid signatures for the JSON responses as suggested by the table here, the 'debuggable' attribute in the app manifest should be set to false, even if you're using a release-key-signed APK and static responses. I was a little annoyed by this un-documented restriction because it basically meant that I had to resort to using logging as the only real means of debugging my code. If there is indeed some way to debug this using a debugger (and yet receive valid signatures), it’s definitely not obvious to me. Again, not a terribly big deal once you realize that this attribute actually seems to affect signatures, but that isn't documented anywhere."  

Lastly, on the server side, here’s code example of how we would verify the data passed down by Google.

http://code.google.com/p/android-market-license-verification/source/browse/trunk/samples/verify.php

We need to do all this work because the public key is posessed only at Google’s server and our own server. The client never keep a copy so no hackers can generate fake signatures. When item or progressed is granted not on the client but on the publisher’s servers, this is the only way to ensure security.

12 days after Google removed the API to verify purchase history, hackers immediately found ways to fake purchases on our site. We’re now in a cat and mouse chase to shut down these hackers until a permanent solution is in place. [import]uid: 159488 topic_id: 34153 reply_id: 139388[/import]

Currently, we do split the received JSON packet by orders internally in our code. The reason is that a single JSON packet can contain multiple purchased items (this is especially true for restores), so we split the JSON by purchased products since our Lua store transaction listener is designed to only handle one product at a time. This means you’ll lose the “nonce” in the JSON packet.

So, the following JSON packet received from Google…
[lua]{ “nonce” : 1836535032137741465,
“orders” :
[{ “notificationId” : “android.test.purchased”,
“orderId” : “12999556515565155651.5565135565155651”
“packageName” : “com.example.dungeons”,
“productId” : “android.test.purchased”,
“developerPayload” : “bGoa+V7g/yqDXvKRqq+JTFn4uQZbPiQJo4pf9RzJ”,
“purchaseTime” : 1290114783411,
“purchaseState” : 0,
“purchaseToken” : “rojeslcdyyiapnqcynkjyyjh” }]
}[/lua]
Will turn into this in Corona if we were to provide the JSON via the signature property…
[lua]{ “notificationId” : “android.test.purchased”,
“orderId” : “12999556515565155651.5565135565155651”
“packageName” : “com.example.dungeons”,
“productId” : “android.test.purchased”,
“developerPayload” : “bGoa+V7g/yqDXvKRqq+JTFn4uQZbPiQJo4pf9RzJ”,
“purchaseTime” : 1290114783411,
“purchaseState” : 0,
“purchaseToken” : “rojeslcdyyiapnqcynkjyyjh”
}[/lua]

So, is this going to be a problem?
[import]uid: 32256 topic_id: 34153 reply_id: 139393[/import]

You’re right Joshua, it won’t work for verification purpose. It’s been mentioned that even if the order of the properties are altered, it would produce a different signature hence failing verification.

It’s difficult if the listener automatically parse out JSON strings. The only thing I can imagine is providing some sort of a flag or differentiation for payment related callbacks since a nonce was provided, and include an additional property called something like ‘rawdata’ and that’d be the entire original JSON string. Note that the signature from Google would also be needed or the whole thing won’t work.

Hope this will be addressed soon. As of today, all games developed in Corona are prone to simple hacks for faking payments. Not a huge deal for single instanced games but a huge deal for multiplayer or MMO games. [import]uid: 159488 topic_id: 34153 reply_id: 139401[/import]

I suppose we can provide the entire JSON string unaltered via event.transaction. Even if it contains multiple products. I hope it won’t be confusing to other Corona developers, but that’s exactly how Google delivers it.

Now, that JSON string does *not* include the “inapp_signature” string, which you’ll definitely need.

So, since we need to provide 2 strings, it sounds like we need to add a new property to the “event.transcation” table.

I don’t think you’ll need the “nonce” value. [import]uid: 32256 topic_id: 34153 reply_id: 139405[/import]

As of daily build #1025, which is available today, Corona now provides the information needed to verify a Google in-app purchase. The store transaction event provides this information as follows:

  • “event.transaction.receipt” provides Google’s “inapp_signed_data” JSON string.
  • “event.transaction.signature” provides Google’s “inapp_signature” string. (This property returns nil on iOS.)

Also note that the signature string will be empty unless your device and app meets the conditions indicated by Table 1 in Google’s in-app billing documentation here…
http://developer.android.com/google/play/billing/billing_testing.html#billing-testing-static

Thank you for your patience. I hope this helps! [import]uid: 32256 topic_id: 34153 reply_id: 142133[/import]

As of daily build #1025, which is available today, Corona now provides the information needed to verify a Google in-app purchase. The store transaction event provides this information as follows:

  • “event.transaction.receipt” provides Google’s “inapp_signed_data” JSON string.
  • “event.transaction.signature” provides Google’s “inapp_signature” string. (This property returns nil on iOS.)

Also note that the signature string will be empty unless your device and app meets the conditions indicated by Table 1 in Google’s in-app billing documentation here…
http://developer.android.com/google/play/billing/billing_testing.html#billing-testing-static

Thank you for your patience. I hope this helps! [import]uid: 32256 topic_id: 34153 reply_id: 142133[/import]

I just wanted to say “thank you”, because this now works exactly as we need it to verify the purchase on our backend servers!

I just wanted to say “thank you”, because this now works exactly as we need it to verify the purchase on our backend servers!