This Miro app demonstrates using usage-based billing with Salable.
- Go to the Products page and click the
Create Productbutton. - Give your product any name.
- Tick the
Paid Productcheckbox. - Select the test payment integration that is created for you on sign up. If you already have created a payment integration this can be used instead.
- Select
GBPas your currency.
- Go to the
Planstab on the sidebar and selectCreate Plan - Set the plan name as
Shapes Userand optionally provide a description. This plan will be a 'user' plan giving access to the product for a user on all boards but no other users on the team will be able to use it. - Press
Continueto configureLicense Typeinformation. - For the type of plan select
Standard. - Select
Monthfor subscription cycle. - Select
Usagelicense type. - Select
Paidto make it a paid plan. - Currencies will then appear, input the cost as
0.50which will bill a customer £0.50 for every credit they consume every month. - Continue to
Assign values. - This is section is for assigning feature values that can be used on pricing tables. This is not required to get set up.
- Click
ContinuetoCapabilities. - Create a capabilities called
circle,rectangleandtriangle. These will be used to lock features behind the license check in the demo app. - Create Plan.
- Repeat the above steps for a
Shapes Boardplan but with the changes in the next steps. This plan will be a 'board' plan allowing all users on a single board access to the product. All users on the board will contribute to the board's subscription consumption. If a user has their own subscription but is using the app on a board that is also subscribed the board usage will take priority. - Set the monthly cost as
0.50plan which will bill the customer £0.50 per credit consumed per month. - Select the existing capabilities
circle,triangleandrectangle.
- Copy the Product ID from the
General Settingstab and assign toNEXT_PUBLIC_PRODUCT_UUIDin the.envfile. - Go to
Plans. Assign theShapes UserID toNEXT_PUBLIC_SALABLE_USER_UUIDandShapes BoardID toNEXT_PUBLIC_SALABLE_BOARD_PLAN_UUID. - Go to
API Keys. - Copy the API Key that was generated on sign up and assign to
SALABLE_API_KEY. - Run
npm run dev
-
Sign in to Miro, and then create a Developer team under your user account.
- Click the Create new app button.
- On the Create new app modal, give your app a name, assign it to your Developer team, and then click Create.
- Configure the app:
- In your account profile, go to Your apps, and then select the app you just created to access its configuration page.
- On the app configuration page, go to App Credentials, and copy the app Client ID and Client secret values: you'll need to enter these values in step 4 below.
- Go to App URL and enter the following URL:
http://localhost:3000 - Go to Redirect URI for OAuth2.0, and enter the following redirect URL:
http://localhost:3000/api/redirect - Click Options.
From the drop-down menu select Use this URI for SDK authorization. - Lastly, go to Permissions, and select the following permissions:
board:readboard:writeidentity:read
- Open the
.envfile, and enter the app client ID and client secret values that you saved at the beginning of step 3 above. - Run
npm run startto start developing.
When your server is up and running:
- Go to Miro.com.
- Make sure you're in your developer team and open a board.
- To start your app, click the app icon in the app toolbar on the left.