Using Stripe as a payment gateway for Dynamics 365 Marketing

Recently, I had a customer requirement to use Stripe for processing event registration payments. I knew that with Dynamics 365 Marketing, you have the ability to use a custom gateway but not much documentation was available on the different implementation options or designs. Some good reading though for an overview of custom gateway options can be found here.

What we ended up doing as a high-level solution is as below:

  • Deployed 2 Azure functions that are triggered on http. The first function is what is called when the attendee attempts to register. It validates and extracts the registration details and then creates a payments session based on the Stripe key provided. It returns a payment session, from which our payment gateway page, can redirect the customer to the actual payment page in Stripe. ( The other function is to finalise the registration once payment is complete. This is done as a webhook within Stripe)
  • Create a custom payment web page as described in the Microsoft docs link above. We added the Stripe checkout reference script. This allows us to redirect to the actual payment page once we have the token generated.
  • Within the event record itself in Dynamics, we set the payment gateway to the page we created above:
  • We then created passes for the event....and that was it!

So this was the flow of the registration. The attendee populates their details, chooses the pass and clicks on checkout:

Our payment gateway page loads up and makes the call to the Azure function whilst it displays a 'Processing' page

After a short while, they are redirected to the Stripe payment page

Now whats really AWESOME about this Stripe payment gateway is that on mobile, the user can use their existing Wallet functionality to pay for the event! This creates a friction-less and enhanced end-user experience

Once the attendee completes the payment, they are redirected to the Registration success page:

Whilst back in Dynamics, the event registration record is created as our second Azure function, we setup as a webhook in Stripe, has been triggered:

It was both exciting and frustrating working out the Dynamics 365 Marketing specific API around events registration and the finalisation of the event registration. Overall though we were all very happy with the outcome and our customer can now take full ownership of their events, pricing and payments! One less platform and widget they have to use :)