Revisions
-
maccman revised this gist
Dec 16, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -25,7 +25,7 @@ def charge(): ) charge = stripe.Charge.create( customer=customer.id, amount=amount, currency='usd', description='Flask Charge' -
maccman revised this gist
Dec 15, 2012 . 1 changed file with 11 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -19,12 +19,17 @@ def index(): def charge(): amount = 500 customer = stripe.Customer.create( email='customer@example.com', card=request.form['stripeToken'] ) charge = stripe.Charge.create( customer=customer, amount=amount, currency='usd', description='Flask Charge' ) return render_template('charge.html', amount=amount) -
maccman revised this gist
Nov 13, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,6 +5,6 @@ <label>Amount: $5.00</label> </article> <script src="https://checkout.stripe.com/v2/checkout.js" class="stripe-button" data-key="{{ key }}"></script> </form> {% endblock %} -
maccman revised this gist
Oct 3, 2012 . 3 changed files with 6 additions and 14 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -17,13 +17,13 @@ def index(): @app.route('/charge', methods=['POST']) def charge(): amount = 500 stripe.Charge.create( amount=amount, currency='usd', card=request.form['stripeToken'], description='Stripe Flask' ) return render_template('charge.html', amount=amount) This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ {% extends "layout.html" %} {% block content %} <h2>Thanks, you payed <strong>$5.00</strong>!</h2> {% endblock %} This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,17 +2,9 @@ {% block content %} <form action="/charge" method="post"> <article> <label>Amount: $5.00</label> </article> <script src="https://button.stripe.com/v1/button.js" class="stripe-button" data-key="{{ key }}"></script> </form> {% endblock %} -
maccman revised this gist
Sep 10, 2012 . 3 changed files with 2 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -22,7 +22,7 @@ def charge(): stripe.Charge.create( amount=amount * 100, currency='usd', card=request.form['stripeToken'], description=request.form['description'] ) This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -13,8 +13,6 @@ </label> </article> <script src="https://button.stripe.com/v1/button.js" class="payment-button" data-key="{{ key }}"></script> </form> {% endblock %} This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,10 +1,6 @@ <!DOCTYPE html> <html> <head> <title>Stripe</title> <style type="text/css" media="screen"> -
maccman created this gist
Aug 8, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,32 @@ import os from flask import Flask, render_template, request import stripe stripe_keys = { 'secret_key': os.environ['SECRET_KEY'], 'publishable_key': os.environ['PUBLISHABLE_KEY'] } stripe.api_key = stripe_keys['secret_key'] app = Flask(__name__) @app.route('/') def index(): return render_template('index.html', key=stripe_keys['publishable_key']) @app.route('/charge', methods=['POST']) def charge(): amount = int(request.form['amount']) stripe.Charge.create( amount=amount * 100, currency='usd', card=request.form['stripe_token'], description=request.form['description'] ) return render_template('charge.html', amount=amount) if __name__ == '__main__': app.run(debug=True) This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,4 @@ {% extends "layout.html" %} {% block content %} <h2>Thanks, you payed <strong>${{ amount }}</strong>!</h2> {% endblock %} This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,20 @@ {% extends "layout.html" %} {% block content %} <form action="/charge" method="post"> <article> <label class="amount"> <span>Amount</span> $<input type="text" name="amount" placeholder="1.00" required> </label> <label> <span>Reason</span> <input type="text" name="description" placeholder="Dinner"> </label> </article> <payment data-key="{{ key }}"></payment> <input class="submit" type="submit" value="Pay with Stripe!"> </form> {% endblock %} This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ <!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.js"></script> <script src="https://js.stripe.com/v1/"></script> <script src="https://tag.stripe.com/v1/tag.js"></script> <link rel="stylesheet" href="https://tag.stripe.com/v1/themes/stripe.css" type="text/css"> <title>Stripe</title> <style type="text/css" media="screen"> form article label { display: block; margin: 5px; } form .submit { margin: 15px 0; } </style> </head> <body> {% block content %}{% endblock %} </body> </html>