SEPA Direct Debit
Client-Side Implementation
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.
Set up your iOS Client
Get the SDK
Cocoapods
Include Braintree/SEPADirectDebit
in your Podfile:
- Ruby
# Podfile
pod 'Braintree/SEPADirectDebit'
Swift Package Manager
Include the BraintreeSEPADirectDebit
framework.
Carthage
Include the BraintreeCore
and BraintreeSEPADirectDebit
frameworks.
Collect information
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 flow
Construct a BTSEPADirectDebitClient
and a BTSEPADirectDebitRequest
. Call BTSEPADirectDebitClient.tokenize(request:context:completion:)
to launch the SEPA Direct Debit flow. This method will create a mandate, display the mandate to the user, and tokenize the payment method.
Your ViewController
needs to conform to the ASWebAuthenticationPresentationContextProviding
protocol.
- Swift
class ExampleViewController: UIViewController, ASWebAuthenticationPresentationContextProviding {
var client: BTAPIClient!
var sepaDebitClient: BTSEPADirectDebitClient!
override func viewDidLoad() {
super.viewDidLoad()
self.client = BTAPIClient(authorization: "<#CLIENT_AUTHORIZATION#>")
self.sepaDirectDebitClient = BTSEPADirectDebitClient(apiClient: self.client)
}
func presentationAnchor(for session: ASWebAuthenticationSession) -> ASPresentationAnchor {
let window = UIApplication.shared.windows.first { $0.isKeyWindow }
return window ?? ASPresentationAnchor()
}
func sepaDirectDebitButtonTapped() {
let billingAddress = BTPostalAddress()
billingAddress.recipientName = "John Doe"
billingAddress.streetAddress = "123 Main St"
billingAddress.countryCodeAlpha2 = "NL"
billingAddress.locality = "Amsterdam"
billingAddress.postalCode = "1072 AE"
let sepaDirectDebitRequest = = BTSEPADirectDebitRequest()
sepaDirectDebitRequest.accountHolderName = "John Doe"
sepaDirectDebitRequest.customerId = "1234"
sepaDirectDebitRequest.iban = "FR7618106000321234566666608"
sepaDirectDebitRequest.mandateType = .oneOff
sepaDirectDebitRequest.address = billingAddress
sepaDirectDebitClient.tokenize(request: sepaDirectDebitRequest, context: self) { sepaDirectDebitNonce, error in
if let sepaDirectDebitNonce = sepaDirectDebitNonce {
// send sepaDirectDebitNonce.nonce to server
} else if let error = error {
// handle error
} else {
// handle cancel
}
}
}
}