Created
June 19, 2020 14:55
-
-
Save SimonHoiberg/282bad246570c727d63d52598e411173 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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