def create_checkout_session(): company_id = request.get_json(force=True).get('company_id') event = Event.find(Company.find(company_id).event_id) checkout_session = stripe.checkout.Session.create( payment_method_types=['card'], line_items=[ { 'price_data': { 'currency': 'bgn', 'unit_amount': event.payment * 100, 'product_data': { 'name': event.name, # 'images': ['https://i.imgur.com/EHyR2nP.png'], }, }, 'quantity': 1, }, ], mode='payment', success_url="http://localhost:3000/view-company/" + str(current_user.id) + '?success=true', cancel_url="http://localhost:3000/view-company/" + str(current_user.id) + '?canceled=true', ) return jsonify({"id": checkout_session.id})
def subscribe_company(): company_id = request.get_json(force=True).get('company_id') event_id = Company.find(company_id).event_id Payment.make_payment(company_id, event_id) return jsonify({"subscription": True})
def payment_status(): company_id = request.args.get('company_id') event_id = Company.find(company_id).event_id flag = Payment.check_for_payment(event_id, company_id) return jsonify({"payment": flag})