How to combine APIM with B2C sign-up and Stripe delegation for payments?

B Campbell 26 Reputation points
2023-02-22T09:47:00.3566667+00:00

Hi, thanks in advance; this is the desired process I'm trying to achieve -

  1. New user visits our APIM portal
  2. New user clicks to sign-up for an account in APIM portal
  3. APIM directs user to the linked SignUp/SignIn user flow in Azure AD B2C tenant
  4. User completes the registration process in the B2C user flow
  5. B2C directs user to somewhere (a Stripe page?) to select a subscription level and make payment
  6. Stripe process the user payment and
  7. User is returned to APIM Portal, now signed-in and subscribed to a product.

We currently have our APIM registered in our B2C tenant as per the documentation, and the sign-up user flow kind-of works (there is an Access Denied error when you create an account but the account is created in B2C at least). We also have a Stripe service running in an app service in Azure, from an earlier prototype.

What/where do I need to configure to make this work? Am I correct in thinking that for step 5 B2C should delegate out to Stripe, or should this be handled inside B2C and then process the payment via an API connector? I've been unable to find information about using B2C authentication alongside Stripe delegation.

Azure API Management
Azure API Management
An Azure service that provides a hybrid, multi-cloud management platform for APIs.
2,462 questions
0 comments No comments
{count} votes

Accepted answer
  1. MuthuKumaranMurugaachari-MSFT 22,441 Reputation points Moderator
    2023-02-23T22:54:18.5266667+00:00

    B Campbell Thank you for posting your question in Microsoft Q&A. I assume you have followed docs: How to authorize developer accounts by using Azure Active Directory B2C to set up sign-up and sign-in flow to Developer Portal and looking for user payment and product subscription user flow.

    I think the second part can be achieved using Delegating product subscription flow and here are the steps you can follow for the set up:

    1. Set up APIM to route requests for product subscription to delegation endpoint as per steps in the doc: https://learn.microsoft.com/en-us/azure/api-management/api-management-howto-setup-delegation#set-up-api-management-to-route-requests-via-delegation-endpoint
    2. Create a delegation endpoint in your app service (let's say "apimdelegation") for managing payments as well as product subscription. This may include redirecting to another page to request billing information, process payment using Stripe service or page, and then subscribe the user to a selected product by calling Subscription - Create Api.

    The referenced docs would help in setting up the delegation and some guidelines, but you can customize your delegation endpoint based on your need. Note, the flow explained above starts when the user selects subscribe button for a product in the developer portal.

    Here is the other similar suggestion specifically for stripe payment gateway: https://github.com/microsoft/azure-api-management-monetization/blob/main/documentation/stripe-details.md

    I hope this helps with your question and feel free to add a comment for any other questions.


    If you found the answer helpful, please consider marking it as "Yes".

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.