Thankyou page get order

is it possible to get the means by which a customer purchased products by code?
i would like to record transactions to a database using the thankyou page but would to exclude offline payments from the records.Any ideas?

Depends how you set up, if you go through Wix Pay then you can have the thank you page set as true for online payments
https://www.wix.com/corvid/reference/wix-pay.html#PaymentOptions

Then you can simply just use the Thank you page and the getOrder on each online order.
https://www.wix.com/corvid/reference/$w.ThankYouPage.html
https://www.wix.com/corvid/reference/$w.ThankYouPage.html#getOrder

Offline payments have to be added manually, so in theory would they actually create a Thank You page?
https://support.wix.com/en/article/setting-up-manual-offline-payments

@iankamaa70 It’s not recommended use the “thx you page” for that: the user might not reach it after payment, or stay on it long enough for your code to execute fully

The recommended way is to add a Wix store’s hook ( onOrderComplete ) in your backend which is will always executed

Thanks Quentin for adding that recommended way. :+1:

@plomteuxquentin it is possible to get the order line item data from the OnOrderCompleted such as in the LineItem object returned from a getOrder function of the ThankYouPage? I need to trigger an memberEmail with the product lineItem data, specifically with the product URL in order to ask the buyer for a review.

Hi Kentin, I don’t like the Thank you page way either, but how do you match up an order id with custom order attributes in a custom order table. It looks like the thank you page is the only way to do this because there is no link between cart id and order id at least that I can see in either the onNewOrder event or the onCartCompleted event. Also, there is no OnOrderComplete event that I can see? Did you mean onNewOrder?
Thanks,
Tom