Declare a payment mandate for Internal Direct Debit
Before accepting payments with Internal Direct Debit B2B or Standard, you need to declare a payment mandate to your Swan account. Each debtor must have their own payment mandate.
Review the requirements for Internal Direct Debit payment mandates if needed.
Prerequisites
- Debtor's account status: any except
Closing
orClosed
- Merchant profile status:
Enabled
- Internal Direct Debit B2B payment method status:
Enabled
- Debtor and merchant have accounts in the same Swan projects
- [B2B only] Debtor's account type:
Company
Declare a payment mandate​
- Confirm you have a project access token or, if you're an account member, a user access token with
CanManageAccountMembership
permissions, and confirm the prerequisites are met. - Call the
addInternalDirectDebitPaymentMandate
mutation. The debtor is required to consent. - Replace
$YOUR_DEBTOR_ACCOUNT_ID
and$YOUR_PAYMENT_METHOD_ID
with IDs from your project (lines 4, 5). - Choose either Standard or B2B in your mandate name (line 6).
- Choose
Recurrent
orOneOff
.OneOff
payment mandates can only be used once.
- Add validations and rejections that are helpful for you, as well as optional information such as a
reference
for your internal use. - The payment mandate is created with the status
Enabled
.
B2B versus standard
For Standard, merchants can start using the payment method to accept payments immediately.
For B2B, add the received mandate first.
Mutation​
🔎 Open the mutation in API Explorer
mutation AddPaymentMandate {
addInternalDirectDebitPaymentMandate(
input: {
paymentMethodId: "$YOUR_PAYMENT_METHOD_ID"
debtorAccountId: "$YOUR_DEBTOR_ACCOUNT_ID"
name: "Standard/B2B Internal Direct Debit Mandate"
sequence: Recurrent
}
) {
... on InternalErrorRejection {
__typename
message
}
... on PaymentMandateReferenceAlreadyUsedRejection {
__typename
message
}
... on SchemeWrongRejection {
__typename
message
}
... on DebtorAccountClosedRejection {
__typename
message
}
... on DebtorAccountNotAllowedRejection {
__typename
message
}
... on NotFoundRejection {
id
message
}
... on ForbiddenRejection {
__typename
message
}
... on AddInternalDirectDebitPaymentMandateSuccessPayload {
__typename
paymentMandate {
id
}
}
}
}
Payload​
Note the id
(line 6) for your Internal Direct Debit payment mandate.
{
"data": {
"addInternalDirectDebitPaymentMandate": {
"__typename": "AddInternalDirectDebitPaymentMandateSuccessPayload",
"paymentMandate": {
"id": "$YOUR_MANDATE_ID"
}
}
}
}
B2B only: Add received mandate​
For Internal Direct Debit B2B only, call the addReceivedInternalDirectDebitB2bMandate
mutation to declare the received payment mandate.
Prerequisites
- Only account members with the permission
canInitiatePayments
can declare mandates. - Make sure to execute the mutation on the debtor's account.
Mutation​
- Add the
id
recovered in the previous payload. - Add your
consentUrl
. - Call the
addReceivedInternalDirectDebitB2bMandate
mutation.
🔎 Open the mutation in API Explorer
mutation AddReceivedInternalDirectDebitB2bMandate {
addReceivedInternalDirectDebitB2bMandate(
input: {
paymentMandateId: "$YOUR_MANDATE_ID"
consentRedirectUrl: "$YOUR_CONSENT_URL"
}
) {
... on AddReceivedInternalDirectDebitB2bMandateSuccessPayload {
__typename
receivedDirectDebitMandate {
id
statusInfo {
... on ReceivedDirectDebitMandateStatusInfoConsentPending {
__typename
consent {
consentUrl
}
}
}
}
}
}
}
Payload​
Note the id
for the received mandate (line 6), and its status (line 8.)
{
"data": {
"addReceivedInternalDirectDebitB2bMandate": {
"__typename": "AddReceivedInternalDirectDebitB2bMandateSuccessPayload",
"receivedDirectDebitMandate": {
"id": "$RECIEVED_MANDATE_ID",
"statusInfo": {
"__typename": "ReceivedDirectDebitMandateStatusInfoConsentPending",
"consent": {
"consentUrl": "$YOUR_CONSENT_URL"
}
}
}
}
}
}