Skip to content

Instantly share code, notes, and snippets.

View SimonHoiberg's full-sized avatar

Simon Høiberg SimonHoiberg

View GitHub Profile
# serverless.yml
stripe-retrieve-subscription:
handler: dist/lambdas/stripe/retrieveSubscription.handler
events:
- http:
path: stripe/retrieve-subscription
method: post
environment:
STRIPE_SECRET_KEY: PUT-YOUR-SECRET-KEY-HERE
interface IBody {
subscriptionID: string;
}
export const handler = async (
event: APIGatewayProxyEvent,
context: any,
callback: (err: Error | null, data: any) => void,
) => {
if (!event.body) {
callback(Error('Invalid body'));
return;
}
# serverless.yml
stripe-retrieve-payment-method:
handler: dist/lambdas/stripe/retrievePaymentMethod.handler
events:
- http:
path: stripe/retrieve-payment-method
method: post
environment:
STRIPE_SECRET_KEY: PUT-YOUR-SECRET-KEY-HERE
interface IBody {
paymentMethodID: string;
}
export const handler = async (
event: APIGatewayProxyEvent,
context: any,
callback: (err: Error | null, data: any) => void,
) => {
if (!event.body) {
callback(Error('Invalid body'));
return;
}
# serverless.yml
stripe-retry-invoice:
handler: dist/lambdas/stripe/updatePaymentMethod.handler
events:
- http:
path: stripe/retry-invoice
method: post
environment:
STRIPE_SECRET_KEY: PUT-YOUR-SECRET-KEY-HERE
interface IBody {
paymentMethodID: string;
customerID: string;
invoiceID: string;
}
export const handler = async (
event: APIGatewayProxyEvent,
context: any,
callback: (err: Error | null, data: any) => void,
) => {
if (!event.body) {
callback(Error('Invalid body'));
return;
}
# serverless.yml
stripe-update-payment-method:
handler: dist/lambdas/stripe/retryInvoice.handler
events:
- http:
path: stripe/update-payment-method
method: post
environment:
STRIPE_SECRET_KEY: PUT-YOUR-SECRET-KEY-HERE