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 characters
<html> | |
<body> | |
<script src="https://checkout.stripe.com/checkout.js"></script> | |
<button id="customButton">Purchase</button> | |
<form action="charge.php" method="POST"> | |
<input type="hidden" name="stripeToken" class="token" /> | |
<input type="hidden" name="stripeEmail" class="email" /> | |
</form> |
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 characters
<form action="charge.php" method="POST" class="charge_form"> | |
<div class="customButton"> | |
<button>...</button> | |
<script>...</script> | |
</div> | |
</form> |
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 characters
cus = Stripe::Customer.retrieve('cus_id') | |
coupon = Stripe::Coupon.retrieve('coupon') | |
cus.coupon = coupon.id | |
cus.save | |
# times_redeemed = 1 | |
cus.coupon = coupon.id | |
cus.save |
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 characters
var regex = /[^a-zA-Z ]+/; | |
if (name = "" || regex.test(name)){ | |
// Invalid Name if you get here. | |
} |
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 characters
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script> | |
<script src="https://checkout.stripe.com/checkout.js"></script> | |
<button id="customButton">Purchase</button> | |
<label><input type="radio" name="amount" value="2000" data-description="DESCRIBE $20 PRODUCT HERE">$20</label> | |
<label><input type="radio" name="amount" value="5000" data-description="DESCRIBE $50 PRODUCT HERE">$50</label> | |
<label><input type="radio" name="amount" value="10000" data-description="DESCRIBE $100 PRODUCT HERE">$100</label> | |
<script> |
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 characters
Stripe_Charge::create(array( | |
"amount" => 400, | |
"currency" => "usd", | |
"card" => "some_token_here", // obtained with Stripe.js, | |
"metadata" => array("key" => "value", "key2" => "value2") | |
)); |
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 characters
<html> | |
<body> | |
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> | |
<script src="https://checkout.stripe.com/checkout.js"></script> | |
<input type="email" class="email-field" /> | |
<button id="customButton">Purchase</button> |
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 characters
cus_invoices = Stripe::Invoice.all(:customer=>customer.id, :count=>1).data | |
cus_invoices.each do |invoices| | |
line_items = invoices.lines.data.each do |data| | |
if data.type == 'invoiceitem' | |
# Deal with InvoiceItem here. | |
elsif data.type == 'subscription' | |
# Deal with Subscription here. |
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 characters
<html> | |
<body> | |
<script src="https://checkout.stripe.com/checkout.js"></script> | |
<input type="text" id="amount" /> | |
<button id="customButton">Purchase</button> | |
<script> |
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 characters
<script> | |
var handler = StripeCheckout.configure({ | |
key: 'pk_your_public_key', | |
token: function(token, args) { | |
// Use the token to create the charge with a server-side script. | |
}, | |
closed: function(e) { | |
// The popup was closed. | |
} |