Links

SDD B2B

SDD B2B (Business To Business) can only be used to debit accounts owned by legal persons. The SEPA direct debit mandate is signed by the debtor. The mandate information or the mandate itself must be provided/confirmed by the debtor to their bank. Mandate information is embedded in every SEPA direct debit instruction sent by the creditor bank to the debtor bank, and the debtor bank must verify the validity of the instruction against the mandate or mandate information received from the debtor. The debtor is not entitled to obtain any refunds of an authorized collection.

Add a funding source

To add a direct debit funding source via the API, use the addDirectDebitFundingSource mutation. To call this mutation, you need to use a User Access Token. Replace {{YOUR_ACCOUNT_ID}} with the concerned account ID and fill {{YOUR_REDIRECT_URL}}with the URL to which you want the user to be redirected after consenting to the direct debit payment mandate. In this guide, the FundingSource is an external account and we will use the SEPA Direct Debit B2B scheme to pull money from it. For more information about SEPA Direct Debit, read the documentation here.
Request
Response
mutation MyMutation {
addDirectDebitFundingSource(
input: {
scheme: SepaDirectDebitB2b
accountId: "{{YOUR_ACCOUNT_ID}}"
iban: "{{YOUR_IBAN}}"
consentRedirectUrl: "{{YOUR_REDIRECT_URL}}"
name: "{{YOUR_FUNDING_SOURCE_NAME}}"
}
) {
... on AddDirectDebitFundingSourceSuccessPayload {
__typename
fundingSource {
id
name
createdAt
... on DirectDebitFundingSource {
paymentMandate {
... on SEPAPaymentDirectDebitMandate {
statusInfo {
... on PaymentMandateConsentPendingStatusInfo {
__typename
consent {
consentUrl
}
}
}
mandateDocumentUrl
}
}
}
}
}
}
}
{
"data": {
"addDirectDebitFundingSource": {
"__typename": "AddDirectDebitFundingSourceSuccessPayload",
"fundingSource": {
"createdAt": "2022-07-04T09:10:23.472Z",
"id": "{{YOUR_FUNDING_SOURCE_ID}}",
"name": null,
"statusInfo": {
"status": "Pending"
},
"paymentMandate": {
"id": "{{YOUR_PAYMENT_MANDATE_ID}}",
"statusInfo": {
"status": "ConsentPending",
"__typename": "PaymentMandateConsentPendingStatusInfo",
"consent": {
"consentUrl": "{{YOUR_CONSENT_URL}}"
}
},
"mandateDocumentUrl": "{{YOUR_MANDATE_DOCUMENT_URL}}"
}
}
}
}
}
To validate the funding source, you will need to:
  • Ask the user to consent to the payment mandate. To do so, you must display the consentUrl to the end-user. Once the payment mandate is consented, it will be moved from the ConsentPending to the Enabled status.
This mandate must be provided to the other bank.
To get the mandate and the funding source status, you can use the following query.
Request
Response
query MyQuery {
fundingSource(id: "{{YOUR_FUNDING_SOURCE_ID}}") {
id
statusInfo {
status
}
name
createdAt
... on DirectDebitFundingSource {
id
name
iban
paymentMandate {
... on SEPAPaymentDirectDebitMandate {
id
mandateDocumentUrl
}
}
statusInfo {
status
}
}
}
}
{
"data": {
"fundingSource": {
"id": "{{YOUR_FUNDING_SOURCE_ID}}",
"statusInfo": {
"status": "Enabled"
},
"name": "{{YOUR_FUNDING_SOURCE_NAME}}",
"createdAt": "{{YOUR_CREATE_AT_DATE}}",
"iban": "{{YOUR_IBAN}}",
"paymentMandate": {
"id": "{{YOUR_PAYMENT_ID}}",
"mandateDocumentUrl": "{{YOUR_MANDATE_DOCUMENT_URL}}"
}
}
}
}

Initiating a funding request

To pull money from the external account onto the concerned Swan account, you must use the initiateFundingRequest mutation. To call this mutation, you need to use a User Access Token. Replace {{YOUR_FUNDING_SOURCE_ID}} with the funding source ID which has been previously created.
Request
Response
mutation MyMutation {
initiateFundingRequest(
input: {
fundingSourceId: "{{YOUR_FUNDING_SOURCE_ID}}"
amount: { value: "100", currency: "EUR" }
consentRedirectUrl: "{{YOUR_CONSENT_REDIRECT_URL}}"
}
) {
... on InitiateFundingRequestSuccessPayload {
__typename
payment {
statusInfo {
... on PaymentConsentPending {
__typename
consent {
consentUrl
}
}
}
}
}
}
}
{
"data": {
"initiateFundingRequest": {
"__typename": "InitiateFundingRequestSuccessPayload",
"payment": {
"statusInfo": {
"__typename": "PaymentConsentPending",
"consent": {
"consentUrl": "{{YOUR_CONSENT_URL}}"
}
}
}
}
}
}
A transaction with the SepaDirectDebitIn type is created in the Upcoming status.
The transaction is moved to the Booked status maximum 2 inter-bank business days following the funding request initiation, and the money will go into the balance.reserved of the concerned account. Learn more about the Account Funding Rolling Reserve.
It is possible to cancel SDD-In transaction using the cancelTransaction API mutation in the Upcoming status. Learn more here.