Real-time financial transactions with Fidel and Webhooks
Tags: developers, blogs
Published: 2020-05-08 04:46:10

---
title: Real-time financial transactions with Fidel and Webhooks
published: true
date: 2020-05-04 07:06:08 UTC
tags: Developers,Blogs
canonical_url: http://blog.fidel.uk/real-time-financial-transactions-with-fidel-and-webhooks-2/
---

![Real-time financial transactions with Fidel and Webhooks](http://blog.fidel.uk/content/images/2020/05/DevRelations02_article-2.png)

<!--kg-card-end: image--> ![Real-time financial transactions with Fidel and Webhooks](http://blog.fidel.uk/content/images/2020/05/DevRelations02_feed.png)

Fidel makes it easy to innovate with financial transaction data. It works like this: we’re integrated with the card networks (Visa, Mastercard and Amex). You enrol your customers’ cards to your programs. When a transaction is made with an enrolled card, we spot it in real-time, and pass the transaction info to you. All of the compliance and security is handled on our end, so it’s super easy for you to start to innovate with the data.

One of the best things about the data is that it arrives in real-time. We securely tokenize the data before we send it to you, so all you have to do is pair the unique userId to your customer database. Then, you can see all your customers’ transactions in the Fidel dashboard as you refresh the page.

But no one wants to sit on a webpage and hit refresh to see results. What you want is to  receive this data in your infrastructure, so you can send your customer a text to say “thanks for joining”, or “thanks your purchase, you’ve just earned 10 loyalty points.”

The way to get notified in real-time about your users’ transactions is through the use of webhooks.  

### What are webhooks?

Refreshing the page over and over is polling for data - you have to make a request for the data.  Webhooks push the data to notify your server as soon as an event occurs (just like your email and WhatsApp messages get pushed to your phone in real-time).  
  
Let’s set up an example Fidel program and establish two webhooks: when a new card is linked, and when a linked card makes a transaction.

### Web SDK setup

The [Fidel WebSDK](https://docs.fidel.uk/web-sdk) is used to enrol cards into your program.  It’s pretty easy to set up.  Just copy the code from the \*index.html\* into your webpage to build the Fidel dialogue. There are 3 required fields:

data-company-name="Your company"

data-key="pk\_test\_demo"

data-program-id="bca59bd9-171b-4d1f-92af-4b2b7305268a"

All the other fields can be modified as desired (to change colours, links and images). Here is a sample implementation, hosted on Glitch:

<!--kg-card-begin: html-->
<iframe src="https://glitch.com/embed/#!/embed/luminous-fire-opera?path=views/index.html&amp;previewSize=100" title="luminous-fire-opera on Glitch" allow="geolocation; microphone; camera; midi; vr; encrypted-media" style="height: 100%; width: 100%; border: 0;">
		  </iframe>
<!--kg-card-end: html-->

This implementation is in the test environment, so feel free to use any of the Fidel test card numbers (4444 0000 0000 4XXX for Visa,  5555 0000 0000 5XXX for Mastercard, or 3400 0000 0000 3XX for Amex), and add them to the service.  

Once you add a card, you can make a transaction to the program. It's all test money, so go right ahead!

### Where are the transactions reported?

Now we have added a card and completed a transaction. Fidel has recorded it, and you can view the transaction in your dashboard. But we want to create the webhooks to immediately report this data. To establish a webhook, you can use the dashboard at:

[https://dashboard.fidel.uk/webhooks](https://dashboard.fidel.uk/webhooks),

or use our API:

[https://reference.fidel.uk/reference#create-webhook-program](https://reference.fidel.uk/reference#create-webhook-program)

and add a webhook. You’ll need the Program (or programId), the event you want to track, and the endpoint where the data will be reported.

In this case, we’ll create two webhooks: for card enrolment and for transaction authorisation.

<!--kg-card-begin: image-->

![Real-time financial transactions with Fidel and Webhooks](https://lh4.googleusercontent.com/gfyHVQX-rlf4ox1juohcKbHfC3u4NHH8gLSO4Kkf3ekFiivn4fUvvGZYavydCaQOxn86b5b-TBbaEkrodSIATWK5PsvLFi9ww0oiRNxDr_eXrhgcQg3oicL4nMzw4KNhRiOpe_pA)

<!--kg-card-end: image-->

The URL that these are posting to is another Glitch demo. The demo receives the webhook, and posts some processed results on the website:

<!--kg-card-begin: html--><!-- Copy and Paste Me -->
<iframe src="https://glitch.com/embed/#!/embed/fuschia-savory-mangosteen?path=views/index.html&amp;previewSize=100" title="fuschia-savory-mangosteen on Glitch" allow="geolocation; microphone; camera; midi; vr; encrypted-media" style="height: 100%; width: 100%; border: 0;">
		  </iframe>
<!--kg-card-end: html-->

You should see the card you added, and the transaction you placed. If you’re really lucky, maybe another person reading this post also posted a card and transaction, which you’ll be able to see as well. Add another card to see how quickly the interactions are fed via the webhook to the receiving website.

### How You can use Fidel’s webhooks

Imagine automated emails thanking your customers for enrolling in your loyalty program. Once they place an order, you can not only confirm the order based on the information from your website, but also notify them of rewards earned through your loyalty program.  You can also have a webhook to validate when authorised transactions have cleared.  The webhook from Fidel allows you to process your data in real-time – with that, you can start to build some really cool customer experiences.

Intrigued?  Login to your Fidel dashboard and set up a few webhooks to see how convenient they make processing your data in real-time.  Leave a comment in our [community](http://community.fidel.uk) if you have any questions, or if you have a neat implementation you’d like to share.

<!--kg-card-begin: html-->
[Join the developer community](https://community.fidel.uk/)
<!--kg-card-end: html-->