forked from razorpay/razorpay-python-testapp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
23 lines (16 loc) · 585 Bytes
/
app.py
File metadata and controls
23 lines (16 loc) · 585 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import razorpay
import json
from flask import Flask, render_template, request
app = Flask(__name__,static_folder = "static", static_url_path='')
razorpay_client = razorpay.Client(auth=("<APP_ID>", "<APP_SECRET>"))
@app.route('/')
def app_create():
return render_template('app.html')
@app.route('/charge', methods=['POST'])
def app_charge():
amount = 5100
payment_id = request.form['razorpay_payment_id']
razorpay_client.payment.capture(payment_id, amount)
return json.dumps(razorpay_client.payment.fetch(payment_id))
if __name__ == '__main__':
app.run()