Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Receipt returned by apple is different format #10

Closed
sambauwens opened this issue Mar 3, 2015 · 10 comments
Closed

Receipt returned by apple is different format #10

sambauwens opened this issue Mar 3, 2015 · 10 comments

Comments

@sambauwens
Copy link

Hi!

While using your library I couldn't validate purchases, so I dug in the code and noticed that the receipt contained in the response from apple verification url isn't the one expected by the library.

-the bundle id is in receipt.bundle_id property instead of receipt.bid
-transaction_id and product_id are contained in receipt.in_app[0] instead of directly in the receipt.

I don't know why these values where located at different places for me, so I changed the code to test and made it work now.

I'll make a pull request to show you what I did and you can include it in the project if you want.

@sambauwens
Copy link
Author

Also I noticed another iap project using this in_app property.

@ronkorving
Copy link
Collaborator

Wow, that's really weird. But I appreciate the PR! :)

@nvcken
Copy link

nvcken commented Jun 9, 2015

I get response like this

{ receipt: 
   { receipt_type: 'ProductionSandbox',
     adam_id: 0,
     app_item_id: 0,
     bundle_id: 'com.abc.test',
     application_version: '1.0',
     download_id: 0,
     version_external_identifier: 0,
     request_date: '2015-06-09 10:22:59 Etc/GMT',
     request_date_ms: '1433845379569',
     request_date_pst: '2015-06-09 03:22:59 America/Los_Angeles',
     original_purchase_date: '2013-08-01 07:00:00 Etc/GMT',
     original_purchase_date_ms: '1375340400000',
     original_purchase_date_pst: '2013-08-01 00:00:00 America/Los_Angeles',
     original_application_version: '1.0',
     in_app: [ [Object] ] },
  transactionId: undefined,
  productId: undefined,
  platform: 'apple' }

so weird, transactionId: undefined, productId: undefined
and have no status field like apple describe
https://developer.apple.com/library/ios/releasenotes/General/ValidateAppStoreReceipt/Chapters/ValidateRemotely.html#//apple_ref/doc/uid/TP40010573-CH104-SW1

What I miss?

@nvcken
Copy link

nvcken commented Jun 9, 2015

because the weird ( not like as document) format response
So this below code of module will work incorrect
lib/apple/index.js

/* jshint camelcase:false */
if (payment.hasOwnProperty('productId') && payment.productId !== receipt.product_id) {
    return cb(new Error('Wrong product ID: ' + payment.productId + ' (expected: ' + receipt.product_id + ')'));
}

@ronkorving
Copy link
Collaborator

That PR is still open, with unaddressed comments. An update to it would be most appreciated.

@nvcken
Copy link

nvcken commented Jun 12, 2015

@silenceper
Copy link

why the response is different?

@justinpage
Copy link
Contributor

@nvcken @silenceper see my answer here:
#11 (comment)

Also, check out #24 as this should resolve some of our issues --hopefully.

@justinpage
Copy link
Contributor

@ronkorving I believe this can be closed due to the merge of #24

@ronkorving
Copy link
Collaborator

@sambauwens Please reopen if there's still an issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants