This article presents possible use cases and corresponding sample flows that you can support. These use cases can be helpful jumping off points.
Your app can synchronize plan data between Wix and external systems to maintain consistency across platforms.
To sync pricing plans with an external database:
Call Query Plans to retrieve all existing plans from Wix.
Store the plan data in your external system, ensuring you save the plan ID and revision for future updates.
Set up event listeners for Plan Created, Plan Updated, and Plan Deleted events to automatically sync changes.
When receiving a Plan Updated` event, use the revision number to avoid conflicts and update only the changed fields in your external system.
You can bulk create plans in Wix from data stored in external systems, useful for migrating from other platforms.
To import plans from an external database:
Prepare your plan data as an array of plan objects, ensuring each has the required fields (name, pricing variants, billing terms).
Iterate through your plan array, calling Create Plan for each plan. To comply with rate limits, ensure requests are sent at least 1 second apart.
Handle any validation errors appropriately, such as missing currency configuration or invalid billing cycles.
After import, set up ongoing synchronization using domain events to keep both systems in sync.