Monetize APIs with Azure API Management Using Adyen
Tutorial
If you've already watched our tech briefing unlocking digital transformation using Azure API Management and you've run our API Maturity assessment for your organization, your next big problem to solve is how to monetize your APIs.
In this tutorial, we walk you through this demo project, where the example revenue model defined in the monetization overview (Free, Developer, PAYG, Basic, Standard, Pro, Enterprise) has been implemented to demonstrate integrating Azure API Management with Adyen. This demo enables API consumers to browse, select, and subscribe to products via the developer portal.
We have provided detailed technical implementation about the overall architecture and payment flow, as well as a step-by-step deployment guide, including the Adyen developer portal.
Transcript
This short walkthrough video will describe the process of deploying and configuring the demo solution for integrating Azure API management with the Adyen payment gateway. Before you get started, you'll need the following an Adyen account, preferably a test account. If you're still evaluating this process an Azure subscription with permission to deploy resources and create service principles, PowerShell, and the Azure CLI in order to run the necessary command line scripts. The supporting artifacts for this walkthrough are available in GitHub.
In the Azure API management monetization repository under the Microsoft organization, you'll also need to clone or download the repository artifacts. The process that will be following in this video is documented in the deployed demo with Adyen markdown file, which is referenced in the main readme document in the repository.
It's a good idea to have the associated documentation for the setup process to hand so that you can copy and paste the necessary commands that are shown in the video. As we go through the later steps, we'll start by logging into our Adyen account. And if you don't have one already creating a merchant account for an eCommerce channel. We'll come back to this account later in the setup process, the next stage is to create a service principle, which will act as a privileged credential that our web application will use to talk to API management. We're going to use the Azure CLI inside PowerShell. And the first thing we need to do is to connect our Azure subscription, using the AZ login command.
If you have access to multiple subscriptions, then you can set the subscription context using the AZ account set command, passing in the relevant subscription ID. We can now create the new service principle. This command will return some sensitive information that will need to temporarily copy and store for later. Use.
Now we want to visit the demo solution repository on GitHub. The main readme file contains a link to the deployed demo with add end documentation, which are the set of instructions that we're following in this video about halfway down the page is a deployed to Azure button. Clicking this button will initiate the process of capturing all of the parameters that we need to provide to this deployment script, to deploy the resources we'll need to pick the subscription, the resource group, and the region that we want to deploy into
we'll then need to set the resource name for the API management service that we're going to deploy. We'll need to provide an email address for net administrator for the API management service and a name for our company publishing the API, which will appear in places like the publisher portal we'll need to set, which skew for API management.
We want to provision and then provide a name and skew details for the app service that hosts our demo solution. Finally, we'll need to configure the payment provider details. Firstly, that we're using Adyen as our payment gateway. And then we need to head back to the Adyen portal under the developer tab, in order to generate an API key for the web service.
We'll also need the client's key value and the merchant account name.
We now need to achieve a few ID values from our service principle that we've created earlier. Some of which we stored for later use using the AZ ad SP show command in the Azure CLI we could obtain the service principle's app ID object ID and the app owner tenant ID. These can all be added to the deployment parameters, along with the client secret password that was returned when the service principle was created. At this point, we can now review and trigger the deployment.
As your API management typically takes about half an hour to deploy, and we'll see an email at the administrator address. It was provided earlier when it's complete. Once a web application has been deployed. We need to add its URL to the list of allowed origins for our merchant account web service. This is the URL of the app service that was deployed as part of the demo solution.
The next stage is to publish the developer portal for API management. We can do that by going to the API management resource in Azure and selecting the developer portal option under the operations menu. There's an option to publish the website and that takes a few seconds to complete.
The final thing we're going to do is go through the developer experience of signing up to use our API. We're using an anonymous browsing session here to simulate a different person, connecting to the public facing API management developer portal. We're going to sign up the developer as a new user, providing a name, email address, and a strong password.
Once they've signed up, they're now logged into the developer portal and they can review or browse the products that are available to subscribe to the basic product. They just need to agree to the terms of use and select subscribe. They need to provide a unique name for the subscription. And this is because there might be multiple subscriptions for the same product for different use cases.
Once they provided that name, they're automatically directed to the Adyen payment portal where they can provide credit card details. Adyen provides dummy card details, which can be used for testing purposes.
Once the payment has been authorized, they're redirected back to the API management developer portal. And if they look at their profile, they can see, they now have an active subscription to the basic product, which gives them access to the API key. This is a key, they were used to authenticate against our API. And if we switch back to the Adyen dashboard, we can see the details of the transaction that was authorized.
That's the end of this walkthrough for more details and other supporting documentation, including a similar demo solution with a striped payment provider, please refer back to the associated repository. Thank you.