How I Built My Own Rewards Card

johnjvester

John Vester

Posted on January 31, 2022

How I Built My Own Rewards Card

Article Image

Before Amazon caught my eye, I found enjoyment in visiting brick-and-mortar technology retailers to check out new and exciting products. One retailer I visited more than others was Best Buy. Around that time, I was asked if I would be interested in signing up for a Best Buy rewards card during the checkout process. Hearing that every single purchase I made at Best Buy would go towards points that led to financial rewards got my attention, and I signed up immediately.

I was excited.

Am I still excited about the Best Buy rewards card? Not really … mostly because my shopping habits have changed, and I honestly cannot tell you the last time I placed an order with the one time electronics superstore leader.

I don’t believe my experience is much different than most who joined the Best Buy rewards card program when it was announced. The appeal of getting rewarded for buying as much as possible from a single source is no longer attractive—when the rewarded funds must be spent at the entity recognizing the customer's loyalty.

When I thought about this more, and I saw how easy it is to buy a cash-based Discover/Mastercard/Visa gift card, I started to wonder how easy it would be to offer a modern-day rewards card that consumers could use anywhere that card is accepted.

The Rewards Card Concept

At the heart of the rewards card concept is the incentive for shoppers to select your business over the endless choices in today’s global market. The more they buy from you, the more rewards they expect to receive.

Since today’s shoppers are more interested in rewards that can be utilized anywhere, the ideal rewards card concept should utilize a currency technology such as Discover, Mastercard, or Visa, which are pretty much accepted anywhere these days.

An Example: Vester & Son’s

As an example, let’s assume that Vester & Son’s is an online retailer looking to increase sales via a rewards card program. When shoppers sign up for the Vester & Son’s Rewards program, they only need an account on the Vester & Son’s e-commerce site. This is not a stretch for most customers, because they already provide the following required information every time they make a purchase:

  • Full Name
  • Email Address
  • Phone Number
  • Mailing Address

Once a customer spends over $100 in purchases, Vester & Son’s will provide a Discover card which will be pre-loaded with 10% of their total purchases. Meaning, every $10 spent on Vester & Son’s products will yield a $1 reward. Not a bad deal, right?

The customer can use their Vester & Son’s Rewards Discover card on anything … wherever Discover is accepted.

Using Marqeta as a Rewards Card Source

In my “Leveraging Marqeta to Build a Payment Service in Spring Boot” article published earlier this year, I detailed the following transaction flow used by Marqeta for popular services by Uber, DoorDash, and Square (just to name a few):

User to Card

As it turns out, using Marqeta to fund a globally accepted rewards card follows a very similar flow:

Vester & Son's to Card

In this example, Vester & Son’s provides a funding source for the rewards card program. As each customer qualifies for the program, funds are made available for use on the Discover-based rewards card.

While the customer can use the Discover card for future purchases at Vester & Son’s, nothing prevents the purchase of anything from anywhere, including from Vester & Son’s competitors.

Creating the Rewards Card Program

Leveraging the Marqeta API, I was able to establish a new program for the Vester & Son’s rewards card program using the following cURL command:

curl --location --request POST 'https://sandbox-api.marqeta.com/v3/fundingsources/program' \
--header 'accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic APPLICATION_TOKEN_GOES_HERE:ADMIN_ACCESS_TOKEN_GOES_HERE' \
--data-raw '{"name":"vester_rewards_card_program","active":true}'
Enter fullscreen mode Exit fullscreen mode

The following response was returned, which includes a token property that will be referenced later in this article:

{
  "name": "vester_rewards_card_program",
  "active": true,
  "token": "9ff9d776-bf89-4350-bac2-ee8d8412f611",
  "created_time": "2021-12-28T12:37:47Z",
  "last_modified_time": "2021-12-28T12:37:47Z",
  "account": "12.003.001.000000"
}
Enter fullscreen mode Exit fullscreen mode

A Quick Example (Using cURL Commands)

For the “Leveraging Marqeta to Build a Payment Service in Spring Boot” article (referenced above), I created a Spring Boot API service to act as a front-end to the Marqeta API, which can be found on GitLab at the following URL:

https://gitlab.com/johnjvester/marqeta-example

I will continue to use this service in this publication as well.

Locating the Customer

The Spring Boot User API was enhanced to return Marqeta user data for a given customer, Doing so utilized the user token as the unique key in the URI. Using the Randy Kern user token (from my prior publication), we can send the following cURL request:

curl --location -X GET 'localhost:9999/users/1017b62c-6b61-4fcd-b663-5c81feab6524'
Enter fullscreen mode Exit fullscreen mode

The request returns the following response payload:

{
    "token": "7193b62c-6b61-4fcd-b663-5c81feab6524",
    "createdTime": 1628946073000,
    "lastModifiedTime": 1628946074000,
    "metadata": {},
    "active": true,
    "firstName": "Randy",
    "lastName": "Kern",
    "usersParentAccount": false,
    "corporateCardHolder": false,
    "accountHolderGroupToken": "DEFAULT_AHG",
    "status": "ACTIVE"
}
Enter fullscreen mode Exit fullscreen mode

Locating the Rewards Card

The Vester & Son’s e-commerce site would automatically establish a new Vester & Son’s rewards card once the customer made $100 in purchases. To simulate this action, we send the following cURL request to the Marqeta API:

curl --location --request POST 'https://sandbox-api.marqeta.com/v3/fundingsources/paymentcard' \
--header 'accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic APPLICATION_TOKEN_GOES_HERE:ADMIN_ACCESS_TOKEN_GOES_HERE’ \
--data-raw '{"postal_code":"46077","account_number":"6559906559906557","exp_date":"1225","cvv_number":"123","user_token":"1017b62c-6b61-4fcd-b663-5c81feab6524","is_default_account":true}'
Enter fullscreen mode Exit fullscreen mode

The response payload includes the newly created Discover card information for the Randy Kern customer:

{
  "created_time": "2021-12-28T11:54:08Z",
  "last_modified_time": "2021-12-28T11:54:08Z",
  "type": "paymentcard",
  "token": "2ee44d0b-5d00-4744-af2d-8ab9c8c606b8",
  "account_suffix": "6557",
  "account_type": "DISCOVER",
  "active": true,
  "is_default_account": true,
  "exp_date": "1225",
  "user_token": "1017b62c-6b61-4fcd-b663-5c81feab6524"
}
Enter fullscreen mode Exit fullscreen mode

Please note: the expiration date for the card may have to align with the card provider’s standards (it cannot be endless). In these cases, the Vester & Son’s rewards card program would have the necessary business logic in place to route a new card to the customer when the expiration date nears.

Below is an example of what the Vester & Son’s rewards card for Randy Kern might look like:

Randy Kern Discover

With the user token identified, the Spring Boot service can easily locate the Vester & Son’s rewards card payment cards for the Randy Kern user via the following cURL command:

curl --location --request GET 'localhost:9999/paymentcards/user/7193b62c-6b61-4fcd-b663-5c81feab6524'
Enter fullscreen mode Exit fullscreen mode

The following response includes all the payment cards associated with the Randy Kern customer:

[
    {
        "token": "2ee44d0b-5d00-4744-af2d-8ab9c8c606b8",
        "createdTime": 1640692448000,
        "lastModifiedTime": 1640692448000,
        "type": "paymentcard",
        "active": true,
        "userToken": "7193b62c-6b61-4fcd-b663-5c81feab6524",
        "accountSuffix": "6557",
        "accountType": "DISCOVER",
        "expDate": "1225",
        "defaultAccount": true
    }
]
Enter fullscreen mode Exit fullscreen mode

Using the payment card token, we sent the following cURL request to retrieve a single payment card:

curl --location --request GET 'localhost:9999/paymentcards/2ee44d0b-5d00-4744-af2d-8ab9c8c606b8'
Enter fullscreen mode Exit fullscreen mode

This returns a payload limited to the payment card token provided:

{
    "token": "2ee44d0b-5d00-4744-af2d-8ab9c8c606b8",
    "createdTime": 1640692448000,
    "lastModifiedTime": 1640692448000,
    "type": "paymentcard",
    "active": true,
    "userToken": "7193b62c-6b61-4fcd-b663-5c81feab6524",
    "accountSuffix": "6557",
    "accountType": "DISCOVER",
    "expDate": "1225",
    "defaultAccount": true
}
Enter fullscreen mode Exit fullscreen mode

The Vester & Son’s e-commerce site would store the user token and payment card token for each customer enrolled in the Vester & Son’s rewards card program. This will make it easy to cross-reference a given customer for a given rewards card.

As the customer earns more rewards, the program adds to the funds available for spending on the customer's reward card. Adding funds is as simple as making an API call. From there, the customer can spend their Vester & Son’s rewards anywhere that Discover is accepted.

Conclusion

Starting in 2021, I have been trying to live the following mission statement, which I feel can apply to any IT professional:

“Focus your time on delivering features/functionality which extends the value of your intellectual property. Leverage frameworks, products, and services for everything else.”

  • J. Vester

Marqeta certainly fits into my mission statement, as their service provides all the necessary components to create a rewards card program that allows purchases anywhere the selected card product (e.g. Discover, Mastercard, Visa) is accepted.

Thinking back, the Best Buy rewards program was not the first program I used for my technology purchases. When I was in college, the EggHead Software stores were thriving across America, offering endless shelves of software and accessories for the booming personal computer market.

Signing up for an EggHead discount card gave me a 5% discount on all purchases and other specials throughout the year. The college version of myself did not realize they were likely tracking my purchases to help guide me to future purchases … but honestly, I don’t think the college version of me would have even cared either. I was saving money and getting new software to use.

But the rewards card concept worked … and I opted to shop at EggHead first.

If you are interested in using the Spring Boot service I created for this article, the project is available at GitLab at the following URL:

https://gitlab.com/johnjvester/marqeta-example

Have a really great day!

💖 💪 🙅 🚩
johnjvester
John Vester

Posted on January 31, 2022

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related