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

How to decode base64 result.latest_receipt returned by validateReceiptIos ? #203

Closed
lc3t35 opened this issue Jun 25, 2018 · 11 comments
Closed
Labels
🙏 help wanted Extra attention is needed 📱 iOS Related to iOS

Comments

@lc3t35
Copy link

lc3t35 commented Jun 25, 2018

Version of react-native-iap

1.2.1

Platforms you faced the error (IOS or Android or both?)

iOS
I was digging into validateReceiptIos to get more information on subscriptions status, I did this

RNIap.validateReceiptIos({
        'receipt-data': purchase.transactionReceipt,
        'password': "****",
      }, false, 54).then(result => {
        console.log("DEBUG pending_renewal_info ", result.pending_renewal_info);
        console.log("DEBUG lastest_receipt ", result.latest_receipt)
      });

result.latest_receipt is a base64 encoded json, does someone know the best way to convert it to readable json ?

Ref links :
https://developer.apple.com/library/archive/releasenotes/General/ValidateAppStoreReceipt/Chapters/ValidateRemotely.html
https://developer.apple.com/library/archive/releasenotes/General/ValidateAppStoreReceipt/Chapters/ReceiptFields.html#//apple_ref/doc/uid/TP40010573-CH106-SW1

I've noticed an error in isTest param, if isTest is true, it should run as sandbox

export const validateReceiptIos = async (receiptBody, isTest, RNVersion) => {
  if (Platform.OS === 'ios') {
const URL = !isTest ? 'https://sandbox.itunes.apple.com/verifyReceipt' : 'https://buy.itunes.apple.com/verifyReceipt';

should be

export const validateReceiptIos = async (receiptBody, isTest, RNVersion) => {
  if (Platform.OS === 'ios') {
const URL = isTest ? 'https://sandbox.itunes.apple.com/verifyReceipt' : 'https://buy.itunes.apple.com/verifyReceipt';
@lc3t35 lc3t35 changed the title How to decode base64 receipt latest_receipt How to decode base64 result.latest_receipt returned by validateReceiptIos ? Jun 25, 2018
@hyochan
Copy link
Owner

hyochan commented Jun 26, 2018

@lc3t35 Thank you for your correction. Could you give us a PR so that you can be the contributor? Or do you just want me to do this?

@lc3t35
Copy link
Author

lc3t35 commented Jun 26, 2018

@dooboolab please, I think it's easier for just 1 character changed that you do this ;) Otherwise for the question, do you have some idea ?

@hyochan
Copy link
Owner

hyochan commented Jun 26, 2018

@lc3t35 I've just fixed it and publisehd to 1.2.3.

@lc3t35
Copy link
Author

lc3t35 commented Jun 28, 2018

Thank you @dooboolab , any idea for decoding base64 encoded json receipt ?

@hyochan
Copy link
Owner

hyochan commented Jun 30, 2018

@lc3t35 Haven't had idea yet. I've just use this to verify that the purchase is not malformed. Could you share if you find any news?

@lc3t35
Copy link
Author

lc3t35 commented Jun 30, 2018

@dooboolab I think there is a problem with the receipt I get, I've tried with another receipt such this one shown here j3k0/cordova-plugin-purchase#215 which decodes well.
Did Apple change something ?
Here is my receipt :

MIIvygYJKoZIhvcNAQcCoIIvuzCCL7cCAQExCzAJBgUrDgMCGgUAMIIfawYJKoZIhvcNAQcBoIIfXASCH1gxgh9UMAoCAQgCAQEEAhYAMAoCARQCAQEEAgwAMAsCAQECAQEEAwIBADALAgELAgEBBAMCAQAwCwIBDwIBAQQDAgEAMAsCARACAQEEAwIBADALAgEZAgEBBAMCAQMwDAIBCgIBAQQEFgI0KzAMAgEOAgEBBAQCAgCBMA0CAQ0CAQEEBQIDAYfPMA0CARMCAQEEBQwDMS4wMA4CAQkCAQEEBgIEUDI1MDAQAgEDAgEBBAgMBjAuMjcuMjAYAgEEAgECBBAHZy0tnF8M8bm+aglKxApdMBsCAQACAQEEEwwRUHJvZHVjdGlvblNhbmRib3gwHAIBBQIBAQQUzC/684Lst/Xk81RNzSrObK/85uUwHgIBAgIBAQQWDBRjb20uc2hhcmVzLnNoYXJlc2FwcDAeAgEMAgEBBBYWFDIwMTgtMDYtMzBUMTU6MTk6MzFaMB4CARICAQEEFhYUMjAxMy0wOC0wMVQwNzowMDowMFowPwIBBwIBAQQ3qQiJef/6b/9cHpoPXLy6usjJVKxBNcKXF9GOg1Ck4XfKheADAoNqkKdCuExj4U1lZlKR8denczBQAgEGAgEBBEigBLv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UhMYIByzCCAccCAQEwgaMwgZYxCzAJBgNVBAYTAlVTMRMwEQYDVQQKDApBcHBsZSBJbmMuMSwwKgYDVQQLDCNBcHBsZSBXb3JsZHdpZGUgRGV2ZWxvcGVyIFJlbGF0aW9uczFEMEIGA1UEAww7QXBwbGUgV29ybGR3aWRlIERldmVsb3BlciBSZWxhdGlvbnMgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkCCA7rV4fnngmNMAkGBSsOAwIaBQAwDQYJKoZIhvcNAQEBBQAEggEAeN7eMhdagcVIqMrtHDQbuiT1Tb0AzdldcB3Reqcr2IfCT8c4pcMOeGHIZdI2+d1vSGMERuuRbhnCGmxOaUtcrrAOh5pRiEAYuusTsgZuI+KWZI429+o0WFGJpUmv5mxyBNiSyPQ1qjuZmC0fTe0dWdxEJzTlbCVS4B3LM1QEyJ+fzg0iJ9mRWn/N1StTdvXIN+Zo9c5sJYYz2EbfgsEoB8yzOtdeeBL4z+AAzyIRMkIXYmatg3ecDTVVRa1+QrvxXEKD4LWyO7FdXtfv6RTEsP2JaCFKIMvNBw2Kj4apMuw38yVCz18VwVBVV6y+XXYPC/lwKASndIrHWWSkzCDscA==

@lc3t35
Copy link
Author

lc3t35 commented Jun 30, 2018

It seems that I can get renewal.auto_renew_status ("0" or "1") from

RNIap.validateReceiptIos({
        'receipt-data': purchase.transactionReceipt,
        'password': "*****",
      }, false, 54).then(result => {
        _.each(result.pending_renewal_info, function (renewal) {
          console.log("DEBUG pending_renewal_info ", renewal.auto_renew_product_id, renewal.auto_renew_status);
        });
        // console.log("DEBUG lastest_receipt ", result.latest_receipt);
      });

Is this enough to know if the user has cancelled his subscription, in this case renewal.auto_renew_status is "0" (i.e. not automatically renewable) ?
No -> voltrue2/in-app-purchase#150

https://developer.apple.com/library/archive/releasenotes/General/ValidateAppStoreReceipt/Chapters/ValidateRemotely.html#//apple_ref/doc/uid/TP40010573-CH104-SW1

@ramonsenadev
Copy link

@lc3t35
For decode this base64 (from subscriptions), you will need to send it to apple server. Like described in https://developer.apple.com/library/archive/releasenotes/General/ValidateAppStoreReceipt/Chapters/ValidateRemotely.html

I was trying to copy the base64 from console while I was debugging my app and trying to make the call to Apple end-point, but it looks like the chrome was truncating the receipt, since I was always getting "invalid receipt" from Apple server.

After I sent the base64 receipt data to my local server and made the call to apple, I finally decoded the receipt.

@hyochan hyochan added 🙏 help wanted Extra attention is needed 📱 iOS Related to iOS labels Sep 12, 2018
@hyochan
Copy link
Owner

hyochan commented Sep 16, 2018

Related #237

@tmjordan
Copy link

you can use this lib https://github.com/Wizcorp/node-iap

@hayr-hotoca
Copy link

After calling RNIap.validateReceiptIos I see the object with these keys: ['environment', 'latest_receipt', 'latest_receipt_info', 'pending_renewal_info', 'receipt', 'status']. Then why does one need to decode latest_receipt?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🙏 help wanted Extra attention is needed 📱 iOS Related to iOS
Projects
None yet
Development

No branches or pull requests

5 participants