Self Monetization Dynamics 365 Business Central Apps
Hello. And welcome, to this video and, which, I will talk about the self monetization, options, for. Microsoft, Dynamics 365. Business, central I want. To take this opportunity to thank two people the, first person is John Kauffman who developed, the objects, that I will show you in this video and he is also written a white paper about this topic but. The white paper and the objects are available in the dynamics learning portal the. Second person is valtor's, for helping me put this presentation together, and, get the demos running for me my. Name is Daniel Ramos Hwan and I am a partner with cloud ready software one of the highest fee development, centers who can help you with just about anything, related to. Microsoft. Dynamics, 365. Business, central. You. Have three objectives for, this video. First. I will go over some monetization, options that, you can implement in your app there, are many different ways in which you can monetize your app and, what I will show you are just a few of them you. Have complete control over how, you want to monetize, and Microsoft, does not dictate how this happens at this point in time to. Be. Able to monetize, your app you need to use a payment, provider and we have picked one that we found relatively, straightforward. To use and, then. Finally, I will show you around the monetization app that we at CRS have developed, for Microsoft, to provide to the community, the. Optics for this app have been made available through, DLP, and you can use them as a template, for how you want, to monetize, your app you. Have a lot to cover so let's get started. The. First section, is the. Section. About monetization, options. Currently. App source does not provide, any monetization. For business central apps so. You will need to decide how you want your customers, to pay for it and it is up to you to include monetization. As part of your app as, I've mentioned before Microsoft. Does not dictate how you monetize your app it is completely up to you there are several ways to monetize, your app and these, are some of the most common, ways, the. License key option, is one where, the customer has a certain. Period in which they can try out to have after. That period the a blocks some, or all of the features until. The end user enters, a license key this, license, key could be sold offline, which, brings in a manual process to, sell the key and also to process, payments outside, the system because. A license, key is usually, not used for subscription, billing this is not likely to be a popular, choice for apps or saps if. You. Choose to use a registration. Process, you will need to provide for an integration, between the app and a registration, server. This. Registration, server keeps track of registrations. And app usage, so. It should have capabilities. To check if the customer, is authorized, to use the app the. Registration, page will also have capabilities. To process payments in addition. To including monetization. Into your app you, would also need to provide the registration. Server in the, form of a website or some sort of web service. Integration. With a payment provider is a variation, of the registration, server there.
Are Payment, providers, out there that actually provide, the ability to keep track of registrations. And payments, in, exchange for a percentage of the registration, charge. The. Process, for unlocking, the app with a license, key could work like this the. Customer installs, your app and gets a 30-day trial automatically. After. These 30 days the. App locks its features and requires, a license, key to unlock, those features, the. Customer can then retrieve a license, key by means of a manual and offline invoice process, or a self. Hosted website. Because. Of the manual, and offline processing, this option, would probably, not work for high-volume, apps that are expected to be downloaded, by many customers, a. Registration. Page can, be used to create your own registration. And payment process. There. Are many scenarios possible. But they all involve, a integration. Between the app and the registration, server to, check if the customer is entitled to use the application, plus, some functionality. In your app to, lock features, if that is not the case. This, way of doing it yourself requires. Investment, in creating and hosting, a web server, that keeps track of registrations. Payments. And usage. Integration. With a payment provider, is a variant, of the registration, page but, the main difference is that you use a payment, provider to keep track of registrations. And payments, you. Can focus on the product rather than having to think about technologies. That are probably new to you a payment. Provider is a trusted, third party and they will be responsible for keeping customer records safe including. Credit, card data. This. Video describes, the demo integration. With payment, provider stripe, this, is not an endorsement of this particular, payment provider but, we picked it because they have an easy-to-use API, there. Are many other payment, providers, as well if, you feel that others might be the better option then. This demo app can serve as an example of how to integrate, with a payment provider in general. Before. We dive into the payment provider there is one thing we need to consider which, calculation. Model do, you choose and we have several, freemium. Means that the app offers, limited features, for free and to get the more enhanced. Features the customer needs to pay for it. Purchase. Means that the customer pays a one-time. Fee for the app and then, they can use it indefinitely a, subscription.
Is A price per certain period, for instance a month or a year the. Price could be pertinent per company or per user. Usage. Means that, the price is calculated, based on usage, of the app for. Example the number of inserted. Entries, or calls to a back-end service. And then, finally, a trial, is all, of the above calculation models. Can be combined, with a trial period in which the customer can try out the app without. Paying for it. Ideally. During, this trial period all features of the app are available, and after, the trial period has expired the customer, needs to start paying for the app. In this, video we will describe the flow of one of the most common, calculation. Models a trial. Period of 30 days followed. By a monthly, subscription of, a price per company other. Calculation. Models can be easily adapted in combination, with stripe. As. Mentioned before we at cloud ready software, have, developed, a sample, app for Microsoft, that they are sharing with the community to serve as a template, for how you can include monetization. In your app this. Section shows you some details for stripe which. Is the payment provider, that we selected for this sample app, we. Selected, this particular one for two reasons, first they. Have a very clear and easy to use API, so, it was straightforward to, develop, the communication, pieces, to stripe from. Business central. Second. They provide for some subscription, models that we could use as a template, for monetization, our. Approach was not so much to find the payment provider, that matches, our idea. Of what our subscription, should look, like but. Rather we took the existing, offerings in the stripe dashboard, I made the sample, app work accordingly, I want. To make clear and reiterate, that we are not endorsing this, particular, payment provider in. Your decision, of which payment provider to use you will obviously search, for one that matches what you will want to do in your app.
So. What is stripe stripe. Is an online payment provider. That. Works in any country, in the world they. Can work with 125. Plus, different currencies, and they. Accept all major debit, and credit cards, on. Top of that they support, a number of other payment, methods for. More information, about what stripe can do please. Visit their website and, read all about it they are very clear it's a very good website with lots of good information. Anyone. Involved with, the processing, transmission. Or storage of, card data must. Comply with the data security standards, of the payment card industry also. Known as PCI. DSS. So. PCI stands for payment card industry. Stripe. Has been audited, by an independent, PCI qualified, security, Assessor and they, are certified, as a PCI, level one service, provider which, is the most stringent, level of certification, that is, available in the payment industry. PCI. Compliance. Is a shared. Responsibility, and applies to both the, payment provider and your business when. Accepting payments, you must do so in a PCI, compliant. Manner the. Simplest way to be PCI compliant. Is to never see or have, access to card data at all stripe. Makes it easy as they can do the heavy lifting to protect your customers card, information you. Can simplify, your PCI, compliance. As long as you Lou use the stripe libraries, to collect payment information and review. And validate our, PCI, compliance. Annually. It. Is your responsibility to, be aware of the requirements. To be compliant, at any given level the. Stripe Jas, and the elements library, that stripe provides, allows. You to be eligible for the simplest, method, of PCI validation. Which, is called saq, a. Stripe. Automatically. Creates a combined, si QA and at the station of compliance, for you available. For you to download in your accounts, compliance, settings and no action, is required on, your part to submit further proof of your PCI, compliance. But. It is important, to note that it's, your responsibility to be compliant, and to do the research to make. Sure that you can take the steps in order to be compliant. So. If you want to read more about the security, go. To the security. Documentation. On the stripe website, and. Make sure that you meet all the right requirements. One. Of the most important, benefits of stripe is, that they can automatically, handle payments of subscriptions. It, is possible, to set monthly yearly. Or custom, payment periods, and the, amount can be based on a fixed amount per user, or even on usage, you. Can set up the details for your subscriptions. Including, the payment points, in stripe. Takes care of the actual payments, as was the communication, to the end-user so, your user goes into the stripe, account. They. Provide their credit. Card information and, stripe. Will take care of getting. The money out of the credit, card on the monthly basis based on subscription, details. That you've set. For, the payment plan. The. Stripe dashboard, can, be open through this website. Where. There's a couple of important, parts. One, is the customers. Customers. Are created, from the app so, when the demo app is installed it creates a new customer, record in the stripe system, one. That represents the company in the, business central. Tenant, someone. Will need to pay the bill by entering, their company's, credit card information and, the new customer, appears under the customer tab in the menu inside. The stripe dashboard. Products. Are visible, under the billing menu. Each. Product, can have one or more price plans a plan, can be set up with an automatic trial, period, for, our demo, app we also add, an attribute called level, to help decide which product, to choose. Subscriptions. Can be found under, the billing one menu as well a subscription. Is the combination, of a customer, in a plan and based. On the settings of the plan the stripe will automatically, charge the credit card of the customer, and based on how these payments, go a subscription. Can have different states the possible, values are trialing. Active. Past due canceled, and unpaid. To. Read more about the different states. And. How stripe handles, these refer, to the page on the, billing lifecycle. The demo app sends a notification to, the user based. On those states. So. Stripe provides, the rest based. Web. Service, that, gives access to all resources. With, this API it is possible, to manage customers. Products. Plans and subscription. The. Full documentation, of the API can be found here, the. Example, that we are going to talk about uses. This API to create customers. To. Read products, and plans and to, create a new subscription, and read the subscription, state so. To access the stripe website an API key is needed you, can find the API keys, under the developers, menu, and then, you, can see reveal the test key token to get an API key, that can be used for testing so.
There Are two tokens as I'll show you in just a minute. Let's. Switch, over to the stripe. Dashboard. So. That's what you're looking at now this, is a stripe dashboard, for a cloud ready software, and this, is all the information that you'll see in our test. Account. Under, the billing, menu. You. Can see the products, and in the products we have the two products, that we. Have created for our test app so one is the standard. Subscription. And one is the premium, subscription. The, difference between the two is obviously the price per month and another. Difference is the metadata, tag, called level, which, is set standard, for the standard app and that. Is set to premium. For, the premium app so, when I click on the pricing, plan you, can see the details in there there's, a recurring usage, in u.s. dollars intervals, monthly, the, price per unit is $19.99. That's. For the premium app for. The standard, app we. Have a price of. $9.99. Per. Month, the. Next you'll see is the. Subscriptions. The. Subscriptions. Is a. Record. That is a combination of, a. Customer. Record and a product, record and so, this guy was created, yesterday June, 2nd. It's June 3rd when I'm recording, this video and. So yesterday I prepared, my environment, I published. The app in my test, container, and inside, that container when that installs, it, creates, the customer. Record, in stripe and it also creates, subscription. Based. On the, standard. The standard product so, the subscription. This. Guy was, created yesterday it's, that customer, that was created, yesterday as part of the installation, code. Unit of the app it, sets, a, paid. Flag. On this subscription, which. Means it is in the state trialing, so you can see here the, state. Of the subscription right now is trialing. That, means that we are still in the trial period for the. Standard, product so when we go into the, product. Itself, that's the pricing, plan if, we go into the pricing the, product itself, we. Go into the pricing plan. It. Says it has a 30 day trial. Period so. When, I go back into the app as I'll show you in a few minutes you'll, see that, we get a notification on, the roll center that says you're, still in the trial period you have 90 or, 29. Days left on that. And then, I'll, show you the functionality, from there but you know this is to show you the subscription. And. Dashboard. In stripe the. Other part that was important, is the. Developer. Menu where. You can see the API key so we have two keys one is a publishable key one is a secret key the secret key is part of our development as, part of the. Objects. So. For your testing, you would have to create a, test account in stripe. Generate. The API keys and replace, those API keys in, your app. Objects. And, make sure that it all works for. Your test, account. The. Final section and probably, the one that you've. Started. The city of for is I'm. Going to walk you through the. Monetization, example. App. From. A to Z so, let's. Get started about the, example. App there. Are two parts. First, is the hello world part, which. Is very. Similar to the. Little. Bit of expense of an expanded, version, of the hell world app, that, came out when Microsoft, first came out with Al, github.
Repo, So. We've done, some additional stuff, with that so, that's one part of the app and, second. Is the integration, with stripe so the integration with stripe as a number of pieces of functionality and I'll explain most, of them in this video. This, is the link the direct link to the, objects. Which. Is part of the course materials, in the Dynamics, learning, portal. They've. Also provided with an alias URL, for the. Ready to go library. So. If that direct, link doesn't work you. Should be able to go to the online learning library, directly, and then, the demo app should be one, of the items in that list so if they ever decide to move the ready-to-go library, to a different location, that, first link might not work anymore. The. Hello world app adds, an action, called say hello world to. Four. Pages one, is the customer lists one is the customer card then. Also the vendor list and the vendor card and the, app contains, a list of hello world phrases. In different languages, the. Default list can be found in the code in at 500 109. HW. Install, and the, action on the pages will display, a random, random. Translation. Including, the customer name or the. Vendor, name. So let me show, you what that looks like real quick. This. Is the home page for business, central, this is the role. Center and as you can see there. Are two notifications if, I drill down drop. These down I have, one notification, that says thank you for trying out the hello world app your. Trial period expires. In 29. Days do you want to get a subscription with. An action by subscription, I'm going to ignore that message, for now we'll. Get to that later first, of all I want to show you the, customer. List, in here. Under a customer, there is an additional action, that says say, hello and when you click this. You, get. Language. And I think this is Danish I think. Let's. Do it again say. Hello world, hallo. V Holt that's Dutch I. Know. That and so, if I drill, down into the customer card. The. Customer, card itself, also has the hello world. Action. And. So. That works that's part of the standard app, the. Standard level of the app if, I go to the vendor list. That. Same, action, is on the vendor. Menu. But when I click it I am, getting a notification. That says you need a premium, subscription, subscription. For this feature do. You want to upgrade with. An action, for buying the subscription, so this, is an example of how the. App monetization, checks. The level, of your. Subscription. And. Then. Decides, on. Whether. This action can be executed or not so we have disabled, the hello world. Functionality. From the vendor list and the vendor card, in. Case it's not, premium. Let. Me show you the, objects, themselves, so. In here, in code unit 501. Oh nine that's, the install, code unit that. Creates, the, records. Into, a table there's a bunch of tables. Over here the hello world table and that, creates that so the installation, code. Unit sets. Up the app data. It. Puts the actions together and then, based. On the. Functionality. In the. Pages. So we have some page extension more for the customer card extension, say, hello world the, vendor card say hello world it, all. Goes. To, the, same spot right. So, that's the page extension, you also have cable extensions, so. The table extension, has a. Say. Hello world. Method procedure, and. We also have, the same in, the. Vendor. Table right so the customer table has an extension the, vendor table has an extension and those, all say hello. World, and, then, that's, been set up in such a way that the. Monetization, itself. Can. Subscribe. To some of those events so if you look at, the. Objects. Themselves you'll. See that there's an action, and there's an on before action, the. Stripe. Communication. Goes in subscribes. To those on before actions. And sets, the handle pattern, and. That, bypasses. The functionality, if the, subscription, level is high enough and so I'll. Walk you through that in a minute. Back. In the presentation. So. Like I said when, using the functionality, the app checks. If the user is properly licensed, this is done by checking the subscription, status so, the status of the subscription, we've seen that in the dashboard, first of all it's trialing, then, you set it to. Paid. And. That sort of thing so that goes to the, status of the status, of the subscription itself, and then. In addition to the status, of the subscription, there is a level. That belongs, to both of those products, that the say HelloWorld functionality. On the customer, page are, considered, to be standard, and for. The vendor page they are considered, to be premium, so, part.
Of That functionality, is first. Of all when the role Center opens, it checks the status of the subscription itself, to, see if you're still valid, if your subscription, still works and then, based, on whether that action is called from the. Customer. Or the vendor it then checks. The level, of the. Subscription. To see if it's either standard, or premium and, in, both cases the. Actions, are designed. In such a way to use the handle pattern and based, on the handled pattern you can disable, the. Actual. Action, too by subscribing, to an on before, action. In, that. Functionality. And, then if the, level, of your subscription, is not high enough you. Can set the handle pattern to true and that bypass. Is the actual functionality, because, it, exits, the, function, if handled equals, true and so I'll walk through that in. A minute. So. The application, flow consists. Of several steps, first. We have installation. Now. We have a refreshing, of the data creating. A trial subscription. And then, checking. The status one opening, the role center and checking. The status when using the features. It. Creates, a subscription. When it's installed, and overall the process is to automatically, create the trial subscription. When. The app is installed without. Asking. The customer, any questions, so you might decide to do that differently, the, way that we've implemented, the sample app is to just create the customer, and to just create the subscription, the, duration of the trial subscription. Can also be set in the plan settings, of the product itself and I. Believe, I'm, not sure but. It, should be possible to, extend. The, trial, period, for individual. Subscriptions, as well so it's, a standard, that setup and stripe but. You can extend that for individual, cases I'm not sure that, might not be a feature so, check. To, see if that's something that you need to. Show the difference between the standard and the premium, level the demo app creates, a trial for the standard, app so and it first creates, it sets. The, subscription. To. The. Standard app and. Of course this is the premium, app and leaf real-life, scenario. Because. You want to maximize your earning, potential so, of course you.
Want To get started with a trial and then you, know do. It like that but. You. Know you have to decide how, that flow works for our sample app we, decided to start out with a standard, with. A 30-day, trial and then, you can implement. Premium. Features, by, entering. Your credit card information. So. There are two. Install, code units in the app go. To unit 50,000, 109. Is the, hello, world install. Code. Unit 50,000. 149. Is the stripe install, code. In 850 thousand 109, initializes. The table, with hello world phrases. In the different languages and code. Unit 149. Calls. The function or a fresh data on the table stripe setup, and. You. Know, what. Is all, involved. In that. This. Is the. 50,000. 109, which is the hello world install, app that. Creates the records. In the different languages then. We also have code in 50,000. 149. Which. Is also, a install. Code, unit and that, goes into Skype. Stripe, setup. Refresh. Data so we have a stripe setup table. And the, table has a, function. To refresh, the data and if we go to the definition of that data we, have a. Method. In the table that then calls the refresh data, function. Of code in 50,000. 148. The. Refresh procedure, first. Checks, if the data has been refreshed within, the last 24 hours, if. That's the case no refresh will be done this is to reduce the. Number of outgoing, web service, calls so, theoretically this, only happens, once. Every day that's, that's. That. When. The data needs to be refreshed the procedures, reads actual, products, and plans that are defined, in the Striped dashboards. So. If we go into the stripe product, which is a table that we've created there's. A function, for get products, and that, reads the products, from the, dashboard. On stripe, the, same with the plans, those, are the. Plans. That belong, to those products, and. So, next. It checks the subscription. Table, if there is a subscription. Record available and if, the subscription, record is available it refreshes, the data of a subscription. To, get the actual status from. The stri stripe dashboard. Into, business, central and if no rush subscription. Could be found then, a function is called to automatically, create a trial, subscription. In. That plan and so this is part of the. Installation. Normally, when, that subscription, has been taken care of when that's created, in the stripe dashboard, that subscription. Just, stays. There and that's the main record. The. Function. To, create a trial subscription. Is implemented. In code unit 144. Stripe. Great trial subscription. Method this function, first creates, a trial customer, this, is a process, that takes the data from the company information table and creates. A new customer, record in the stripe dashboard. Then. It finds, the first product, sorted. By the field level with. This medic method, automatically. The lowest level is being used in.
A Real life scenario, you. Would adjust this, process. To, meet the requirement, that you have so if your requirement is you start out with a standard, of, course you get the first record. If your, requirement is syste to start with a premium level you, find the last record and, of course let, me just, quickly. Roll, through the code here. But. You, will probably already have downloaded, app. Objects. Yourself so you can browse, around at will. One. Thing I want to point out is that this demo uses, a custom field on the product in the stripe dashboard, to, determine, the level so remember that metadata, tag called, level, it's. Perfectly, possible to have only one product for your app without any level, and after, the product has been found the process continues, to find a plane with a trial period and finally, it creates a subscription, for this and, for that plane as a, result, the customer has a subscription, that, entitles, him to use the app for 30 days before. Having to pay for it and after, those 30 days stripe, will automatically. Create an invoice and try to charge the credit card for the customer, as long. As the customer has no credit, card information entered. This will fail the. State of the subscription, will then become past, due an app, can then react to this state by sending, a notification to. The, user so, you have control over that if the customer doesn't. Enter, their credit card information you. Can decide to either. Disable. The app altogether, or to bribe to, provide a grace period you. Can react to the state of the subscription, when. You're in there. Checking. The status. Happens. When the roll center is opened, let. Me show you the code in there, as well. In. Code unit 50000. 103. Which is called stripe integration. We. Have an event subscriber. That, is subscribed, to the application. Management code units on roll center open, event which. In turn calls the on check. Subscription. Status event. Which, is an integration, event. That we've created in, this code, unit itself. So. The on check, subscription. Status event. Is raised, as. A. Result. Of subscribing. To, the on roll Center open, event, in application. Management, and so this, is an example of how we've decoupled, that, functionality. Between. The two so we have a separate, code unit that reacts to those events and then we raise another event, and then, the actual functionality, lives, in a different object. That. Object is this stripe check subscription, status code, unit and. This. Code unit subscribes. To the stripe, integration. Code, units on check subscription. Status. Event, and, does. The actual. Check inside, of this, code. Unit so this is the actual, code. It goes again into the fresh data it, gets, the next the, first stripe subscription. Record, and then, it goes and checks you, know what's going to happen as a result of the status of that subscription. Then. Based on the status, the code unit raises, different events, and then the code unit.