This didnt work either
I have looked at https://appwrite.io/docs/products/auth/labels but cant solve it anyways
Chrome
And that only happens to premium in lowercase?
i have never got "premium" to be applied. And it never works if you change the label to something similar as you had before, example "Sub" to "Subscription"
it only works then i change label to something totaly diffrent
and in the server console it always says that it worked and the new label is applied, but in reality, its not always applied
its so unpredictable and that is why i cant figure it out
it is just like appwrite is glitching randomly
Please provide a step by step guide where you are certain that this always happens
In bulletpoints
Because what you described sounds really weird
yeah i know
this is my return/page.tsx either way.
import { stripe } from "../utils/stripe"; import { updateUserLabels } from "@/lib/updateUserLabels";
interface SearchParams { session_id: string; }
async function getSession(sessionId: string) { const session = await stripe.checkout.sessions.retrieve(sessionId); return session; }
export default async function CheckoutReturn({ searchParams }: { searchParams: SearchParams }) { const sessionId = searchParams.session_id; const session = await getSession(sessionId); const userId = session.client_reference_id;
console.log("Retrieved session:", session);
if (session?.payment_status === "paid" && userId) { console.log("Payment is successful, updating user labels..."); await updateUserLabels(userId, 'premium'); } else { console.log("Payment is not successful or user ID is missing."); }
return ( <div className="flex items-center justify-center min-h-screen"> <div className="bg-white p-6 rounded-lg shadow-md w-full max-w-md text-center"> {session?.payment_status === "unpaid" ? ( <div> <h2 className="text-2xl font-bold mb-4">Payment Failed</h2> <p className="text-red-500">Payment did not work. Please try again.</p> </div> ) : session?.payment_status === "paid" ? ( <div> <h2 className="text-2xl font-bold mb-4">Thank You!</h2> <p className="text-green-500">We appreciate your subscription!</p> <p>Your Stripe customer ID is: <span className="font-mono">{session.customer as string}</span></p> <p>Your User ID is: <span className="font-mono">{session.client_reference_id}</span></p> </div> ) : ( <div> <h2 className="text-2xl font-bold mb-4">Processing Payment</h2> <p>Please wait while we process your payment.</p> </div> )} </div> </div> ); }
and updateUserLabels.ts
Can you show me how you have set up the structure? I give up on appwrite soon, the old database was so stright forward
Really appreciate the effort and support anyways
In all honesty this is a really weird issue and I can't pinpoint where the issue is. Your code does not say say much nor does it look wrong on first glance. You have to provide as much information as possible in order to make debugging easier. I can't reproduce this on my end so you have to provide a step for step guide when this error happens.
What do you mean Appwrite don't update? So you:
- Went to the user in the Appwrite console
- Updated labels to be premium
- Clicked update
- Refreshed the page and...
No i run the code to add label to the user i min auth. And after my server side console says that it worked, i go to appwrite and refresh the page, and sometimes there is no label added to the user/or the old label is still there.
yeah i understand, sry that i cant provide more information
So to clarify. This only happens when you run "your" code?
The one you sent in the chat?
Now i got something intressting, look
Recommended threads
- Use different email hosts for different ...
Hello, I have 2 projects and i want to be able to set up email templates in the projects. Both projects will have different email host configurations. I see ...
- Deep Linking & Password reset
I am using react native with expo. I want to implement deep link with the url recived via email. So when clicked the link it opens my app. I havent ever used de...
- Migrate from cloud to localhost
Hello everyone. I need to migrate my test project from cloud to localhost, however it seems that this is possible only if a self-hosted appwrite instance it's h...