Hi friends,
I'm very happy to share today experience In-app purchase server-side validation you.
This link is very use full for me to implement this server side validation. Please refer this link,
https://github.com/aporat/store-receipt-validator
I have faced some problems with Android server side validation. I will share problematic experience with you..........
grant_type=authorization_code
code=<the code from the previous step>
client_id=<the client ID token created in the APIs Console>
client_secret=<the client secret corresponding to the client ID>
redirect_uri=<the URI registered with the client ID>
In this step you will get access_token
I'm very happy to share today experience In-app purchase server-side validation you.
This link is very use full for me to implement this server side validation. Please refer this link,
https://github.com/aporat/store-receipt-validator
I have faced some problems with Android server side validation. I will share problematic experience with you..........
- https://developers.google.com/android-publisher/authorization -> go through this URL and flow this steps
- If you follow the steps, you will get a client id and client secret. While doing this process it will ask you for redirect URI, you just any of your project URL for testing purpose to get the token
http://localhost/project/public/refresh-token
I Just gave a refresh token function as return URL. In this function, $request->code you can retrieve the refresh token - Using this token you can do this process
grant_type=authorization_code
code=<the code from the previous step>
client_id=<the client ID token created in the APIs Console>
client_secret=<the client secret corresponding to the client ID>
redirect_uri=<the URI registered with the client ID>
In this step you will get access_token
4. Important thing to mind, while doing this process
- Very important things to do, save this refresh token for further use to generate the access token
- First time only you can able to get this refresh, again you will not get
- If you missed this token you need to revoke by the sense, remove and do the client_id and client_secret generation process, by using this link
https://security.google.com/settings/security/permissions
5.Each access token is only valid for a short time. Once the current access token expires, the server
will need to use the refresh token to get a new one. To do this, send a POST request to https://accounts.google.com/o/oauth2/token with the following fields set:
will need to use the refresh token to get a new one. To do this, send a POST request to https://accounts.google.com/o/oauth2/token with the following fields set:
grant_type=refresh_token
client_id=<the client ID token created in the APIs Console>
client_secret=<the client secret corresponding to the client ID>
refresh_token=<the refresh token from the previous step>
use ReceiptValidator\GooglePlay\Validator as PlayValidator; $validator = new PlayValidator([ 'client_id' => '...', 'client_secret' => '...', 'refresh_token' => 'You Just give your refresh token' ]); try { $response = $validator->setPackageName('PACKAGE_NAME') ->setProductId('PRODUCT_ID') ->setPurchaseToken('PURCHASE_TOKEN') ->validate(); } catch (Exception $e){ var_dump($e->getMessage()); // example message: Error calling GET ....: (404) Product not found for this application. } // success
- If you done this process, you will get this response
- The purchase state of the order. Possible values are
0
(purchased),1
(canceled), or2
(refunded).
Google_Service_AndroidPublisher_ProductPurchase Object
(
[internal_gapi_mappings:protected] => Array
(
)
[consumptionState] => 0
[developerPayload] =>
[kind] => androidpublisher#productPurchase
[purchaseState] => 0
[purchaseTimeMillis] => 1479873380495
[modelData:protected] => Array
(
)
[processed:protected] => Array
(
)
)
Such a very useful article. Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article. After reading your article I was amazed. I know that you explain it very well.
ReplyDeleteAnd I hope that other readers will also experience how I feel after reading your article
web designing training in chennai
web designing training in tambaram
digital marketing training in chennai
digital marketing training in tambaram
rpa training in chennai
rpa training in tambaram
tally training in chennai
tally training in tambaram