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

Android subscription purchase validation failing #205

Closed
mobigaurav opened this issue Aug 16, 2018 · 8 comments
Closed

Android subscription purchase validation failing #205

mobigaurav opened this issue Aug 16, 2018 · 8 comments

Comments

@mobigaurav
Copy link

mobigaurav commented Aug 16, 2018

Hi,
I am facing a problem in android in validating a subscription receipt.

Following are details >

Google public key > MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAhLUxwT+WJ5SKwA2hoUC/r4mG8O+TmyEzUoHoIs4EeVvqMNllERsPqsg7eAQ7SGl+h8Zje6WTZxsTlyL65Tq2ABa7PtxeLhq+UX0NVepxGT7FXNsJRFusguR8uRJuHTYeHbZB9ZtmdHku8E8KzORVjjxzmIZrITTyi/ceHVAfOgnAz6irdr/CWppGIOTFyRV9KGPtF/c2ERn0Zav4VHOlXwoEIp5NZXEkCVZ2elOA0UJqjgdVCwlL1yVS3I725WZcSrncSb3urJXjC3bYdPqkd3Lu3SThbS31BuOwQuTyZND3q2CQ0hjXW9lXkrC94MuBKBuaByEGopHkmhB3eW/PvwIDAQAB

Google Receipt is>

Validate this: { signature: 'Z2MtrvqpoPTME2/euHgAFSZOYeHOzQmMNeduxSLA/k+ldnn5tEz/KrmwNQvVT/K0iSXS9SERVJjmSeeUHro1ZuJtuM311PN05L0WmcqQSisWLHVDlPsLUK4lRQjgTbHUCI8qRVp8uQvKxwdDLVR7BR11PfAF5QpCtVcbloKgPIyskDFwoVjrijR6qTaEROmvrREDsp5vHRsrdLV/B3FCqXBuGeBDYOD9DrZMQuJJfsWduwnyFpHHSTIJGDxZBg1oZs6f8NhNFmoVyT6mVP+g9MuLwubTU4GDAYmXOlZa6W7C2s0hDTWMozMurWxamwYYM792jiAYQE0mDHiqKOHZXw==',
data: '"{\"orderId\":\"GPA.3310-8149-2724-81385\",\"packageName\":\"org.ieee.mobile.sa.arcflash\",\"productId\":\"org.ieee.mobile.sa.arcflash.premiumsubscription\",\"purchaseTime\":1534426765787,\"purchaseState\":0,\"purchaseToken\":\"mmcohlogngdfmpahgdmndjak.AO-J1OxVnI0FBlha_pa70iGDNhV4Si99RtLlfpiYjzKIM-8nagR-VW_n9i0caNZAm7iW6xWbsKMtyfLmIPxoiuKVnTk_v5hK6u3_D-wCFFOraCTm-GyQmytRwlTyAxkVdWXElTqVoQA7RSTl8b5cTILnP_lAyQSukQp83fp_7hePQlwCGyX92O0\",\"autoRenewing\":true}"' }

I am consistently getting following error >

Failed against live public key: Error: failed to validate purchase
at validatePublicKey (/var/task/node_modules/in-app-purchase/lib/google.js:378:5)

can you also tell me where to get these>

config.googleAccToken , config.googleRefToken ,config.googleClientID , config.googleClientSecret

@voltrue2
Copy link
Owner

'"{\"orderId\":\"GPA.3310-8149-2724-81385\",\"packageName\":\"org.ieee.mobile.sa.arcflash\",\"productId\":\"org.ieee.mobile.sa.arcflash.premiumsubscription\",\"purchaseTime\":1534426765787,\"purchaseState\":0,\"purchaseToken\":\"mmcohlogngdfmpahgdmndjak.AO-J1OxVnI0FBlha_pa70iGDNhV4Si99RtLlfpiYjzKIM-8nagR-VW_n9i0caNZAm7iW6xWbsKMtyfLmIPxoiuKVnTk_v5hK6u3_D-wCFFOraCTm-GyQmytRwlTyAxkVdWXElTqVoQA7RSTl8b5cTILnP_lAyQSukQp83fp_7hePQlwCGyX92O0\",\"autoRenewing\":true}"'

The above seems to be a string of stringified JSON object. Please look carefully where you have a stringified JSON object wrapped in single quotes '.
Remove the single quotes around it and it unstringify it.
I think that should make it work.

Cheers

@mobigaurav
Copy link
Author

mobigaurav commented Aug 17, 2018

I tried by passing json object format but it did not work for that too. below is the format

Validate this: { signature: 'Z2MtrvqpoPTME2/euHgAFSZOYeHOzQmMNeduxSLA/k+ldnn5tEz/KrmwNQvVT/K0iSXS9SERVJjmSeeUHro1ZuJtuM311PN05L0WmcqQSisWLHVDlPsLUK4lRQjgTbHUCI8qRVp8uQvKxwdDLVR7BR11PfAF5QpCtVcbloKgPIyskDFwoVjrijR6qTaEROmvrREDsp5vHRsrdLV/B3FCqXBuGeBDYOD9DrZMQuJJfsWduwnyFpHHSTIJGDxZBg1oZs6f8NhNFmoVyT6mVP+g9MuLwubTU4GDAYmXOlZa6W7C2s0hDTWMozMurWxamwYYM792jiAYQE0mDHiqKOHZXw==',
data: '{"orderId":"GPA.3310-8149-2724-81385","packageName":"org.ieee.mobile.sa.arcflash","productId":"org.ieee.mobile.sa.arcflash.premiumsubscription","purchaseTime":1534426765787,"purchaseState":0,"purchaseToken":"mmcohlogngdfmpahgdmndjak.AO-J1OxVnI0FBlha_pa70iGDNhV4Si99RtLlfpiYjzKIM-8nagR-VW_n9i0caNZAm7iW6xWbsKMtyfLmIPxoiuKVnTk_v5hK6u3_D-wCFFOraCTm-GyQmytRwlTyAxkVdWXElTqVoQA7RSTl8b5cTILnP_lAyQSukQp83fp_7hePQlwCGyX92O0","autoRenewing":true}' }

Response received is>

Failed against live public key: Error: missing public key
at validatePublicKey (/var/task/node_modules/in-app-purchase/lib/google.js:366:13)
at module.exports.validatePurchase (/var/task/node_modules/in-app-purchase/lib/google.js:154:2)

Failed against sandbox public key: Error: missing public key
at validatePublicKey (/var/task/node_modules/in-app-purchase/lib/google.js:366:13)

I am passing public keys as i mentioned in my earlier post but its still somehow not able to find it also this is a subscription script can you please tell me where to find the following

config.googleAccToken , config.googleRefToken

@mobigaurav
Copy link
Author

Any update on this ?

@voltrue2
Copy link
Owner

voltrue2 commented Aug 20, 2018 via email

@voltrue2
Copy link
Owner

voltrue2 commented Aug 20, 2018 via email

@mobigaurav
Copy link
Author

i am passing receipt key in config like below>
iap.config({
verbose: true,
publicKeyStrSandbox: process.env.publicKeyStrSandbox

	});

@voltrue2
Copy link
Owner

Hello

For subscription receipts, you will need to setup your server following these instructions: https://github.com/voltrue2/in-app-purchase#google-in-app-billing-set-up

Cheers

@voltrue2
Copy link
Owner

Closing

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

2 participants