def post(self):
        data = self.token_parser.parse_args()
        current_user_id = get_jwt_identity()

        logged_in = current_user_id is not None
        app_id = data['app_id']
        amount = data['amount']
        lifetime = shortRepoTokenLifetime

        # TODO: Actually attempt stripe purchase if amount > 0

        if amount > 0:  # And purchase succeeds
            lifetime = longRepoTokenLifetime

        if logged_in:
            new_purchase = Purchase(app_id=app_id, user_id=current_user_id)
            try:
                new_purchase.save_to_db()
            except:
                pass

        token = jwt.encode(
            {
                'sub': 'users/%d' %
                (current_user_id if current_user_id else 0),
                'prefixes': [app_id],
                'exp': datetime.utcnow() + lifetime,
                'name': 'auth.py',
            },
            repo_secret,
            algorithm='HS256').decode('utf-8')

        return_data = {"token": token}
        if amount > 0:
            return_data["store"] = True
        else:
            return_data["store"] = False

        return return_data