This article takes you beyond initial Adyen or Stripe deployment and integration with API Management.
To modify the infrastructure templates, you'll run a build script to generate a new Azure Resource Manager template output for deployment.
-
Run the
build.ps1
PowerShell script at the root of the repo. -
The build script generates deployment scripts for all Azure resources required to support the demo project.
- See the deployment details for more details.
-
The build script executes the following steps:
- Installs the Bicep CLI into the
build
folder. - Transpiles the
main.bicep
template into a singlemain.json
Azure Resource Manager template in theoutput
folder.
- Installs the Bicep CLI into the
To modify the billing portal app and run the app locally:
- Install NodeJS (version 14.16.1 or later).
- Deploy an instance of the API Management infrastructure, following the instructions in either:
- Deploy with Stripe, or
- Deploy with Adyen documents).
- Make a copy of
.env.sample
in/app
, rename to.env
, and fill in the variables as per your environment. - Use a tunneling app such as ngrok to create a public URL forwarding port 8080. If using ngrok:
- Download ngrok.
- Unzip the executable.
- From the command line, run the ngrok executable to start an HTTP tunnel, using port 8080:
./ngrok http 8080
. - Continue with the following steps, replacing
<public-forwarded-url>
with the output URL (for example, https://<unique-value>.ngrok.io).
- Update the API Management delegation URL via the Azure portal to point to
<public-forwarded-url>/apim-delegation
.- For Stripe, update the Stripe webhook endpoint URL to
<public-forwarded-url>/webhook/stripe
. - For Adyen, update the allowed origins to include
<public-forwarded-url>
.
- For Stripe, update the Stripe webhook endpoint URL to
- Run
npm run dev
from the/app
folder to start the app. - If you're running from VS Code, enable debugging by:
- Opening the command palette.
- Selecting Debug: Toggle Auto Attach.
- Setting to Smart.
If you make code changes to the custom billing portal app, you will need to:
- Re-build the docker image from
app/Dockerfile
. - Publish the docker image to a publicly accessible container registry.
- When deploying, set the value of the
appServiceContainerImage
parameter to the URL for your published container image.