Skip to main content
The Set PIN widget allows your customers to set or change their card PIN by entering and confirming a new PIN.
Set PIN

Step 1: Load the Widget Script

Load the Set PIN widget script into your page:

Step 2: Get a Widget Token

Request a widget token for setting the PIN:
Widget tokens expire after 5 minutes and are scoped to a specific card. Generate a new token on each page load or when the user initiates a new PIN change.

Step 3: Add the Widget Component

Add the <set-pin> web component to your page:

Configuration Options


Custom Labels

Customize the labels displayed in the widget:
Available custom label keys:
  • widgetTitle - Widget header text
  • pinLabel - PIN field label
  • confirmPinLabel - Confirm PIN field label
  • pinPlaceholder - PIN field placeholder
  • confirmPinPlaceholder - Confirm PIN placeholder
  • submitButtonText - Submit button text
  • submitLoadingText - Loading state text

Event Handling

The widget dispatches lifecycle events across two phases:
  • load — Widget initialized successfully, all fields are ready for user input.
  • error — Widget failed to initialize (field load failure, network error, or timeout).
  • success — PIN was set successfully.
  • failure — PIN setting failed (PINs do not match, expired widget token, or API error).
error fires only during widget initialization (e.g., a secure input field failed to load). If the widget loads successfully but the user’s submission fails — mismatched PINs, expired token — that triggers failure, not error.
You can listen for events using either addEventListener or callback properties:

Load Event

Dispatched when all secure input fields have loaded and the widget is fully functional. Use it to hide loading UI or enable dependent controls.

Error Event

Dispatched when the widget fails to initialize. This means one or more secure input fields could not load, and the widget is not functional. Show an error message or retry UI to the user.
The load and error events are mutually exclusive — exactly one will fire during widget initialization. Always listen for both to handle all scenarios.

Success and Failure Events

Dispatched after the user submits the PIN form. Common failure reasons include mismatched PINs and expired widget token. The success event exposes only non-sensitive status metadata: PIN values are never included in host-page event details.

Complete Example