Resurs Payment Widget
The Resurs Payment Widget is a standard Web Component for integrating Resurs payment methods into your checkout flow. It is flexible, fully compliant, and easy to integrate.. The widget renders your Resurs payment methods, and emits a JavaScript event when the user selects one of them.Quick Start
This is a quick start, for more in-depth information, skip ahead to the Full
Guide.*
- Obtain a session token from the Resurs Widget API. You will need to supply this token when setting up the widget.
- Add the necessary script tag in your webpage to load the widget source.
- Invoke the web component(s) to render the Payment Widget*.
Step 1. Obtain a session token
Before rendering the widget, you must obtain a session token from the Resurs Widget API. See the Backend Integration Guide.Step 2. Add the script tag
3. Render the payment widget
The following example shows the web component tag for the Payment Widget with a payment amount of5000.
Currency is determined by the Resurs payment methods configured for the store
relative to the session ID.
4. Listen for payment method selection
The selection is a standard JavaScript Event. Below is an example.Full Guide
Everything you need to know about the Resurs Payment Widget and its modular components.Obtain a Session Token
Before rendering the widget, you must obtain a session token from the Resurs Widget API. See the Backend Integration Guide.Add the Script Tag
Add the Resurs Payment Widget script tag to your webpage:Script Attributes
| Attribute | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Must be resurs-payment-widget. |
data-customer-type | string | Yes | Customer type: NATURAL or B2C (consumers), or LEGAL or B2B (businesses). |
data-locale | string | Yes | Locale: sv-SE, da-DK, no-NO, fi-FI, or en. |
type | string | Yes | Must be module. |
Source URLs
| Environment | URL |
|---|---|
| Production | https://payment-static.checkout.prod.resurs.cloud/resurs-payment-widget.js |
| Integration | https://payment-static.checkout.int.resurs.cloud/resurs-payment-widget.js |
Rendering Components
The easiest way to use the Resurs Payment Widget is by adding the<resurs-payment-method-selector> web component; however, the script also provides more modular web components for those who need to integrate with their own checkout flow. See Composing with Modular Components.
Interactive Example
<resurs-payment-method-selector>
The full payment selector displays all available payment methods for the supplied session token and customer type.
Example:
Attributes
| Attribute | Type | Required | Description |
|---|---|---|---|
amount | string | Yes | Total purchase amount |
token | string | Yes | Session token from the Widget API (/session endpoint). Example: rpmw_3jZ8k9Xy7Vb2N5mQ1rT6W. |
customerType | string | No | Customer type: NATURAL or B2C (consumers), or LEGAL or B2B (businesses). |
Features
- Automatically fetches and displays all available payment methods.
- Renders loading states while fetching data.
- Shows error states for failed requests.
- Dispatches selection events.
- Built-in accessibility support.
Composing with Modular Components
See Composing with Modular ComponentsEvents
resursPaymentMethodSelected
When using <resurs-payment-method-selector> or <resurs-payment-method defaultStyling showHeader>, the component emits an event when a payment method is selected or deselected.
When the payment method type is
RESURS_PART_PAYMENT_SELECT_NOW, the
component always emits an event for a selected part-payment.When Selected
The component emits a custom event whosedetail property is an object with the following structure:
Examples
JavaScript exampleWhen “Deselected”
The component will emit a custom event whosedetail property is null.
Example
Updating the Widget with new Amount or Session Token
To update the components with new amount or session token, you can update either the amount and token of the component directly, or you can call on the script’s helper function and use that to update everything at once. The update function takes a JavaScript object as its parameter with three optional fields:amount, token, and customerType.
Example
Programmatically selecting and deselecting payment methods
There are two functions you may call on to select and deselect items respectively. The selector functionwindow.resurs.dispatchSelected('TYPE', 'paymentMethodId') takes two arguments, a type and a paymentMethodId (UUID).
To deselect, you just call window.resurs.dispatchDeselected().
Payment Method Types
The widget supports the following payment method types:RESURS_INVOICERESURS_PART_PAYMENT_SELECT_LATERRESURS_PART_PAYMENT_SELECT_NOWRESURS_CARDRESURS_REVOLVING_CREDITRESURS_NEW_REVOLVING_CREDIT
Available payment methods depend on your store configuration, customer type,
and the specified amount. The widget only displays applicable methods.
Customization
Styling
The widget provides two styling modes:- Default Styling
- Custom Styling
Default Styling
With thedefaultStyling attribute, the widget applies Resurs’ branding with outlines and standard spacing:
Custom Styling
OmitdefaultStyling to render without Resurs’ styling, allowing full integration with your design system:
CSS Variable Names
The widget with default styling uses these CSS variables for theming:Performance
- The widget automatically caches payment method data.
- Only one API request is made per amount change.
Accessibility
- The widget includes ARIA labels and keyboard navigation.
- Use semantic HTML around the widget.
- Ensure sufficient color contrast if customizing styles.
Troubleshooting
Widget Not Rendering?
Check script tag ID:data-customer-typemust be one of:NATURAL,B2C,LEGAL,B2B.data-localemust be one of:sv-SE,da-DK,no-NO,fi-FI,en.tokenmust be a valid session token from the Widget API (format:rpmw_*).
Session or API Errors
If you see errors in the browser console: “Unauthorized” or 401 errors:- Session token is invalid or expired. Obtain a new token as described here.
- Verify the session token format (should start with
rpmw_). - Ensure the session token hasn’t expired.