Configuring Trustly
Learn how to configure Trustly for DigitialRiver.js with Elements.
If you're using DigitalRiver.js with Elements, you can create a Trustly payment method for your app or website in four easy steps:
Create a Trustly payment method for your app or website in four easy steps:
Step 1: Build a Trustly Source Request object
Build a Trustly Source Request object. A Trustly Source Request object requires the following fields:
Field | Value |
---|---|
type |
|
| The payment session identifier. |
| |
|
Trustly Source Details Object
Create a Trustly source details object.
Field | Required/Optional | Description |
---|---|---|
| Required | If you choose the full redirect flow, this is where you will redirect your customer after the customer authorizes or cancels the payment within the Trustly experience. |
Step 2: Create a Trustly source using DigitalRiver.js
Use the DigitalRiver.js library to create and mount elements to the HTML container.
The address
object must contain postal code and state/province data that adhere to a standardized format.
Trustly Source response example
Step 3: Authorize the Trustly source
When you create a Trustly source, the customer must authorize the charge through their payment provider. You can accomplish this by redirecting the customer to their payment provider.
Redirecting the customer for Trustly authorization
To redirect your customer to the payment provider for authorization, use the redirectUrl parameter in your createSource
response.
The payment provider will present the customer with the transaction details where they can authorize or cancel the transaction. A successful authorization redirects the customer to the Trustly Return URL parameter you specified when you created the source.
Once authorized, the source state will change to chargeable.
Step 4: Use the authorized source
Once authorized, you can use the source by attaching it to a checkout.
Testing Trustly
See Testing standard payment methods for testing instructions.
Last updated