Configuring SEPA Direct Debit
Learn how to configure SEPA Direct Debit for DigitalRiver.js with Elements.
If you're using DigitalRiver.js with Elements, you can create a SEPA Direct Debit payment method for your app or website in four easy steps:
Build the SEPA Direct Debit Source Request and Details objects.
A SEPA Direct Debit Source Request object requires the following fields.
Field | Value |
---|---|
type | directDebit |
sessionId | The payment session identifier. |
owner | |
directDebit |
The SEPA Direct Debit Source Details object requires the following fields.
{
"returnUrl": "https://example.com"
}
Field | Required/Optional | Description |
---|---|---|
returnUrl | Required | If you choose to use the full redirect flow, this is where you will redirect your customer to after authorizing or canceling within the SEPA Direct Debit experience. |
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.var data = {
"type": "directDebit",
"sessionId": "ea03bf6f-84ef-4993-b1e7-b7d5ecf71d1f",
"owner": {
firstName: "John",
lastName: "Doe",
email: "[email protected]",
phoneNumber: "000-000-0000",
address: {
line1: "123 Main Street",
line2: "",
city: "Paris",
postalCode: "14390",
country: "FR"
}
},
"directDebit": {
"returnUrl": "https://mypage.com"
}
}
digitalriver.createSource(data).then(function(result) {
if (result.error) {
//handle errors
} else {
var source = result.source;
//send the source to the back end
sendToBackend(source);
}
});
{
"clientId": "gc",
"channelId": "drdod15",
"liveMode": false,
"id": "bddccfc7-4fa8-401b-b661-421cd5047792",
"clientSecret": "bddccfc7-4fa8-401b-b661-421cd5047792_bdddssccfc7-4fa8-401b-b661-421cd5047792",
"type": "directDebit",
"reusable": false,
"owner": {
"firstName": "John",
"lastName": "Doe",
"email": "[email protected]",
"phoneNumber": "000-000-0000",
"address": {
"line1": "98 Boulevard Saint-Germain",
"city": "Paris",
"state": "Île-de-France",
"country": "FR",
"postalCode": "75005"
}
},
"amount": "778.39",
"currency": "EUR",
"state": "pending_redirect",
"creationIp": "209.87.178.4",
"createdTime": "2019-05-22T01:48:42.168Z",
"updatedTime": "2019-05-22T01:48:42.168Z",
"flow": "redirect",
"redirect": {
"redirectUrl": "https://api.digitalriver.com:443/payments/redirects/4e478578-843a-48a5-beef-66c0dae99f5d?apiKey=pk_test_6cb0fe9ce3124093a9ad906f6c589e2d",
"returnUrl": "https://example.com?action=paymentSuccess"
},
"direct-debit": {}
}
When you create a SEPA Direct Debit source, the customer is required to authorize the charge through their payment provider. You can accomplish this by redirecting the customer to their payment provider.
To redirect your customer for authorization, use the
redirectUrl
parameter in your createSource
response.HTML
window.location.href = sourceResponse.redirect.redirectUrl;
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 SEPA Direct Debit Return URL parameter you specified when you created the source.
POST /v1/shoppers/me/carts/active/apply-payment-method
{
"paymentMethod": {
"sourceId": "e7ba0595-059c-460c-bad8-2812123b9313"
}
}
POST /v1/shoppers/me/payment-options
{
"paymentOption": {
"nickName": "My Token",
"isDefault": "true",
"sourceId": "61033d62-c0f4-4a7e-b844-07daf26ba84e"
}
}
Last modified 1mo ago