How to resolve "id: undefined" Prisma error when launching Stripe from DOM with Memberstack?
hi everyone, i'm struggling to get stripe to launch from the DOM. I keep getting this weird error.
"
Invalid `prisma.price.findUnique()` invocation:{
where: {
id: undefined,
? AND?: PriceWhereInput | PriceWhereInput[],
? OR?: PriceWhereInput[],
? NOT?: PriceWhereInput | PriceWhereInput[],
? createdAt?: DateTimeFilter | DateTime,
? updatedAt?: DateTimeNullableFilter | DateTime | Null,
? env?: EnumMemberstackEnvFilter | MemberstackEnv,
? name?: StringNullableFilter | String | Null,
? active?: BoolFilter | Boolean,
? amount?: FloatFilter | Float,
? currency?: StringFilter | String,
? intervalCount?: IntNullableFilter | Int | Null,
? freeTrialEnabled?: BoolNullableFilter | Boolean | Null,
? freeTrialDays?: IntNullableFilter | Int | Null,
? setupFeeEnabled?: BoolNullableFilter | Boolean | Null,
? setupFeeAmount?: IntNullableFilter | Int | Null,
? expirationCount?: IntNullableFilter | Int | Null,
? cancelAtPeriodEnd?: BoolNullableFilter | Boolean | Null,
? stripePriceId?: StringNullableFilter | String | Null,
? paypalPlanId?: StringNullableFilter | String | Null,
? planId?: StringFilter | String,
? appId?: StringFilter | String,
? freeTrialRequiresCard?: BoolNullableFilter | Boolean | Null,
? setupFeeName?: StringNullableFilter | String | Null,
? type?: EnumPriceTypeFilter | PriceType,
? intervalType?: EnumPriceIntervalNullableFilter | PriceInterval | Null,
? expirationInterval?: EnumPriceExpirationIntervalNullableFilter | PriceExpirationInterval | Null,
? description?: StringNullableFilter | String | Null,
? status?: EnumPriceStatusFilter | PriceStatus,
? taxType?: EnumTaxTypeNullableFilter | TaxType | Null,
? stripePriceTestId?: StringNullableFilter | String | Null,
? teamAccountsEnabled?: BoolNullableFilter | Boolean | Null,
? maxTeamMembers?: IntNullableFilter | Int | Null,
? memberCheckoutSession?: MemberCheckoutSessionListRelationFilter,
? members?: MemberPlanConnectionPaymentListRelationFilter,
? sessions?: SessionListRelationFilter,
? app?: AppRelationFilter | AppWhereInput,
? plan?: PlanRelationFilter | PlanWhereInput
},
include: {
plan: true
}
}Argument `where` of type PriceWhereUniqueInput needs at least one of `id` arguments. Available options are marked with ?."
If I use the custom attribute with the same price id in webflow it works fine....
Code snippet:
document.addEventListener("DOMContentLoaded", async () => {
const memberstack = window.$memberstackDom;
const button = document.getElementById("button-temp");
const memberData = await memberstack.getCurrentMember();
if (!memberData.data || !button) return;
button.addEventListener("click", async () => {
const selectedSub = memberData.data.customFields["selected-subscription"];
// Get the price ID based on subscription
let priceId = "";
switch (selectedSub) {
case "The Nul Therapy Programme":
priceId = "prc_tntp-monthly-subscription-zro0ciy";
break;
case "The Nul Programme":
priceId = "prc_tnp-monthly-subscription-p1380pnj";
break;
case "The Nul Reduction Programme":
priceId = "prc_tnrp-monthly-subscription-an9e030l";
break;
default:
console.error("Unknown subscription:", selectedSub);
return;
}
// Start Stripe checkout
try {
const checkout = await memberstack.purchasePlansWithCheckout({
priceIds: [priceId],
successUrl: window.location.origin + "/whats-next",
cancelUrl: window.location.origin + "/motivation",
configuration: {
subscription_cancel: { enabled: true }
}
});
// Redirect to Stripe checkout
window.location.href = checkout.url;
} catch (error) {
console.log("Checkout failed:", error);
alert("Couldn't start checkout. Please try again.");
}
});
});
Comments
5 comments
Try just priceId : yourpriceid
I don’t think that accepts an array.
i used the code from here https://developers.memberstack.com/dom-package/plan-management#plan-purchase-flow
same error
any ideas Tyler Bell
As a test can you hard code a priceId instead of relying on that variable?
i tried that and get the same error
i also tried calling it in the console and i get the same error and 400
i tried again, same error
Ah got it. Thanks for letting us know.
cc Josh Lopez
Please sign in to leave a comment.