Create a session
Your backend must create a session. This returns a session ID and the script URL for the components.Base URLs
Steps
1
Obtain a JWT access token
Request a JWT from the Merchant API.POST /oauth2/token (See Merchant API documentation for details.)
2
Fetch stores
In the next step you will need the store id. See Merchant API for information about fetching your store configurations.
3
Create a session
Use the JWT as a bearer token to create a session. The session represents a checkout session and should not be reused between users.You can pass a A request body is always required. When you don’t need campaign filtering, pass an empty JSON object:Request body example with campaign:Response:
campaign keyword in the request body to filter payment methods for a specific campaign (e.g. a promotional offer on a product). When set, only payment methods matching that campaign are returned. When omitted, only non-campaign payment methods are returned.Campaigns must be configured by Resurs for your payment methods before you can use them. Contact Resurs to set up campaigns.
4
Pass the session ID and script URL to your frontend
Your frontend needs two values from the response:
id: The session ID, used as thesession-idattribute on the componentembed.src: The script URL to load the components
expiresAt that states the validity of the session ID. If the session expires, you must create a new session. For normal usage, the session will be long enough so won’t need to refresh.expiresAt: Session expiration timestamp in ISO 8601 format. After this time, the session will no longer be valid for API requests.
Load the script
Use theembed.src value from the session response: