We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
In my case the purchase is never validated: https://stackoverflow.com/q/75766712/856090
The text was updated successfully, but these errors were encountered:
import json from flask import request, jsonify from inapppy import GooglePlayVerifier, errors from common import app, config, OurDB, fund_account try: with open("google_credentials.json") as f: google_credentials = json.load(f) except FileNotFoundError: google_credentials = None @app.route('/google_play_purchase', methods=['POST']) def playmarket_purchase(): """Send by the client to notify that a product was purchased.""" if google_credentials is None: app.logger.error("No Google credentials file!") return "No Google credentials file!", 500 purchase_token = request.form['purchaseToken'] product_sku = request.form['productId'] app_guid = request.form['appGuid'] verifier = GooglePlayVerifier( config['android']['bundleId'], google_credentials, ) try: result = verifier.verify( purchase_token, product_sku, is_subscription=False, ) except errors.GoogleError as exc: app.logger.error('Purchase validation failed {}'.format(exc)) return jsonify(success=False, reason='validationFailed'), 402 # payment required try: amount = config['products'][product_sku]['amount'] * result['quantity'] except KeyError: app.logger.error("ERROR: Unknown product!!") return jsonify(success=False, reason='unknownProduct'), 400 # bad request with OurDB() as our_db: fund_account(our_db, app_guid, amount) # FIXME: https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.products/consume return jsonify(success=True)
Sorry, something went wrong.
No branches or pull requests
In my case the purchase is never validated:
https://stackoverflow.com/q/75766712/856090
The text was updated successfully, but these errors were encountered: