Using Activate Card and Set PIN Widgets

Marqeta provides customizable widgets that enable card holders to securely activate their cards and set their PINs in your customer web and mobile applications. You can embed these widgets inline as iframes in your web applications. The widgets fully comply with the Payment Card Industry Data Security Standard (PCI DSS), which defines the security and protocol standards for organizations that store, transmit, or process card data. If you have already obtained PCI Compliance certification, using the Marqeta Activate Card and Set PIN widgets in your web applications is optional.

At the end of the guide, you should understand:

  • What the Activate Card and Set PIN widgets are and when you need to use them.
  • How to create a customized widget to integrate with your web application.
  • How the input to the widgets is validated.

Note: Widgets reduce your burden of achieving data security compliance by providing a PCI-compliant way to allow card holders to perform certain actions; however, you have other responsibilities regarding data security for other elements of your card holder experience. Contact your Marqeta Customer Success Representative for details.

Prerequisites

  • Read the Quick Start Guide.
  • Obtain a user token.
  • Obtain a card token that is associated with the user token, if working with the Set PIN widget.
  • Have a parent web application in which to integrate the widget. This application must use HTTPS.

Concepts

Data security compliance

You must comply with PCI DSS data security requirements if you want to store, process, or transmit sensitive card data such as the primary account number (PAN), personal identification number (PIN), and card expiration date. The process of becoming PCI DSS certified to store, transmit and process such data directly is both time consuming and expensive. The Activate Card and Set PIN widgets handle the encrypted transmission of sensitive card data, and can help you comply with some aspects of the PCI compliance burden. Marqeta is fully PCI-Level 1 compliant, and securely handles the unencrypted, sensitive card data.

Available widgets

The Activate Card and Set PIN widgets are customizable iframes that enable the card holder to provide sensitive card data to the Marqeta platform. When you embed a widget in your application, your servers never store, transmit, or process the card data so you are not required to be PCI DSS compliant. You embed the iframe in the parent page of your web application where you want the functionality of the widget to occur; embed the iframe using a web element when adding a widget to a mobile application. You configure the iframe by passing query parameters in the iframe's source URL. The Marqeta platform then processes the iframe.

You can integrate the following widgets:

  1. Activate Card – Allows authenticated card holders to activate their program-specific cards.
  2. Set PIN – Allows card holders to set their online EMV PIN code.

Upon successful completion, the Activate Card widget renders the Set PIN widget automatically.

The Activate Card and Set PIN widgets apply to many use cases. For example, an alternative lender who leverages an authorized user model might have these widgets display as part of providing loans to businesses. The widgets would enable the business owners to activate their card, then choose their own PIN.

Note: Your application must provide a login method to authenticate the user. Widgets do not provide user authentication; they only validate that the user-entered data matches the card data on the Marqeta platform.

Widget customization

Before integrating widgets into your application, you must provide Marqeta with your customized style attributes. Marqeta provides the Marqeta Widget Style Preview page as a testing ground for you to determine how you want your widgets to look.

The following styles are customizable:

Style Category Attributes and Values
Global styles
  • Font stack, such as Helvetica, Arial, sans-serif.
  • Font color.
  • Font size (max 18px).
  • Background color.
Form labels
  • Label text color.
  • Label font size.
  • Label font weight.
  • Label text style.
Headers
  • Option to show the Activate Card header.
  • Option to show the Set PIN header.
  • Header font size.
Button styles
  • Font stack, such as Helvetica, Arial, sans-serif.
  • Button background color.
  • Button font color.
  • Hover state background color.
  • Hover state font color.
Error message styles Errors are displayed above the widget in a flash-message style list.
  • Font stack, such as Helvetica, Arial, sans-serif.
  • Font color.
  • Font size (max 18px).
  • Background color.
iframe size
  • Minimum height: 120px.
  • Minimum width: 300px.

Any global styles you define are overridden by more specific style category declarations. For example, if you set a font stack in both the Global Styles category and the Button Styles category, the fonts of the Button Styles stack will apply to the buttons. Other styles are unaffected by this declaration.

iframe parameters

The widget supports base URLs for both sandbox and production environments.

Depending on your environment, use one of the following base URLs as the source of the iframe:

Environment Widget Base URL
Sandbox Activate Card https://widgets-sandbox.marqeta.com/activate_card
Sandbox Set PIN https://widgets-sandbox.marqeta.com/set_pin
Production Activate Card https://widgets.marqeta.com/activate_card
Production Set PIN https://widgets.marqeta.com/set_pin

Using query parameters, you can specify options, such as the language to use when rendering the widget and the message to display upon successful completion.

Build your iframe content for the desired widget by adding the appropriate query parameters:

Parameter Required? Type Description
application_id Yes string The application ID for use with widgets, obtained from Marqeta in Step Two.
one_time_token Yes string User's one-time authentication token, generated via POST at /users/auth/onetime in Step Three.
user_token Yes string Existing user token. Send a GET request to /users to retrieve an existing user token.
card_token Yes, if Set PIN widget string Existing card token that is associated with the user token. Send a GET request to /cards/user/{token} to retrieve card tokens for a specific user.
Note: Only applies to the Set PIN widget.
success_url Yes string HTTPS URL of the page that is loaded in the iframe upon successful completion.
The success_url must use HTTPS as the protocol; most browsers do not allow HTTP content to be loaded into the iframe window. In addition, the protocol must be specified for the widget to recognize it as a valid success_url. This URL must not be enclosed in quotation marks, but it can be URL encoded.
When calling a widget in an iframe, make sure the page provided does not set the X-Frame-Options to DENY or SAMEORIGIN; otherwise the iframe cannot display in modern browsers. If using the widget directly in the browser window, the redirect does not require the X-Frame-Options header.
If the success_url is invalid or not provided, the widget displays a generic message informing the card holder that the request has been successfully processed.
display_headers No boolean If set to false, the widget's standard headers are not displayed above the iframe.
Default: true
locale No string The language to use when rendering the widget. This parameter is a language tag composed of a language code and a country code. The following language tag values are supported:
  • en-US
  • fr-CA
Default: en-US

Validation and error handling

The one-time user authentication token you create expires 120 minutes from when the Card Activation widget appears on-screen. The card holder must complete the card activation during this period. After the Card Activation widget closes, the timer resets to zero to allow the card holder another 120 minutes to set the PIN in the Set PIN widget.

After the card data has been supplied to the widget, the widget performs a number of validations before sending the data to Marqeta's servers. The card holder has five attempts to correctly input data in the Activate Card or the Set PIN widget. After five failed attempts, the widget displays an error message. To try another five times, the card holder has to refresh the parent web page to force the generation of a new widget.

A card holder might successfully activate a card using the Activate Card widget, but fail to set a PIN using the Set PIN widget. In this case, the next time the card holder accesses the widgets, the Set PIN widget appears without displaying the Activate Card widget again.

Note: There is no way to inform the parent web page in the event of an error. If the widget encounters an error, the card holder must refresh the parent web page. You might consider providing instructions to the card holder on how to do this.

Activate Card validation

The following validations are performed on the data entered in the widget when the card holder clicks or taps Activate Card:

  • PAN has been entered in the widget.
  • PAN is a valid card number.
  • CVV has been entered in the widget.
  • CVV is 3 or 4 characters in length.
  • CVV is a numeric value.

If successful, the failure count and the timer are reset to 0, and the Activate Card widget automatically renders the Set PIN widget.

Set PIN validation

The following validations are performed on the data entered in the widget when the card holder clicks or taps Set PIN:

  • PIN does not contain consecutive ascending or descending values, such as 1-2-3-4 or 9-8-7-6.
  • PIN is not a single digit repeated four times, such as 2-2-2-2.
  • PIN is not one of the most common PINs chosen by card holders.
  • PIN confirmation value matches the PIN value.

If successful, the page specified by the success_url parameter is loaded.


Tutorial

This tutorial walks you through how to create a customized Activate Card widget and integrate it with a web application in your sandbox environment.

The Activate Card and Set PIN widgets are not supported in the Marqeta shared sandbox.

Step One: Define the widget style attributes

Go to the Marqeta Widget Style Preview page to configure and preview the widget's styles. Choose attributes that match with your web application. Send the finalized styles to Marqeta for implementation when you are ready to integrate a widget into your production environment.

Step Two: Obtain a new application ID from Marqeta

Contact your Marqeta representative to obtain an application ID, which is a value used specifically for embedding the Activate Card and Set PIN widgets. You must use the same application ID for both widgets. This value is typically provided when you begin working with Marqeta.

Step Three: Generate a one-time user authentication token

Configure your web application to send a POST request to /users/auth/onetime to generate a one-time user authentication token for the logged-in user. The single-use access token you create for the logged-in user is valid for one request only, and expires five minutes after it is generated. See the "Return single-use token" section of the Users page for more information about this endpoint.

The following is an example of a cURL request that generates a one-time user authentication token:

curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'Authorization: Basic dXNlcjM5MDQxNTM2ODY0MTY4OjRhN2VkNDlhLWZjOTctNDdmNy04NmY0LTUxN2VjZTE1ZGY5ZQ==' -d
'{
"user_token": "bc381ddf-b8c9-47b5-a724-4ae71f1aad7d"
}' 'https://widgets-sandbox.marqeta.com/users/auth/onetime'

Note: After the one-time token is redeemed to render the parent web page, it cannot be reused. If the widget times out or the parent web page is refreshed by the card holder, a new one-time token must be generated and passed to the iframe.

Step Four: Build and embed the iframe

Build the iframe content for the widget by adding the appropriate query parameters from the table in the "iframe parameters" section, then embed the iframe in the parent website.

For this scenario, use the following as the source of the iframe: https://widgets-sandbox.marqeta.com/activate_card. Since the iframe is requesting an HTTPS domain, the parent website URL must also use the HTTPS protocol.

When completed, the HTML for the iframe should resemble the following:

<iframe src="https://widgets-sandbox.marqeta.com/activate_card?one_time_token=11111111-1111-1111-1111-111111111111&user_token=22222222-2222-2222-2222-222222222222&application_id=33333333-3333-3333-3333-3333&success_url=https://yoursite.com/success_widget.html&display_headers=false></iframe>


Samples

Below are samples of iframes you can create by following the tutorial's steps. In each of these samples, a success URL is specified and the headers are disabled. The base URL reflects whether the iframe is used in a sandbox or a production environment.

Activate Card widget, sandbox environment

<iframe src="https://widgets-sandbox.marqeta.com/activate_card?one_time_token=11111111-1111-1111-1111-111111111111&user_token=22222222-2222-2222-2222-222222222222&application_id=33333333-3333-3333-3333-3333&success_url=https://yoursite.com/success_widget.html&display_headers=false></iframe>

Activate Card widget, production environment

<iframe src="https://widgets.marqeta.com/activate_card?one_time_token=11111111-1111-1111-1111-111111111111&user_token=22222222-2222-2222-2222-222222222222&application_id=33333333-3333-3333-3333-3333&success_url=https://yoursite.com/success_widget.html&display_headers=false></iframe>

Set PIN widget, sandbox environment

<iframe src="https://widgets-sandbox.marqeta.com/set_pin?one_time_token=11111111-1111-1111-1111-111111111111&user_token=22222222-2222-2222-2222-222222222222&card_token=44444444-4444-4444-4444-444444444444&application_id=33333333-3333-3333-3333-3333&success_url=https://yoursite.com/success_widget.html&display_headers=false></iframe>

Set PIN widget, production environment

<iframe src="https://widgets.marqeta.com/set_pin?one_time_token=11111111-1111-1111-1111-111111111111&user_token=22222222-2222-2222-2222-222222222222&card_token=44444444-4444-4444-4444-444444444444&application_id=33333333-3333-3333-3333-3333&success_url=https://yoursite.com/success_widget.html&display_headers=false></iframe>