SEPA Direct Debit

Client-Side Implementation

Availability

SEPA Direct Debit is available to eligible merchants using a custom client-side integration. It is only available in Android v4.13+, iOS v5.11+, and JavaScript v3 SDK. It's not currently available in Drop-in.

If you meet the criteria, Contact us to enable SEPA Direct Debit in your Sandbox or Production account.

Get the SDKAnchorIcon

Add the following in your app-level build.gradle:

  1. Kotlin
  2. Groovy
dependencies {
    implementation("com.braintreepayments.api:sepa-direct-debit:4.49.1")
}

Collect informationAnchorIcon

Once your component is ready, collect the required bank account information from the customer.

Bank information:

  • accountHolderName (the name of the account owner)
  • iban (International Bank Account Number)

Customer information:

  • billingAddress
  • customerId (customer id in the merchant's system)

Invoking the SEPA Direct Debit flowAnchorIcon

Construct a SEPADirectDebitClient and a SEPADirectDebitRequest. Call SEPADirectDebit#tokenize to launch the SEPA Direct Debit flow. This method will create a mandate, launch a browser to display the mandate to the user, and redirect back to your app to tokenize.

Add a SEPADirectDebitListener to your SEPADirectDebitClient to receive results from the flow. A SEPADirectDebitNonce will be returned to the onSEPADirectDebitSuccess listener method on successful completion of the flow.

  1. Kotlin
  2. Java
class MyActivity : AppCompatActivity(), SEPADirectDebitListener {

    lateinit var braintreeClient: BraintreeClient
    lateinit var sepaDirectDebitClient: SEPADirectDebitClient

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        braintreeClient = BraintreeClient(this, ExampleClientTokenProvider())
        sepaDirectDebitClient = SEPADirectDebitClient(braintreeClient)
        sepaDirectDebitClient.setListener(this)
    }

    private fun startSEPADirectDebit() {
        val billingAddress = PostalAddress()
        billingAddress.recipientName = "John Doe"
        billingAddress.streetAddress = "123 Main St"
        billingAddress.countryCodeAlpha2 = "NL"
        billingAddress.locality = "Amsterdam"
        billingAddress.postalCode = "1072 AE"

        val request = SEPADirectDebitRequest()
        request.accountHolderName = "John Doe"
        request.customerId = "1234"
        request.iban = "FR7618106000321234566666608"
        request.mandateType = SEPADirectDebitMandateType.ONE_OFF
        request.billingAddress = billingAddress

        sepaDirectDebitClient.tokenize(this, request)
    }

    override fun onSEPADirectDebitSuccess(sepaDirectDebitNonce: SEPADirectDebitNonce) {
        // send sepaDirectDebitNonce.string to server and create a transaction
    }

    override fun onSEPADirectDebitFailure(error: Exception) {
        if (error is UserCanceledException) {
            // user canceled
        } else {
            // handle error
        }
    }
}