Add a funding source
Add a funding source with the API.
Adding a funding source is a sensitive operation, so you must call the mutation with a user access token associated with the account holder who will sign the direct debit mandate (the debtor). They must consent to the operation.
Account members with canManageAccountMembership
and canViewAccount
permissions can add funding sources, in addition to the account holder.
However, the non-Swan account must belong to the Swan account holder.
Guide​
- Call the
addDirectDebitFundingSource
mutation. - Choose the
SepaDirectDebitB2b
scheme. ThoughCore
is an option in the API, it's not actually available for account funding. - Add your
accountId
,iban
,consentRedirectUrl
, and aname
for your funding source (name is primarily for your reference). - Add the
AddDirectDebitFundingSourceSuccessPayload
success payload. - Add the consent URL to the success payload:
fundingSource
>DirectDebitFundingSource
>paymentMandate
>SEPAPaymentDirectDebitMandate
>statusInfo
>PaymentMandateConsentPendingStatusInfo
>consent
>consentUrl
- Add rejections (not shown).
Mutation​
🔎 Open the mutation in API Explorer
mutation AddSddB2b {
addDirectDebitFundingSource(
input: {
scheme: SepaDirectDebitB2b
accountId: "$YOUR_ACCOUNT_ID"
iban: "$YOUR_IBAN"
consentRedirectUrl: "$YOUR_REDIRECT_URL"
name: "$YOUR_FUNDING_SOURCE_NAME"
}
) {
... on AddDirectDebitFundingSourceSuccessPayload {
__typename
fundingSource {
... on DirectDebitFundingSource {
id
name
paymentMandate {
... on SEPAPaymentDirectDebitMandate {
id
name
statusInfo {
... on PaymentMandateConsentPendingStatusInfo {
__typename
consent {
consentUrl
}
}
}
}
}
}
}
}
}
}
Payload​
Share the consentUrl (line 14) with your Swan account holder so they can consent to the operation.
After they consent to the payment mandate, the statuses for both the funding source and the direct debit mandate change to Enabled
and you can pull money to fund the Swan account.
Note you also receive a funding source ID (line 6) and a payment mandate ID (line 9).
{
"data": {
"addDirectDebitFundingSource": {
"__typename": "AddDirectDebitFundingSourceSuccessPayload",
"fundingSource": {
"id": "$YOUR_FUNDING_SOURCE_ID",
"name": "Awesome Funding Source Name",
"paymentMandate": {
"id": "$YOUR_PAYMENT_MANDATE_ID",
"name": null,
"statusInfo": {
"__typename": "PaymentMandateConsentPendingStatusInfo",
"consent": {
"consentUrl": "https://identity.swan.io/consent?consentId=$CONSENT_ID&env=Sandbox"
}
}
}
}
}
}
}