Print physical cards
Learn how to print physical cards with the API.
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.
Print a physical card​
- Confirm the account member has the correct account membership permissions to manage cards and, if needed, account memberships.
- Add a virtual card before printing a physical card with the
printPhysicalCard
mutation.
- Call the
printPhysicalCard
mutation. - Add the virtual card's
cardId
for which you're printing a physical card (line 4). - Add the delivery address for the physical card, and the redirect URL.
- Allow the cardholder to choose their own PIN by setting the
choosePin
paramater totrue
(line 12). - Add the success payload, including any information you'd like to review (line 15).
- Add the consent URL to the success payload (line 22):
physicalCard
>statusInfo
>PhysicalCardConsentPendingStatusInfo
>consent
>consentUrl
. - Add rejections (not shown).
Mutation​
🔎 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
}
}
}
}
}
}
}
Payload​
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"
}
}
}
}
}
}
Print a physical card when adding a virtual card​
- Confirm the account member has the correct account membership permissions to manage cards and, if needed, account memberships.
- Call the
addCards
mutation. - Add the
accountMembershipId
(line 4). - Choose card settings and set the spending limit (lines 6-12).
- 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. - Allow the cardholder to choose their own PIN by setting the
choosePin
paramater totrue
(line 21). - Add the consent redirect URL.
- Add the success payload, including any information you'd like to review (line 27).
- Add the consent URL to the success payload (line 22):
statusInfo
>PhysicalCardConsentPendingStatusInfo
>consent
>consentUrl
. - Add rejections (not shown).
Mutation​
🔎 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
}
}
}
}
Payload​
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"
}
]
}
}
}
Print multiple physical cards with group delivery​
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.
Confirm the account member printing the cards has the correct account membership permissions to manage cards and account memberships.
- Call the
addCardsWithGroupDelivery
mutation. - Add the address and contact person for the group delivery (lines 4-11).
- Add the consent redirect URL.
- Add a
card
block for each card you'd like to print (example: lines 15-27).- Add the
accountMembershipId
(line 16). - Choose card settings and set the spending limit (lines 17-21).
- Set the
printPhysicalCard
paramater totrue
(line 25).
- Add the
- Add the success payload, including any information you'd like to review (line 57).
- 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. - Add rejections (not shown).
Mutation​
🔎 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
}
}
}
}
}
}
}
Payload​
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"
}
}
}
]
}
}
}
Add an additional line​
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.
Mutation | Object |
---|---|
addCards | physicalCard > physicalCardCustomOptions > additionalPrintedLine |
addCardsWithGroupDelivery | cards > physicalCardCustomOptions > additionalPrintedLine |
printPhysicalCard | input > physicalCardCustomOptions > additionalPrintedLine |
Use number plates instead of names​
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.
Mutation | Object |
---|---|
addCards | physicalCard > physicalCardCustomOptions > customCardHolderName |
addCardsWithGroupDelivery | cards > physicalCardCustomOptions > customCardHolderName |
printPhysicalCard | input > physicalCardCustomOptions > customCardHolderName |
Get delivery information​
After consent is received, retrieve delivery information with the API.
- Call the
card
query. - Add the
cardId
. - 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
}
}
}
}
}