- The Toolkit’s JavaScript code, which you add to your application environment. This code injects UX Toolkit UI components into your customer application as native web components, with any PCI data in iframes.
- Studio, a web-based environment you use to configure and style the theme applied to the UI components so they align with your customer application’s brand.
- The Marqeta platform’s APIs, to which you send your card program’s transaction- and account-related API calls. You also use the Marqeta platform to upload your Studio theme.
- The Marqeta platform’s private sandbox, a secure environment specifically created for your program, where you develop and test your code before deploying to production. The private sandbox should not be confused with the public sandbox, which is a sample sandbox automatically provisioned for any user who logs in to marqeta.com.
This guide assumes you have already worked with Marqeta to enable UX Toolkit for your program. You cannot complete these steps in the public sandbox environment.
Get access
Enable UX Toolkit for your program
UX Toolkit is enabled per-program by your Marqeta representative. To begin, contact your Marqeta onboarding specialist or account representative to request UX Toolkit access for your program. They will provide your program short code (referenced asprgmshrtcde throughout these docs) and walk you through onboarding requirements.
You will also need to uniquely identify your cardholders on the platform via a user token. This unique user identifier is generated as part of creating a user via the POST /users endpoint. For more information, see Users in the Marqeta core API reference.
Create RSA keys
To authenticate UX Toolkit via OAuth, you must generate a unique 2048-bit RSA key pair for each of your Marqeta programs. Marqeta recommends using OpenSSL. When your Marqeta representative creates your program, you must provide them with the public key as an X.509 certificate encoded in Privacy Enhanced Mail (PEM) format. Step 1 Generate a private key in PEM format using the following command:Pem
Pem
myprogram_public_key.pem.pub will look like this X.509 certificate:
Pem
I have access — how do I get started?
Prerequisite
Customer Authentication API. Before you can render any UX Toolkit components, you must build a Customer Authentication API on your backend that handles the OAuth 2.0 + DPoP token exchange with Marqeta. This is the single most-missed step during onboarding. See Customer Authentication API for the full implementation guide.
Customer Authentication API. Before you can render any UX Toolkit components, you must build a Customer Authentication API on your backend that handles the OAuth 2.0 + DPoP token exchange with Marqeta. This is the single most-missed step during onboarding. See Customer Authentication API for the full implementation guide.
Quick start
The following minimal HTML example renders a single UX Toolkit component (mq-card) on a page. It demonstrates the three things you need to display a working component: the script tag, the bootstrap() call, and the component element itself.
In this example, prgmshrtcde represents the short code associated with your card program, and 1 represents the major version number of the latest UX Toolkit web components release. To see the latest major.minor.patch version, access Studio; the version number is shown at the top of the page.
HTML
crossorigin property on the script tag allows your site to store the exact version of the script you are using. This value is downloaded in a session cookie (e.g., uxToolKitVersion: 1.0.0) to ensure a consistent user experience.
Your customer application will display the requested UI component, automatically injecting any PCI data into a secure iframe.
What’s next?
Once your Quick Start is rendering, here’s where to go next:- Customize the look-and-feel. Pass additional options to
bootstrap()(theme, language, environment) and design a custom theme. See Customizing UX Toolkit. - Add more components. Browse the catalog in About UX Toolkit and the canonical reference in Studio.
- Integrate component events. Listen for events to wire up linked behavior between components. See Integrating Components.
- Embed in a mobile webview. If your application is a native mobile app, see Working within Native Webviews.