TAM
TAM
BABetter Auth
Created by TAM on 4/7/2025 in #help
How to fix Stripe error
add: authorizeReference stripe({ stripeClient, stripeWebhookSecret: process.env.STRIPE_WEBHOOK_SECRET!, createCustomerOnSignUp: true, subscription: { enabled: true, plans: [ { name: "pro", // the name of the plan, it'll be automatically lower cased when stored in the database priceId: process.env.NEXT_PUBLIC_STRIPE_MONTHLY_PRICE_ID, // the price id from stripe annualDiscountPriceId: process.env.NEXT_PUBLIC_STRIPE_YEARLY_PRICE_ID, // (optional) the price id for annual billing with a discount }, ], // updateUserMetadata: true, // Track subscription info in user metadata authorizeReference: async ({ user, session, referenceId, action }) => { try { // Check if the user has permission to manage subscriptions for this reference if ( action === "upgrade-subscription" || action === "cancel-subscription" ) { const [org] = await db .select() .from(schema.members) .where( sql${schema.members.organizationId} = ${referenceId} AND ${schema.members.userId} = ${user.id}, ) .limit(1) return org?.role === "owner" } return true } catch (error) { console.error("Error authorizing subscription reference:", error) return false } }, ....
11 replies
BABetter Auth
Created by TAM on 4/7/2025 in #help
How to fix Stripe error
no any problem.
11 replies
BABetter Auth
Created by TAM on 4/7/2025 in #help
How to fix Stripe error
I downgraded Stripe to version 17.7.0, and it works!
11 replies