I’m creating a site which uses the Pricing Plans feature, with Stripe. I want to have a separate server which processes the payment events generated by Stripe.
My problem is, I don’t see a way to know which Wix user created which Stripe payment, as Wix does not seem to provide Stripe with information that would link the payment to the user. What Stripe seems to get is the email and name entered in the payment page (which is not necessarily the same as the Wix account email and name).
How can I know which Wix user made the payment?
Thanks,
Juan
Hi Juan.
Currently, I don’t think there’s a built-in method to do this. However, I would recommend using onPlanPurchased u[/u] to retrieve ‘memberId’, which is one of the fields returned in this function as you can see in the API. Then, query ‘_id’ field of the Members/PrivateData collection for that value.
Good luck!
Thank you for your response Sam. The problem with that approach is that onPlanPurchased event tells you a member purchased a plan, but it provides no information relating to the stripe payment, so it does not provide enough information to know which stripe payment was made by this user.
What I ended up doing was intercepting the wixPay_onPaymentUpdate() event which provides you the stripe payment information, and wixUsersBackend.currentUser to know which user made that stripe payment, then save that information on a firebase server. Then the external server that processes the Stirpe events can check on the firebase database so it can know which wix user made that stripe payment.
I think ideally Wix should pass Stripe the wix user ID of the user making the payment to stripe in the metadata fields, so that if we want to process the stripe-generated events on an external server, we can tell which user made the payment.
Thanks!
Update: Turns out there seems to be a Wix bug where wixPay_onPaymentUpdate() event is not triggered. So I don’t see any possible way to know which Wix user made which Stripe payment. I’m stuck