This is a short-term solution. We are currently advancing this functionality to make it more customizable and easier to integrate with.
- PAN (primary account number)
- CVV (card verification value)
- EXP (expiration date)
- PIN (the card pin - v2.0.0+)
- Activate Card (activates a physical card by entering in the card number and CVV)
- Set PIN (sets the Card PIN for a newly activated card)
Getting Started
Make sure you’ve got the necessary components in place before integrating widgets with your application.API Keys
First, ensure you have your Synctera API Keys working for your business.Mobile applications
If you’re integrating the widgets in a mobile application, you may need to use one of the following web views:Upgrading from Marqeta 1.1.0 to 2.0.0
To take advantage of the PIN reveal feature, you will need to upgrade from Marqeta 1.1.0 to 2.0.0. If you already implemented the Marqeta widget, read this section to quickly upgrade.-
Replace
https://widgets.marqeta.com/marqetajs/1.1.0/marqeta.min.js
withhttps://widgets.marqeta.com/marqetajs/2.0.0/marqeta.min.js
-
For the config passed to
window.marqeta.bootstrap({ .... })
, the “showPan” field needs to wrapped in a “component” field:
Display Card PAN, CVV, and EXP
Refer to Marqeta’s guide Using Marqeta.js for additional information on the widget configuration and styling.
-
Load
marqeta.js
into the window object of the browser by adding the following script into the<head>
tag of the required page: -
Request a client access token for a card from Synctera via the POST request for /cards/{card_id}/client_token endpoint. Pass
clientAccessToken
to your front-end via SSR or HTTP request. This token expires after five minutes and is only applicable to the given card, so it’s a good idea to create a client access token on every page load: -
Add a separate HTML
div
element to your client page per each piece of the sensitive card data (Card PAN, Card CVV, Card EXP). You can attach this information to any HTML container:
-
Initialize
marqeta.js
via bootstrap with token by callingwindow.marqeta.bootstrap
. It will create an HTML iframe element inside each HTMLdiv
element. You can style thediv
elements and inner contents for the card PAN, card CVV, card EXP containers. To do so, use theshowPan
object as described in Using Marqeta.js > The showPan object:
Display Card PIN
- Follow the first two steps from Display Card PAN, CVV, and EXP.
Loading the PIN must be done in its own call to
window.marqeta.boostrap
, however you may call two instances simultaneously.- Add separate HTML elements to your client page for the card PIN (see example). You can attach this information to any HTML container:
-
Initialize
marqeta.js
via bootstrap with token by callingwindow.marqeta.bootstrap
. It will create an HTML iframe element inside each HTML element. You can style the elements and inner contents for the card PIN containers. To do so, use thepinReveal
object as described in Using Marqeta.js > The pinReveal object:
Display Activate Card and Set PIN Widgets
The Activate Card widget and Set PIN widget are displayed inside HTML iframe elements, with source URLs provided by the/cards/card_widget_url
route.
Refer to Marqeta’s guide Using Activate Card and Set PIN Widgets for additional information.
-
Fetch the card widget URL from the related endpoint. On the server, make a request to
/cards/card_widget_url
. For the Activate Card widget (widget_type === ‘activate_card’), you can omit thecard_id
param in the query: - Pass the acquired URL to your front-end via SSR or HTTP request. Include the URL into an iframe on your client page. The desired widget will be rendered inside the iframe, allowing the user to input either card PAN or card PIN and press submit:
Additional Information
As of version 2.0.0 of the Marqeta library allows for some customization of the fields’ appearances, including the css hover state. Supported CSS attributes generally include:color
, font-family
, font-size
, background
, font-weight
and letter-spacing
.
For the particulars on stying, please review the Using Marqeta.js > Concepts
(From Marqeta’s documentation: “CSS importing schemes such as @import and @url are not supported. Marqeta.js only supports web-safe/system fonts that can be displayed on modern web browsers without a specific download.”)
We use Typescript at Synctera and find it helpful to type our window properties. See the example typescript below for the window.marqeta
version 2.0.0 object provided by marqeta.js
:
TypeScript