Sample Flows

This article presents a sample flow your app can support. You aren't limited to this exact flow, but they can be a helpful jumping off point as you plan your pricing integration.

Price Calculation Flow

  1. A site owner installs and authorizes your 3rd-party app to calculate prices for their services based on various factors (region, age, taxes, and so on). The app collects the JSON Web Token (JWT), decodes it, and stores the resulting instance ID.

    For example, the token in this request:

    Copy

    Decodes into:

    Copy
  2. Once the site owner installs the app, Wix ignores the built-in pricing logic for pricing Bookings services and instead uses the pricing logic provided by your app.

  3. A customer logs on to the merchant’s Wix site and starts placing an order for a booking.

  4. When the customer books on the Wix site, the checkout process (such as Wix eCommerce, coming soon!) sends a Calculate Price service plugin request, including the booking object, to your app.

  5. Your app triggers the required flow on its platform to process the request.

    Wix expects an object containing the price, and either a 4xx HTTP status code (and some errors) or a 200 HTTP status code.

  6. Wix expects an array of line items for the booking and either a calculated price or a textual price description.

    When returning a price description, the app formats the response like this:

    Copy

    When returning a calculated price, the app formats the response like this:

    Copy
  7. The Wix site displays the updated pricing on a site page. The customer can confirm the price before proceeding to payment.

Did this help?