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 "https://esm.sh/stripe?target=deno"; | |
const stripe = Stripe(Deno.env.get("STRIPE_API_KEY"), { | |
// This is needed to use the Fetch API rather than relying on the Node http | |
// package. | |
httpClient: Stripe.createFetchHttpClient(), | |
}); | |
export async function handler (req: object) { |
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
require 'json' | |
require 'stripe' | |
Stripe.api_key = '<your-api-key>' | |
# { | |
# "Id": "selinazawacki-shirt", | |
# "Maker": "selinazawacki", | |
# "Image": "https://user-images.githubusercontent.com/41929050/61567058-142c1c80-aa33-11e9-89fb-b4f30d84d69d.png", | |
# "Url": "https://www.instagram.com/p/BEXlpiZCnJ3", |
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
Stripe::Checkout::Session.create({ | |
success_url: 'https://example.com/success', | |
cancel_url: 'https://example.com/cancel', | |
payment_method_types: ['card'], | |
line_items: [{ | |
price: recurring_price_id, | |
quantity: 1 | |
}, { | |
price: one_time_price_id, | |
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
config = Stripe::BillingPortal::Configuration.create({ | |
features: { | |
customer_update: { | |
allowed_updates: ['email', 'tax_id'], | |
enabled: true, | |
}, | |
subscription_update: { | |
enabled: true, | |
default_allowed_updates: ['price'], | |
products: [{ |
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
// Stripe Secret API key pulled from the Stripe Dashboard | |
const STRIPE_API_KEY = 'sk_test_...'; | |
// The checkoutSessionId is pulled out of the input from the previous action which was "webhook received" | |
const {checkoutSessionId} = input.config(); | |
// Use the Checkout Session ID to construct a URL for making a GET API request to Stripe | |
// Note that we're passing `expand[]=line_items` and `expand[]=customer` so that | |
// the data returned from the API includes all of the related line item and customer data. | |
let response = await fetch(`https://api.stripe.com/v1/checkout/sessions/${checkoutSessionId}?expand[]=line_items&expand[]=customer`, { |
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
var options = new PaymentIntentCreateOptions | |
{ | |
Amount = 1999, | |
Currency = req.Currency, | |
PaymentMethodTypes = new List<string> | |
{ | |
req.PaymentMethodType, | |
}, | |
}; |
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
(async () => { | |
const customer = await stripe.customers.create({ | |
payment_method: 'pm_card_chargeCustomerFail', | |
invoice_settings: { | |
default_payment_method: 'pm_card_chargeCustomerFail' | |
} | |
}) | |
const subscription = await stripe.subscriptions.create({ | |
customer: customer.id, | |
items: [{ plan: '802836528202eb82f5552bc0ddc0278d144e5182' }], // 802836528202eb82f5552bc0ddc0278d144e5182 |
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
server_langs_for_integration () { | |
integration=${1:-main} | |
jq -r ".integrations[] | select(.name==\"${integration}\") | .servers | .[]" | |
} | |
# 1. Create a .env in the root of the sample | |
# 2. Run `copy_env <sample name>` to copy into all of the server directories. | |
copy_env() { | |
# accepts the path to the sample as the first arg. |