Frontend SDK

Authenticate towards the API to obtain your Oauth2 access token

B2B SignUp uses the same authentication as the Payer B2B platform - with a OAuth2 Bearer token for all endpoints except the authentication endpoint. To obtain your Oauth2 access token, see the Payer B2B Platform API Documentation.

Make sure that you're authenticating towards the same environment to which to intend to run the onboarding SDK!

Note that the access token expires in one hour. In terms of the signup widget it means that the user will have one hour to finish going through the widget, assuming that you got a fresh token before creating the session. When the hour is up, the user will no longer be able to finish the widget flow. This also means that if you got the access token 55 minutes ago, the user will only have 5 minutes to finish going through the widget.

To avoid the user having a short time going through the widget, we suggest that you implement logic for renewing the access token before it expires.

Make a backend-call to obtain your Client Token

Before it is possible to initiate the Frontend SDK you must first initiate an signup session by making the following backend API request to the Payer server: Create Session API Documentation

Load the Javascript SDK

HTML
Copy

There are some size restrictions that you should consider, in order for the widget to look great:

  • It requires a height of at least 570px(the SDK will automatically create a 570px high iFrame)
  • It requires a minimum width of 280px
  • It will not expand to cover more than 600px width

Add the Onboarding Widget Container to your webpage

Add a div to your webpage, that will be the container for the Onboarding widget.

HTML
Copy

Initialize & Load the Onboarding Widget

Initialize the Onboarding SDK with the clientToken that you received in the first step and the div id from the previous step.

Javascript
Copy

By now, the onboarding widget should appear on your webpage and you should be able to go through the flow. At the end, you'll get a backend as well as a frontend callback with the results!

Type to search, ESC to discard
Type to search, ESC to discard
Type to search, ESC to discard