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
<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
using Stripe; | |
var builder = WebApplication.CreateBuilder(args); | |
var app = builder.Build(); | |
app.MapPost("/webhook", async (HttpRequest request) => | |
{ | |
var json = await new StreamReader(request.Body).ReadToEndAsync(); | |
const string signingSecret = "whsec_..."; |
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": "customer", | |
"path": "/v1/customers", | |
"method": "post", | |
"params": { |
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
<?php | |
require_once('vendor/autoload.php'); | |
\Stripe\Stripe::setApiKey('sk_test_...'); | |
$session = \Stripe\Checkout\Session::create([ | |
'payment_method_types' => ['card'], | |
'line_items' => [[ | |
'price_data' => [ | |
'currency' => 'usd', |
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": "startup_product", | |
"path": "/v1/products", | |
"method": "post", | |
"params": { |
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
#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; |
NewerOlder