mirror of
https://github.com/appwrite/console.git
synced 2026-11-18 20:47:21 +00:00
fix: only use client secrets if there's no providerMethodId set
This commit is contained in:
1 parent
979073bdf7
commit
2e7426a882
1 file changed
+6
-1
@@ -19,7 +19,12 @@ export async function initializeStripe() {
|
||||
isStripeInitialized.set(true);
|
||||
|
||||
const methods = await sdk.forConsole.billing.listPaymentMethods();
|
||||
clientSecret = methods.paymentMethods[0]?.clientSecret;
|
||||
|
||||
// Get the client secret from empty payment method if available
|
||||
clientSecret = methods.paymentMethods?.filter(
|
||||
(method) => !!method?.clientSecret && !method?.providerMethodId
|
||||
)[0]?.clientSecret;
|
||||
|
||||
// If there is no payment method, create an empty one and get the client secret
|
||||
if (!clientSecret) {
|
||||
paymentMethod = await sdk.forConsole.billing.createPaymentMethod();
|
||||
|
||||
Reference in new issue
Block a user