Getting Started
Creating a marketplace product
Install the q2-marketplace module by running
q2 upgrade -p marketplace.
Note
This should also add the marketplace to your INSTALLED_ENTRYPOINTS list in your settings file.
After that you can run q2 -h and any marketplace entrypoints will be visible, e.g. create_marketplace_product and marketplace * commands
Run
q2 create_marketplace_product {name_of_product}. Pick which extensions are a part of this product.A
configuration/products.pywas created with your product name, which extensions are bundled with this product and a unique identifier assigned. Any extensions you picked now also inherit fromQ2MarketplaceMixin, this handler will enforce that an active subscription is available before users are allowed to access your product.
Subscription Events
When a user purchases, cancels, or changes their subscription on the marketplace an event will be triggered. When you provisioned your product on the marketplace (via q2 create_marketplace_product) an
HTTP handler was created for you under /marketplace/{name_of_product}/extension.py. This handler has three default methods that must be implemented, and return a SubscriptionSuccess
or SubscriptionFailure object.
cancel()The users subscription will always successfully cancel regardless of what value or status_code returned, except for error code
DO_NOT_CANCEL.
A SubscriptionEvent is passed as an parameter in each of these methods.
See API reference for additional details.
- Marketplace Models
MarketplaceProductSubscriptionEventSubscriptionEvent.eventSubscriptionEvent.event_typeSubscriptionEvent.user_idSubscriptionEvent.subscription_idSubscriptionEvent.sso_user_idSubscriptionEvent.product_identifierSubscriptionEvent.extension_urlSubscriptionEvent.extension_nameSubscriptionEvent.createdSubscriptionEvent.processedSubscriptionEvent.fi_nameSubscriptionEvent.from_json()
ErrorCodeErrorCode.USER_ALREADY_EXISTSErrorCode.USER_NOT_FOUNDErrorCode.ACCOUNT_NOT_FOUNDErrorCode.MAX_USERS_REACHEDErrorCode.UNAUTHORIZEDErrorCode.OPERATION_CANCELLEDErrorCode.CONFIGURATION_ERRORErrorCode.INVALID_RESPONSEErrorCode.PENDINGErrorCode.FORBIDDENErrorCode.BINDING_NOT_FOUNDErrorCode.TRANSPORT_ERRORErrorCode.UNKNOWN_ERRORErrorCode.DO_NOT_CANCEL
SubscriptionResultSubscriptionSuccessSubscriptionFailure
Subscription Events in development
To trigger these subscription events in development, make sure your server is running, then open a new tab and run your choice of:
q2 marketplace invoke_subscribe
q2 marketplace invoke_cancel
q2 marketplace invoke_update