This file contains 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
@app.route('/create-checkout-session', methods=['POST']) | |
def create_checkout_session(): | |
try: | |
checkout_session = stripe.checkout.Session.create( | |
line_items=[ | |
{ | |
'price': '<hard code your price ID here>', | |
'quantity': 1, | |
}, | |
], |
This file contains 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
<div class="w-96 h-56 m-auto bg-red-100 rounded-xl relative text-white shadow-2xl transition-transform transform hover:scale-110"> | |
<div class="relative object-cover w-full h-full rounded-xl bg-gradient-to-r from-teal-400 to-blue-400" ></div> | |
<div class="w-full px-8 absolute top-8"> | |
<div class="flex justify-between"> | |
<div> | |
<span class="font-light">Name</span> | |
<p id="cardholder-name" class="font-medium tracking-widest"> | |
Jenny Rosen | |
</p> | |
</div> |
This file contains 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
#card-back { | |
position: relative; | |
width: 384px; | |
height: 244px; | |
background-image: url("/assets/card-back.png"); | |
background-size: 100%; | |
background-repeat: no-repeat; | |
} | |
#card-details { |
This file contains 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
require 'stripe' | |
Stripe.api_key = ENV['STRIPE_SECRET_KEY'] | |
def date_description(dates) | |
end | |
def next_dates | |
# some database stuff | |
[start_date, end_date] | |
end |
This file contains 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
const stripe = require('stripe')(process.env.STRIPE_SECRET_KEY); | |
/* | |
* Next available dates loaded from some database | |
*/ | |
const calendar = require('./data/calendar.json'); | |
exports.handler = async (event) => { | |
const nextDates = getNextDates(calendar) | |
const { startDate, endDate } = nextDates; |
This file contains 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
import Stripe from 'stripe' | |
const stripe = new Stripe(process.env.STRIPE_SECRET_KEY) | |
export const action = async ({request}) => { | |
const secret = 'whsec_...' // process.env.WEBHOOK_SIGNING_SECRET | |
const sig = request.headers.get('stripe-signature') | |
let event; | |
const payload = await request.text() |
This file contains 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
{ | |
"_meta": { | |
"template_version": 0 | |
}, | |
"fixtures": [ | |
{ | |
"name": "location", | |
"path": "/v1/terminal/locations", | |
"method": "post", | |
"params": { |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
class SubscriptionsController < ApplicationController | |
def new | |
@customer = Stripe::Customer.create | |
@subscription = Stripe::Subscription.create( | |
customer: @customer.id, | |
items: [{ | |
price: 'price_1KW5LPG3pPSOzbKUr6hQmTAr', | |
}], | |
payment_behavior: 'default_incomplete', | |
expand: ['latest_invoice.payment_intent'] |
This file contains 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
# After commit, we always check to make sure each user has both | |
# a Stripe Account and a Financial Account for that Stripe Account. | |
after_commit :ensure_stripe_account | |
after_commit :ensure_stripe_financial_account | |
def ensure_stripe_account | |
return if stripe_account_id.present? | |
# Create the Connected account | |
# This must be a custom connect account, but for |
NewerOlder