Skip to main content

Print physical cards

Learn how to print physical cards with the API.

Web Banking & Physical cards

If you use Swan's Web Banking interface, your users can order their own cards if they have the correct account membership permissions. They can also review their card's spending limit. Swan's Support Center provides more information about physical cards help your users.

Prerequisites
  1. Confirm the account member has the correct account membership permissions to manage cards and, if needed, account memberships.
  2. Add a virtual card before printing a physical card with the printPhysicalCard mutation.
  1. Call the printPhysicalCard mutation.
  2. Add the virtual card's cardId for which you're printing a physical card (line 4).
  3. Add the delivery address for the physical card, and the redirect URL.
  4. Allow the cardholder to choose their own PIN by setting the choosePin paramater to true (line 12).
  5. Add the success payload, including any information you'd like to review (line 15).
  6. Add the consent URL to the success payload (line 22): physicalCard > statusInfo > PhysicalCardConsentPendingStatusInfo > consent > consentUrl.
  7. Add rejections (not shown).

🔎 Open the mutation in API Explorer

mutation PrintCard {
printPhysicalCard(
input: {
cardId: "$YOUR_CARD_ID"
address: {
addressLine1: "10 Rue de la Paix"
city: "Paris"
postalCode: "75000"
country: "FRA"
}
consentRedirectUrl: "$YOUR_REDIRECT_URL"
choosePin: true
}
) {
... on PrintPhysicalCardSuccessPayload {
__typename
physicalCard {
statusInfo {
... on PhysicalCardConsentPendingStatusInfo {
__typename
consent {
consentUrl
}
}
}
}
}
}
}

The account member must consent to adding the physical card.

After consent is received, the physical card is created and the card type for both the physical and virtual card concerned by this operation changes to VirtualAndPhysical.

{
"data": {
"printPhysicalCard": {
"__typename": "PrintPhysicalCardSuccessPayload",
"physicalCard": {
"statusInfo": {
"__typename": "PhysicalCardConsentPendingStatusInfo",
"consent": {
"consentUrl": "$YOUR_CONSENT_URL"
}
}
}
}
}
}
Prerequisites
  1. Confirm the account member has the correct account membership permissions to manage cards and, if needed, account memberships.
  1. Call the addCards mutation.
  2. Add the accountMembershipId (line 4).
  3. Choose card settings and set the spending limit (lines 6-12).
  4. Add physicalCard, plus the delivery address (line 14). This paramater allows printing the physical card at the same time as adding the virtual card with the same mutation.
  5. Allow the cardholder to choose their own PIN by setting the choosePin paramater to true (line 21).
  6. Add the consent redirect URL.
  7. Add the success payload, including any information you'd like to review (line 27).
  8. Add the consent URL to the success payload (line 22): statusInfo > PhysicalCardConsentPendingStatusInfo > consent > consentUrl.
  9. Add rejections (not shown).

🔎 Open the mutation in API Explorer

mutation AddVirtualPhysical {
addCards(
input: {
cards: {
accountMembershipId: "$ACCOUNT_MEMBERSHIP_ID"
withdrawal: true
international: true
nonMainCurrencyTransactions: true
eCommerce: true
spendingLimit: {
period: Monthly
amount: { value: "500", currency: "EUR" }
}
physicalCard: {
deliveryAddress: {
addressLine1: "1 rue de la Paix"
city: "Paris"
postalCode: "75000"
country: "FRA"
}
choosePin: true
}
}
consentRedirectUrl: "$REDIRECT_URL"
}
) {
... on AddCardsSuccessPayload {
__typename
cards {
id
statusInfo {
status
... on CardConsentPendingStatusInfo {
__typename
consent {
consentUrl
}
}
}
type
}
}
}
}

The account member must consent to adding the virtual and physical cards.

Notice the API card type (included in the mutation, line 40) is VirtualAndPhysical, which is one benefit of the addCards mutation. There's only one card ID, which is the ID for both the virtual and physical cards.

{
"data": {
"addCards": {
"__typename": "AddCardsSuccessPayload",
"cards": [
{
"id": "$CARD_ID",
"statusInfo": {
"status": "ConsentPending",
"__typename": "CardConsentPendingStatusInfo",
"consent": {
"consentUrl": "https://identity.swan.io/consent?consentId=$CONSENT_ID&env=Sandbox"
}
},
"type": "VirtualAndPhysical"
}
]
}
}
}

To ship a group of cards together to the same address, call the addCardsWithGroupDelivery mutation. It works just like addCards, except all the cards are sent together in one package.

This method is cost-effective and eco-friendly. You can send up to 250 cards in a group delivery.

Prerequisites

Confirm the account member printing the cards has the correct account membership permissions to manage cards and account memberships.

  1. Call the addCardsWithGroupDelivery mutation.
  2. Add the address and contact person for the group delivery (lines 4-11).
  3. Add the consent redirect URL.
  4. Add a card block for each card you'd like to print (example: lines 15-27).
    1. Add the accountMembershipId (line 16).
    2. Choose card settings and set the spending limit (lines 17-21).
    3. Set the printPhysicalCard paramater to true (line 25).
  5. Add the success payload, including any information you'd like to review (line 57).
  6. Add the consent URL to the success payload (line 64): statusInfo > PhysicalCardConsentPendingStatusInfo > consent > consentUrl. There is one consent required for the whole list of added cards by an eligible account member; consent isn't provided per individual card.
  7. Add rejections (not shown).

🔎 Open the mutation in API Explorer

mutation PrintGroup {
addCardsWithGroupDelivery(
input: {
groupDeliveryAddress: {
addressLine1: "An der Kirche 6"
city: "Berlin"
postalCode: "95356"
country: "DEU"
firstName: "Rae"
lastName: "Schmidt"
phoneNumber: "49 55 1234 5678"
}
consentRedirectUrl: "$REDIRECT_URL"
cards: [
{
accountMembershipId: "$ACCOUNT_MEMBERSHIP_ID"
withdrawal: true
international: true
nonMainCurrencyTransactions: true
eCommerce: true
spendingLimit: {
period: Monthly
amount: { value: "500", currency: "EUR" }
}
printPhysicalCard: true
name: "Catharijne Janssen"
}
{
accountMembershipId: "$ACCOUNT_MEMBERSHIP_ID"
withdrawal: true
international: true
nonMainCurrencyTransactions: true
eCommerce: true
spendingLimit: {
period: Monthly
amount: { value: "250", currency: "EUR" }
}
printPhysicalCard: true
name: "Alberto Moreno"
}
{
accountMembershipId: "$ACCOUNT_MEMBERSHIP_ID"
withdrawal: true
international: true
nonMainCurrencyTransactions: true
eCommerce: true
spendingLimit: {
period: Monthly
amount: { value: "200", currency: "EUR" }
}
printPhysicalCard: true
name: "Mika Haugen"
}
]
}
) {
... on AddCardsWithGroupDeliverySuccessPayload {
__typename
cards {
statusInfo {
... on CardConsentPendingStatusInfo {
__typename
consent {
consentUrl
}
}
}
}
}
}
}

The account member must consent to adding the cards. After consent is received, the physical cards are created.

{
"data": {
"addCardsWithGroupDelivery": {
"__typename": "AddCardsWithGroupDeliverySuccessPayload",
"cards": [
{
"statusInfo": {
"__typename": "CardConsentPendingStatusInfo",
"consent": {
"consentUrl": "$CONSENT_URL_FOR_ALL_CARDS"
}
}
},
{
"statusInfo": {
"__typename": "CardConsentPendingStatusInfo",
"consent": {
"consentUrl": "$CONSENT_URL_FOR_ALL_CARDS"
}
}
},
{
"statusInfo": {
"__typename": "CardConsentPendingStatusInfo",
"consent": {
"consentUrl": "$CONSENT_URL_FOR_ALL_CARDS"
}
}
}
]
}
}
}

You can add an additional line of text to your physical cards with all of the mutations outlined on this page. For example, you might want to print your company name.

MutationObject
addCardsphysicalCard > physicalCardCustomOptions > additionalPrintedLine
addCardsWithGroupDeliverycards > physicalCardCustomOptions > additionalPrintedLine
printPhysicalCardinput > physicalCardCustomOptions > additionalPrintedLine

If approved by your Technical Account Manager, you can use number plates instead of names for your physical cards with all of the mutations outlined on this page.

MutationObject
addCardsphysicalCard > physicalCardCustomOptions > customCardHolderName
addCardsWithGroupDeliverycards > physicalCardCustomOptions > customCardHolderName
printPhysicalCardinput > physicalCardCustomOptions > customCardHolderName

Get delivery information​

After consent is received, retrieve delivery information with the API.

  1. Call the card query.
  2. Add the cardId.
  3. To get delivery details, add physicalCard > statusInfo > PhysicalCardToActivateStatusInfo, then all information you'd like to retrieve. Refer to Swan's card delivery times for more information.

🔎 Open the query in API Explorer

query DeliveryInfo {
card(cardId: "$CARD_ID") {
physicalCard {
statusInfo {
... on PhysicalCardToActivateStatusInfo {
estimatedDeliveryDate
trackingNumber
isPINReady
shippingProvider
status
}
}
}
}
}