Configuring TreviPay
Learn how to configure TreviPay for DigitalRiver.js with Elements.
If you're using DigitalRiver.js with Elements, you can create a TreviPay payment method for your app or website in four easy steps:
After you configure TreviPay for DigitalRiver.js, you must add the organization identifier (organizationId
) to the payload in the cart to make the TreviPay payment method available to the shopper. The organizationId
uses the same value as the client_reference_id
specified in TreviPay enrollment URL.
Step 1: Build the TreviPay object
A TreviPay source request object requires the following fields.
Field | Value |
---|---|
|
|
| The payment session identifier. |
| A TreviPay source details object that includes the details of the transaction. |
TreviPay source details object
The TreviPay source details object requires the following fields.
Field | Required/Optional | Description |
---|---|---|
| Required | If you choose to use the full redirect flow, this is where you will redirect your customer to after authorizing within the TreviPay experience. Note that the |
| Required | If you choose to utilize the full redirect flow, this is where you will redirect your customer to after canceling within the TreviPay experience. |
Step 2: Create a TreviPay agreement 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 adheres to a standardized format using the state
attribute. Note that the state
attribute listed below corresponds to the countrySubdivision
attribute used when providing address information. The payment session manages the correct field name on the backend.
TreviPay source response example
Step 3: Authorize a TreviPay source
When you create a TreviPay source, the customer is required to authorize the charge at TreviPay. You can accomplish this by redirecting the customer to TreviPay to authorize the charge as part of your experience.
Redirecting the customer to TreviPay for authorization
To redirect your customer to TreviPay for authorization, use the redirectUrl
parameter in your createSource
response.
At TreviPay, the customer can authorize or cancel the transaction when presented with the transaction details. If the authorization is successful, the customer will be redirected to the TreviPay Return URL parameter you specified when you created the source. If the customer cancels, they will be returned to the TreviPay Cancel URL parameter you specified.
Step 4: Use the authorized source
Once authorized, you can use the source by attaching it to a cart.
Testing TreviPay
See Testing redirect payment methods for testing instructions.
Last updated