[Velo] Exporting orders via external API on order creation

Question:
Export order data to external API on order creation

Product:
Wix Velo

What are you trying to achieve:
I want that, once any order is created, to be able to do an HTTP request to an external API, from the backend (because security).

What have you already tried:
I tried to hook to wixPricingPlans_onOrderCreated event in events.js backend file - but it’s not triggered. I’m not sure I understand how events.js content works.

If my function is:
export function wixPricingPlans_onOrderCreated(event) {
console.log(“called”);
}

then the event is automatically registered by Valo, just based on the name?

The idea is that I need to do this call in the easiest way possible, but currently I’m unable to hook to a correct backend event for order created.

Thank you guys!

Hi there!

Yes, Velo automatically registers the events, based on the names of their functions since these are programmed to fire on specific events.

Are you selling Pricing Plans on your website? Only then should you use the wixPricingPlans_onOrderCreated event. If you have an ecommerce store, then you should use the wixStores_onNewOrder event that will fire from the backend whenever a new order is placed.

1 Like

@Pratham you saved my day - it worked! Thank you so much!

1 Like