Thank for your video, but i have another problem, and i don't know if you can help me with. How can i Get current user inside register_rest_route method. I made custom Stripe checkout integration in my wordpress theme and everything working well, after payment in stripe chekout, it checkout close and send event to an custom endpoint that i've created by registered new rest_route locally and this rest route call a function which will save data inside Stripe event that it receive. So in this function i essentially need to update user_meta data of the connected user but it's not working, in this function when i make and echo of current_user->ID , it print me 0. I make a search , and it appear that i need to authenticate user on WP REST API too, but i don't really found how to do it. Can you help me please ?
You can use the sessions and cookies to detect the current user for that purpose. Is there info you can send to stripe and stripe returns as well? You can send an ID of the customer and it’s returned as a string. All this depends if you don’t allow guest checkout. However, stripe should be able to give you the order ID you sent for payment and you can use that to evaluate which payment was done.
Thank you for these videos, you explain everything very clearly.
I changed the code so that I could GET datas from users by using the parameter name.
Hi sir, i did followed ur guide until i still can’t submit to my endpoint within my localhost wordpress. Is it only working on hosted domain?
Great videos! Super helpful.
Glad it was helpful!
Nice explanation. Thanks for video.
Glad it was so clear.
Thank for your video, but i have another problem, and i don't know if you can help me with.
How can i Get current user inside register_rest_route method. I made custom Stripe checkout integration in my wordpress theme and everything working well, after payment in stripe chekout, it checkout close and send event to an custom endpoint that i've created by registered new rest_route locally and this rest route call a function which will save data inside Stripe event that it receive. So in this function i essentially need to update user_meta data of the connected user but it's not working, in this function when i make and echo of current_user->ID , it print me 0. I make a search , and it appear that i need to authenticate user on WP REST API too, but i don't really found how to do it. Can you help me please ?
You can use the sessions and cookies to detect the current user for that purpose. Is there info you can send to stripe and stripe returns as well? You can send an ID of the customer and it’s returned as a string. All this depends if you don’t allow guest checkout. However, stripe should be able to give you the order ID you sent for payment and you can use that to evaluate which payment was done.