Skip to content

Instantly share code, notes, and snippets.

View bsears90's full-sized avatar

Ben Sears bsears90

View GitHub Profile
import Head from 'next/head';
import React from "react";
export default class Pricing extends React.Component {
componentDidMount(){
window.servicebotSettings = {
servicebot_id: 'E0OQN0P0Dort',
email:
'//REPLACE WITH THE EMAIL OF YOUR STRIPE CUSTOMER WHO IS SUBSCRIBED TO THIS SERVICE',
service: 'Flat Subscription',
@bsears90
bsears90 / setDefault.js
Created October 10, 2022 17:56
set default payment method on all customers
const stripe = require("stripe")(process.env.STRIPE_SECRET_KEY)
async function main(){
for await (const customer of stripe.customers.list({limit: 100})) {
const paymentMethods = (await stripe.customers.listPaymentMethods(
customer.id,
{type: 'card'}
)).data;
// if customer has PM and no default, set it
if(paymentMethods.length > 0 !customer.invoice_settings.default_payment_method){