Links
Comment on page

Make transactions

Having branded accounts is great but you'll want them to serve their purpose, too! Users will want to be able to make payments and receive money. Here's how to make that happen.

Simulate a credit (SCT-IN)

Crediting an account in live environment is easy. You just need to use your account's IBAN and make a transfer from another bank. Once Swan receives the money we will instantly credit your account and the money will be available. The only type of transfer we currently accept is through the SEPA network.
In sandbox, the Event Simulator lets you credit an account using a fake IBAN: Event Simulator > SEPA Credit Transfers > Receive an incoming transfer. Select the desired amount and it will be instantly credited to the account of your choice.
A new payment associated with the account is created, along with one transactionwith SepaCreditTransferIn type. The payment is instantly available through the web banking interface or the API.
Event simulator for SEPA Credit Transfer

Get transactions

Connect to the web banking to see all transactions for a given account. The web banking displays SEPA transactions, card payments, and any other money credited or debited to the account.
The web banking displays all transactions for a given account
The query below lets you access the same information through the API. Just replace {{YOUR_ACCOUNT_ID}} with your account id.
Request
Response
query MyQuery {
account(accountId: "{{YOUR_ACCOUNT_ID}}") {
balances {
available {
currency
value
}
}
transactions {
edges {
node {
amount {
value
currency
}
id
type
label
createdAt
reference
side
statusInfo {
status
}
updatedAt
}
}
}
}
}
{
"data": {
"account": {
"balances": {
"available": {
"currency": "EUR",
"value": "1000.00"
}
},
"transactions": {
"edges": [
{
"node": {
"amount": {
"value": "1000.00",
"currency": "EUR"
},
"id": "{{YOUR_TRANSACTION_ID}}",
"type": "SepaCreditTransferIn",
"label": "Payment for invoice",
"createdAt": "2021-09-20T12:52:37.590Z",
"reference": "Invoice123",
"side": "Credit",
"statusInfo": {
"status": "Booked"
},
"updatedAt": "2021-09-20T12:52:38.913Z"
}
}
]
}
}
}
}

Get transaction information

You can use the transaction query to get information regarding a single transaction, or the transactions query to get information regarding multiple transactions at once.
For example, use the transactions query to expose the full IBAN and BIC associated with the transactions. You'll need either a project access token, or a user access token with canViewAccount permissions.
Expose full IBANs and BICs with a transactions query
1
query Transactions {
2
transactions(
3
filters: { paymentProduct: [SEPACreditTransfer, SEPADirectDebit] }
4
) {
5
edges {
6
node {
7
... on SEPACreditTransferTransaction {
8
id
9
creditor {
10
BIC
11
IBAN
12
maskedIBAN
13
}
14
debtor {
15
BIC
16
IBAN
17
maskedIBAN
18
}
19
}
20
... on SEPADirectDebitTransaction {
21
id
22
creditor {
23
BIC
24
IBAN
25
maskedIBAN
26
}
27
debtor {
28
BIC
29
IBAN
30
maskedIBAN
31
}
32
}
33
}
34
}
35
}
36
}
Return
1
{
2
"data": {
3
"transactions": {
4
"edges": [
5
{
6
"node": {
7
"id": "bosco_2009570293c54c6ada85a4a49a79bfb6",
8
"creditor": {
9
"BIC": "BOUSFRPPXXX",
10
"IBAN": "FR4417569000308838598224X53",
11
"maskedIBAN": "FR4417569000308838******X53"
12
}
13
}
14
}
15
]
16
}
17
}
18
}

Initiate a debit

Both the web banking and API let you send money to another account. From the web banking, just fill out the form in the Payments tab.
Making a payment on the web banking
Making a payment is a sensitive operation. We always ask for the end-user to confirm the operation with a 2 factor authentication (2FA) process. At the end of the form, we create a consent for the user that they validate using their smartphone.
To make a payment via the API, use the initiateCreditTransfers mutation. The API lets you make one payment with multiple transaction to differents accounts at the same time. To call this mutation, you need to use a User Access Token. We will ask the user to consent to the payment . There is only one consent per payment, regardless of the number of transactions linked to the payment. Replace {{YOUR_ACCOUNT_NUMBER}} with the account number from which you want to initiate the payment and fill {{YOUR_REDIRECT_URL}}with the URL you want to redirect the user to.
Request
Reponse
mutation MyMutation {
initiateCreditTransfers(
input: {
consentRedirectUrl: "{{YOUR_REDIRECT_URL}}"
accountId: "{{YOUR_ACCOUNT_ID}}"
creditTransfers: [
{
amount: { value: "100", currency: "EUR" }
label: "{{YOUR_LABEL}}"
reference: "{{YOUR_REFERENCE}}"
sepaBeneficiary: {
iban: "{{YOUR_IBAN_BENEFICIARY}}"
name: "{{YOUR_CREDITOR_NAME}}"
isMyOwnIban: false
save: false
}
},
{
amount: { value: "53", currency: "EUR" }
label: "{{YOUR_LABEL}}"
reference: "{{YOUR_REFERENCE}}"
sepaBeneficiary: {
iban: "{{YOUR_IBAN_BENEFICIARY}}"
name: "{{YOUR_CREDITOR_NAME}}"
isMyOwnIban: false
save: false
}
}
]
}
) {
... on InitiateCreditTransfersSuccessPayload {
__typename
payment {
createdAt
id
statusInfo {
... on PaymentConsentPending {
__typename
consent {
consentUrl
}
}
}
}
}
... on AccountNotFoundRejection {
id
message
}
... on ForbiddenRejection {
__typename
message
}
}
}
{
"data": {
"initiateCreditTransfers": {
"__typename": "InitiateCreditTransfersSuccessPayload",
"payment": {
"createdAt": "2022-08-18T10:25:12.107648Z[GMT]",
"id": "{{YOUR_PAYMENT_ID}}",
"statusInfo": {
"__typename": "PaymentConsentPending",
"consent": {
"consentUrl": "{{YOUR_CONSENT_URL}}"
}
}
}
}
}
}
If you execute this request you will have to open the consentUrl. Once the consent is done you'll find the payment and the two associated transactions in the API.

Refund a credit

If someone transferred money to one of your accounts by mistake, you can reimburse them by using the refund mutation. Just enter the amount you want to refund. This creates a new transaction linked to the same payment.
To refund a credit, replace {{YOUR_TRANSACTION_ID}} with the transaction ID you want to refund and {{YOUR_REDIRECT_URL}} with the URL you want to redirect the user to.
It is possible to handle multiple transactions at once if all transactions belong to the same account. If you want to handle multiple transactions from multiple accounts, please make sure to send one refund mutation per account.
Request
Response
mutation MyMutation {
refund(
input: {
refundTransactions: [
{
originTransactionId: "{{YOUR_TRANSACTION_ID}}"
amount: { value: "10", currency: "EUR" }
}
]
consentRedirectUrl: "{{YOUR_REDIRECT_URL}}"
}
) {
... on RefundSuccessPayload {
__typename
consent {
id
consentUrl
}
}
... on RefundRejection {
__typename
code
message
}
}
}
{
"data": {
"refund": {
"__typename": "RefundSuccessPayload",
"consent": {
"id": "{{YOUR_TRANSACTION_ID}}",
"consentUrl": "{{YOUR_CONSENT_URL}}"
}
}
}
}

Standing order

A standing order is a recurring payment that you configure just one time. Consent is only required during set up. After that, Swan automatically executes the payments on a regular basis, based on your configuration. There are two types of Standing Orders that behave differently.
To set up a recurring check to transfer all funds above a target amount (Swan will execute a transaction only when necessary), use targetAvailableBalance .
To set up a "classic" recurring payment with a fixed amount, use amount. Swan will make a recurring payment at the interval you set. If there is not enough money it will be refused for InsufficientFunds
To create a Standing Order use the scheduleStandingOrder mutation. Replace {{YOUR_ACCOUNT_ID}} and {{YOUR_REDIRECT_URL}} with the URL you want to redirect the user to.
Request : Fixed amount
Request : Target balance
mutation MyMutation {
scheduleStandingOrder(
input: {
period: Daily
accountId: "{{YOUR_ACCOUNT_ID}}"
consentRedirectUrl: "{{YOUR_REDIRECT_URL}}"
amount: { value: "10", currency: "EUR" }
label: "Recurring label"
firstExecutionDate: "2021-09-21T"
lastExecutionDate: "2022-01-01T"
sepaBeneficiary: {
iban: "{{YOUR_BENEFICIARY_IBAN}}"
name: "ACME Company"
isMyOwnIban: false
save: false
}
reference: "Reference"
}
) {
... on ScheduleStandingOrderSuccessPayload {
__typename
standingOrder {
statusInfo {
status
... on StandingOrderConsentPendingStatusInfo {
__typename
consent {
consentUrl
}
}
}
id
}
}
... on ForbiddenRejection {
__typename
message
}
... on InternalErrorRejection {
__typename
message
}
... on InvalidArgumentRejection {
__typename
code
message
}
}
}
mutation MyMutation {
scheduleStandingOrder(
input: {
period: Daily
accountId: "{{YOUR_ACCOUNT_ID}}"
consentRedirectUrl: "{{YOUR_REDIRECT_URL}}"
label: "Recurring label"
firstExecutionDate: "2021-09-21T"
lastExecutionDate: "2022-01-01T"
sepaBeneficiary: {
iban: "{{YOUR_BENEFICIARY_IBAN}}"
name: "ACME Company"
isMyOwnIban: false
save: false
}
reference: "Reference"
targetAvailableBalance: { currency: "EUR", value: "100" }
}
) {
... on ScheduleStandingOrderSuccessPayload {
__typename
standingOrder {
statusInfo {
status
... on StandingOrderConsentPendingStatusInfo {
__typename
consent {
consentUrl
}
}
}
id
}
}
... on ForbiddenRejection {
__typename
message
}
... on InternalErrorRejection {
__typename
message
}
... on InvalidArgumentRejection {
__typename
code
message
}
}
}

Next steps

In this guide you use consent for the first time. It will be helpful for you to also consult the documentation on consents and payments.
Or move on to the next guide: How to issue cards.
If the card is not relevant to your project, you could skip ahead to: Add member to an account