By Ahmed Siddiqui, VP of Product Management at Marqeta
The Smart City of the future offers ample challenges. Take mass transit systems, for example. They can get us most of the way from our homes to our destinations, but typically not all the way. Ride sharing companies step in to solve this last mile problem. The transit system and the ride sharing companies operate independently but, for consumers, they are definitely dependent. In a future smart city, we should be able to create the connection for consumers between the two independent systems. Wouldn’t it be great if my transit card rewarded me with credits at a ride sharing company or whatever other means of last mile transportation I use?
Mass transit systems typically operate on proprietary, “closed-loop” systems like the Clipper Card in the San Francisco Bay Area. These transit cards hold a monetary value that can only be spent for transit, and for nothing else, forcing you to have a piece of plastic in your wallet that only serves one purpose. These proprietary systems are contactless in most cases. Why do you need a physical card at all when most modern smartphones have NFC capability? How can we make the transit card truly digital and also be considered a “top-of-wallet” product?
How to build a Smarter City Digital Transit Reward card using Visa and Marqeta APIs
Visa’s Offers API allows us to create offers based off of some spend. For example, you take 5 BART rides, and then you get a $10 transit reward. The Marqeta platform enables you to create virtual cards that you can add to Apple Pay. Marqeta also enables you to control the spend behavior so these offers or rewards can only be spent at specific locations or for specific purposes (like transit).
Getting started with the Marqeta API
In the following example, code snippets illustrate how to interact with the Marqeta API. When you are ready to start exploring the API, be sure to modify these snippets to use your own authentication credentials, and be sure to replace all the example tokens with your own, unique values. You can also leave out the token field, and the system will automatically generate a unique token for each new object.
Note: Do not use the same tokens as in these examples. If an object with the same token already exists, the system will handle the request as a duplicate, and your request will not take effect.
Open the API Explorer and take note of your API keys. Link: https://www.marqeta.com/api-explorer To authenticate each API request, you need to include your Application Token as the user name and your user Master Access Token as the password. For example, use this option with each cURL request:
Create a test user to represent a hypothetical card holder. For a simple test, you can omit most of the body fields and just create a default user. Take note of the token, which you will use when you create a card for this user. Link: https://www.marqeta.com/api/docs/VhK2YBwAALoAnvJs/users
Create a Smarter City Digital Transit Reward card for your test user. The card is active right away because we configured the card product to activate upon issue, which is the standard behavior for a virtual card. Link: https://www.marqeta.com/api/docs/VhypzxwAANwA_Vgx/cards
Demonstrating the Smarter City Digital Transit Reward Card in Action
To demonstrate your Smarter City card in action, you can write a routine that simulates transactions with your test virtual card. Include a counter that increments every time a transaction runs against a fictitious “BART” merchant ID number (mid). When the counter reaches 5, send a request to Visa Offers API to create a ride sharing credit of $10 and then reset the counter to 0.
For example, to simulate transactions at a “BART” merchant with the Marqeta API:
With Marqeta's instant issuance feature, you could build a mobile application that both creates the Smarter City Digital Transit Reward virtual card and automatically adds it to an Apple Pay digital wallet on the user’s device.
To add a card to Apple Pay, it must first be tokenized—which is a process that replaces sensitive card data with atoken that serves as a reference to the card. You can use the Marqeta API to retrieve the encrypted card data.
At this point, you’ll need to integrate with the Apple Pay API. You’ll send the encrypted card data to Apple Pay, and Apple Pay will request a token from the network. After the card network issues the token, Apple Pay stores it on the user’s device, and the card holder can use it to spend their reward credits on a ride sharing app.
By adding a virtual card directly to a digital wallet, like Apple Pay, you can effectively bypass the need for a proprietary piece of plastic and allow the card holder to use a mobile device as an all-in-one transit card.
Let’s build a smarter transit system for the Smarter City together!
Ahmed Siddiqui is VP of Product Management at Marqeta, the first modern card issuing and core processing platform, powering prepaid, debit and credit cards for the world’s top commerce innovators. He can be reached on Twitter @siddiquiahmed