Skip to content

Instantly share code, notes, and snippets.

@SimonHoiberg
Created June 19, 2020 14:55
Show Gist options
  • Save SimonHoiberg/282bad246570c727d63d52598e411173 to your computer and use it in GitHub Desktop.
Save SimonHoiberg/282bad246570c727d63d52598e411173 to your computer and use it in GitHub Desktop.
class StripeManager {
...
public static async updatePaymentMethod(customerID: string, paymentMethodID: string) {
await fetch('https://your-endpoint/stripe/update-payment-method', {
method: 'POST',
body: JSON.stringify({
customerID,
paymentMethodID,
}),
});
// Update your user in DB to store the new payment method
// updateUserInDB() is *your* implementation of updating a user in the DB
updateUserInDB({ paymentMethodID });
}
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment