Add a trusted international beneficiary
Add a trusted beneficiary with the API for International Credit Transfers.
Add a trusted beneficiary​
Prerequisites
Get the list of required key/value pairs for your beneficiary. They're based on the target currency and the beneficiary's country of residence.
- Call the
addTrustedInternationalBeneficiary
mutation. - Add the Swan
accountId
(line 4). The trusted beneficiary is linked to this account. - Add your trusted beneficiary's name (line 6).
- Add the
route
(line 7). - Add all beneficiary key/value pairs you retrieved for the prerequisite (lines 10-18).
- Add the
AddTrustedInternationalBeneficiarySuccessPayload
success payload. Consider adding thetrustedBeneficiary
>id
to the payload (lines 24-25). - Add rejections (not shown).
Mutation​
🔎 Open the mutation in API Explorer
mutation AddBeneficiary {
addTrustedInternationalBeneficiary(
input: {
accountId: "$ACCOUNT_ID"
currency: "USD"
name: "$TRUSTED_BENEFICIARY_NAME"
route: FedwireLocal
consentRedirectUrl: "$REDIRECT_URL"
details: [
{ key: "legalType", value: "PRIVATE" }
{ key: "abartn", value: "$FEDWIRE_ROUTING_NUMBER" }
{ key: "accountNumber", value: "$ACCOUNT_NUMBER" }
{ key: "accountType", value: "CHECKING" }
{ key: "address.country", value: "US" }
{ key: "address.city", value: "Utica" }
{ key: "address.firstLine", value: "1 Canoga Blvd" }
{ key: "address.state", value: "NY" }
{ key: "address.postCode", value: "13505" }
]
}
) {
... on AddTrustedInternationalBeneficiarySuccessPayload {
__typename
trustedBeneficiary {
id
}
}
}
}
Payload​
Notice your new trusted beneficiary's ID is returned in the success payload (line 6).
{
"data": {
"addTrustedInternationalBeneficiary": {
"__typename": "AddTrustedInternationalBeneficiarySuccessPayload",
"trustedBeneficiary": {
"id": "$TRUSTED_BENEFICIARY_ID"
}
}
}
}
Save a beneficiary when initiating a transfer​
Prerequisites
- Optionally, get a quote.
- This query provides a quote for the exchange rate and fees.
- The quote isn't guaranteed.
- Next, get the list of required key/value pairs for your beneficiary.
- They're based on the target currency and the beneficiary's country of residence.
- Then, get the list of required key/value pairs for your transaction.
- They're based on the transfer's destination.
- Call the
initiateInternationalCreditTransfer
mutation. - Add the Swan
accountId
(line 4). The trusted beneficiary is linked to this account. - Add all beneficiary and transaction details key/value pairs you retrieved for the prerequisites (lines 5-17, 22-24).
- Add the
route
(line 19). - Choose
true
for the booleansave
(line 20). - Add the
InitiateInternationalCreditTransferResponseSuccessPayload
success payload with the consent URL (line 41). - Add rejections (not shown).
Mutation​
🔎 Open the mutation in API Explorer
mutation SaveBeneficiary {
initiateInternationalCreditTransfer(
input: {
accountId: "$ACCOUNT_ID"
internationalBeneficiary: {
name: "$TRUSTED_BENEFICIARY_NAME"
currency: "USD"
details: [
{ key: "legalType", value: "PRIVATE" }
{ key: "abartn", value: "$FEDWIRE_ROUTING_NUMBER" }
{ key: "accountNumber", value: "$ACCOUNT_NUMBER" }
{ key: "accountType", value: "CHECKING" }
{ key: "address.country", value: "US" }
{ key: "address.city", value: "Utica" }
{ key: "address.firstLine", value: "1 Canoga Blvd" }
{ key: "address.state", value: "NY" }
{ key: "address.postCode", value: "13505" }
]
route: FedwireLocal
save: true
}
internationalCreditTransferDetails: {
key: "reference"
value: "Your reference message"
}
targetAmount: { value: "500", currency: "USD" }
consentRedirectUrl: "$REDIRECT_URL"
}
) {
... on InitiateInternationalCreditTransferResponseSuccessPayload {
__typename
payment {
createdAt
id
statusInfo {
status
... on PaymentConsentPending {
__typename
status
consent {
consentUrl
}
}
}
}
}
}
}
Payload​
The payload is a typical initiation payload. There's no additional information available about the new trusted beneficiary.
{
"data": {
"initiateInternationalCreditTransfer": {
"__typename": "InitiateInternationalCreditTransferResponseSuccessPayload",
"payment": {
"id": "$PAYMENT_ID",
"statusInfo": {
"status": "ConsentPending",
"__typename": "PaymentConsentPending",
"consent": {
"consentUrl": "https://identity.swan.io/consent?consentId=$CONSENT_ID&env=Sandbox"
}
}
}
}
}
}