Orders: Sample Use Case & Flow

This article shares a possible use case your app could support, as well as a sample flow that could support the use case. This can be a helpful jumping off point as you plan your app's implementation.

Send an email on successful payment of online orders

Site owners can use your app to reach out to their customers and send a confirmation email that a payment was successful. To begin, create an email template to use for these messages. Site owners can also design their own with their email marketing dashboard.

To listen for successful payments and send a confirmation email to the customer, follow this flow:

  1. Listen for any new payments using the Payment Webhook.
  2. When the webhook is triggered, check for a wixAppId of 1522827f-c56c-a5c9-2ac9-00f9e6ae12d3 (the Wix App ID for Pricing Plans) and extract the wixAppOrderId.
  3. Call Get Order using the wixAppOrderId as the id for the order to retrieve.
  4. Extract the order.buyer.memberId to retrieve the buyer's memberId.
  5. Use the ID to Get Member and extract the member's loginEmail.
  6. Call Query Email Subscriptions and filter by the email address to confirm that the member has agreed to receive emails from the site owner.
  7. Use Get or Create Conversation and Send Message to send an email to the buyer.
Was this helpful?
Yes
No