Set up online payment for events

Applies to Dynamics 365 for Customer Engagement apps version 9.x

If you have one or more events where contacts must purchase a pass, then your contacts will probably appreciate being able to pay for their passes online while they are registering for the event on your event website.

To enable online payment, you must make an agreement with a third-party payment provider who can authenticate and capture payment details. Your payment provider will supply you with details about how to implement their system, which you'll usually do by adding code supplied by your provider to a web page running on your event website. You'll typically also need to tell your provider the URL to request from Dynamics 365 for Marketing to indicate a successful payment.

Once your new payment gateway is in place on your event website, you can configure your various events to use it, or assign it as the default for all new events.

The procedure for building and enabling a payment gateway depends on how you host your event website:

Create a payment gateway when hosting on the Dynamics 365 portal

Add a new payment gateway to your event website

To add a new payment page to your event website:

  1. Make an agreement with a third-party payment provider and prepare a web page that provides a payment front end, as described in their documentation.

  2. Sign in to Dynamics 365 and go to the custom app by choosing Dynamics 365—custom from the app selector.

    The app-selector menu

  3. In the custom app, use the horizontal navigator at the top of the page to open Portals > Content > Web Templates.

    Go to your web templates

  4. Select + New on the control bar to create a new web template.

  5. Enter a Name for your template and set the Website to the Event Portal. Then paste the web-page code you developed for the gateway into the Source field.

    An example web template setup

  6. Save your template by selecting the Save button at the bottom-right corner of the window.

  7. Go to Portals > Website > Page Template and select + New on the command bar to create a new page template.

    An example page template setup

    Make the following settings:

    • Name: Enter a name for your page template.
    • Website: Select the Event Portal.
    • Type: Set to Web Template.
    • Web Template: Select the web template that you created earlier in this procedure.
  8. Save your page template.

  9. Go to Portals > Content > Web Pages and select + New on the command bar to create a new web page.

    An example web page setup

    Make the following settings:

    • Name: Enter a name for your web page.
    • Website: Select the Event Portal.
    • Parent Page: Select Home.
    • Partial URL: Enter a folder name that you want to show in the URL path for this page. This text must form part of a valid URL, so use only letters, numbers, hyphens, and underscores (avoid spaces, special characters, invalid URL characters, and slashes). This value becomes part of the page URL using the following pattern: https://<YourPortalDomain>/<PartialURL>/.
    • Page Template: Select the page template that you created earlier in this procedure.
    • Publishing State: Set to Published.
  10. Save your page. Your new payment gateway is now available to your event website.

Set the payment gateway for an event

To assign a payment gateway to an event:

  1. In the Marketing app, go to Events > Event > Events to open the events list.

  2. Find and open an existing event or create a new one.

  3. On the General tab of the Event form, scroll down to the Website section and select your payment gateway page in the Portal payment gateway field.

    The portal payment gateway setting

  4. Restart your portal or refresh its server cache to make sure your new setting takes effect right away. For instructions, see How can I fix occasional portal issues?.

Note

The payment gateway is only displayed for events that have at least one event pass configured for them. More information: Set up event passes

Receive payment confirmation

When a contact selects the checkout button, Dynamics 365 for Marketing creates a temporary event registration, associates it with the current browser session, and then opens a page that links or redirects to your payment provider. The system then waits for the payment provider to confirm the payment by redirecting the contact to the success URL. When that request is received, the system converts the temporary registration into an actual registration that users can see in the system.

When you sign up with a payment provider, they will ask you for the success URL, which will be embedded into the code they send back to you to include on your payment gateway. The URL you should use looks like this:

https://<portal-domain>/event/successpayment?id=<Readable_Event_ID>

Where:

  • <portal-domain> is the domain name for your portal. You can see it by opening the event website.
  • <Readable_Event_ID> is a value that uniquely identifies the event. To find it, open the relevant event record, go to the General tab, scroll to the Website section, and copy the value shown in the Readable event ID field.

If you hard code the event ID in the confirmation URL, then you'll need a different payment gateway for each event. We recommend that you instead set up a dynamic expression, which you can script as follows in your web template:

'https://<portal-domain>/event/successpayment?id='{{ request.params['event']}};

You'll probably need to edit the script returned by your payment provider to correctly create this line of code in your web template.

Note

This script example is specific to the Dynamics 365 for Customer Engagement portal. It won't work if you use directly within a customized Angular site, including if you are hosting the event website externally.

Create a payment gateway when hosting on an external site

If you are hosting the event website on your own web server, then you must download and customize the event website to include the payment option as needed. Your payment provider will give you the instructions you need to interact with their system.

When a contact selects the checkout button, Dynamics 365 for Marketing creates a temporary event registration, associates it with the current browser session, and then opens a page that links or redirects to your payment provider. The system then waits for the payment provider to confirm the payment by redirecting the contact to the success URL. When that request is received, the system converts the temporary registration into an actual registration that users can see in the system.

When you sign up with a payment provider, they will ask you for the success URL, which will be embedded into the code they send back to you to include on your payment gateway. The URL you should use looks like this:

https://<domainAndPath>/event/successpayment?id=<Readable_Event_ID>

Where:

  • <domainAndPath> is the location where you installed the event website on your portal or external site. You can see it by opening the website.
  • <Readable_Event_ID> is a value that uniquely identifies the event. To find it, open the relevant event record, go to the General tab, scroll to the Website section, and copy the value shown in the Readable event ID field.

The readable event ID is different for each event, so you should customize your site to add this dynamically to the URL to reflect the event being registered for.

When you are hosting on an external site, the Payment gateway and Allow anonymous registration settings for the event record have no effect. You can implement these preferences by customizing the site directly.

For more information about how to download the latest version of the event website, customize it, build it, and then deploy it on a Dynamics 365 for Customer Engagement portal or external website, see Build and host a custom event website.