Test a SaaS plan
This article explains how to test a software as a service (SaaS) offer in preview.
Here are some general guidelines to be aware of when you’re testing your offer.
- If your SaaS offer supports metered billing using the commercial marketplace metering service, review and follow the testing best practices detailed in Marketplace metered billing APIs.
- Review and follow the testing instructions in Implementing a webhook on the SaaS service to ensure your offer is successfully integrated with the APIs.
- If the Offer validation step resulted in warnings, a View validation report link appears on the Offer overview page. Be sure to review the report and address the issues before you select the Go live button. Otherwise, certification will most likely fail and delay your offer from going Live.
- If you need to make changes after previewing and testing the offer, you can edit and resubmit to publish a new preview. For more information, see Update an existing offer in the commercial marketplace.
Note
In this example we will use the SaaS Accelerator for the landing page.
Verify the purchase of a private test plan
Publishers can use Commercial Marketplace to verify the purchase of a test plan.
Sign in to Partner Center.
On the Home page, select the Insights tile.
In the left menu, select Orders.
In the upper-right, select the filter icon and filter by Offer Name. The Orders by offers widget shows the number of subscriptions that have been purchased. You should notice that the number of new orders have increased.
Note
It can take up to 48 hours before offer orders appear in the report.
In the left-nav, select Downloads.
From the Report type list, select Orders.
From the Select timeframe list, select 3 months.
Under File Extension, select CSV.
Select Generate.
Download the .CSV file and verify that the new subscription for your test plan is shown in the report.
Send metered usage Event
If your test plan is configured to send usage events, it is important to test the metered plan usage by sending metered events to Marketplace Metered API. This is an example of how to send metered usage events using a tool that can send HTTP requests to test your solution, for example:
Visual Studio Code with an extension from Visual Studio Marketplace
-
Caution
For scenarios where you have sensitive data, such as credentials, secrets, access tokens, API keys, and other similar information, make sure to use a tool that protects your data with the necessary security features, works offline or locally, doesn't sync your data to the cloud, and doesn't require that you sign in to an online account. This way, you reduce the risk around exposing sensitive data to the public.
When you test metered usage, we recommend that you send more than the number of usage events that are covered by the base fee and then verify that only the number of usage events that exceed the base fee are sent to Microsoft.
Send a request
Using an API tool that can send HTTP requests to test your solution, send a request body like the one shown in this example.
Request body example:
{
"resourceId": <guid>, // unique identifier of the resource against which usage is emitted.
"quantity": 5.0, // how many units were consumed for the date and hour specified in effectiveStartTime, must be greater than 0 or a double integer
"dimension": "dim1", // custom dimension identifier
"effectiveStartTime": "2018-12-01T08:30:14", // time in UTC when the usage event occurred, from now and until 24 hours back
"planId": "plan1", // id of the plan purchased for the offer
}
Query parameters:
Parameter | Comment |
---|---|
resourceId | This will be your SaaS subscriptionId |
quantity | You can enter 1 for quantity as the test value |
dimension | Enter the name of the dimension defined in the metered plan |
planId | Enter the metered plan ID |
View the response
You should receive a response like the one shown in this example.
Response payload example:
{
"usageEventId": <guid>, // unique identifier associated with the usage event in Microsoft records
"status": "Accepted" // this is the only value in case of single usage event
"messageTime": "2020-01-12T13:19:35.3458658Z", // time in UTC this event was accepted
"resourceId": <guid>, // unique identifier of the resource against which usage is emitted. For SaaS it's the subscriptionId.
"quantity": 5.0, // amount of emitted units as recorded by Microsoft "dimension":
"dim1", // custom dimension identifier
"effectiveStartTime": "2018-12-01T08:30:14", // time in UTC when the usage event occurred, as sent by the ISV
"planId": "plan1", // id of the plan purchased for the offer
}
For more details about sending metered usage events, see Marketplace metered billing APIs.
Verify metered usage information
On the Home page, select the Insights tile.
In the left menu, select Usage.
From the list at the top of the page, select Metered usage.
From the Offer alias list, select your offer name.
From the Meter ID list, select a dimension (meter) Id you entered in the plan. The metered usage is shown in the Metered usage widget.
Note
You should only see the metered usage above the base fee.
Download report
Note
It can take up to 48 hours before offer orders appear in the report.
In the left-nav, select Downloads.
From the Report type list, select Usage.
From the Select timeframe list, select 3 months.
Under File Extension, select CSV.
Select Generate.
Download the .CSV file and verify that the new subscription for your test plan is shown in the report.
Related content
When you complete your tests, you can do the following:
- Unsubscribe from and deactivate your test plan.
- Create a plan in your production offer with the prices you want to charge customers and publish the production offer live.