Skip to main content

Audience:

Developers

Add digital cards

Learn how cardholders can add your card to Apple Wallet and Google Wallet.

Provisioning guide

A complete provisioning guide can't be published on this site due to privacy policies from Google and Apple. Swan will provide one after you've certified your digital card integration.

Add a digital card

Manual provisioning

Cardholders can also go digital by entering their card numbers directly into Apple Wallet or Google Wallet. If they start manual provisioning but don't complete it, you can help them transition to in-app provisioning.

  1. Call the addDigitalCard mutation. When you call the mutation, make sure you're authenticated with a user access token using the name of the card's account member.
  2. Make sure to choose the walletProvider that corresponds to the cardholder's mobile device.
  3. The mutation returns a consent with a consentUrl, inviting the user to start Strong Customer Authentication with the Swan app.
  4. Then the Swan app proposes adding the card to Apple Wallet or Google Wallet depending on the brand of the account member's mobile device.

Mutation

Open in API Explorer
mutation DigitalApplePay {
addDigitalCard(
input: {
cardId: "$YOUR_CARD_ID"
walletProvider: ApplePay
consentRedirectUrl: "$YOUR_REDIRECT_URL"
}
) {
... on AddDigitalCardSuccessPayload {
__typename
digitalCard {
id
statusInfo {
... on DigitalCardConsentPendingStatusInfo {
__typename
consent {
consentUrl
}
}
}
}
}
}
}

Payload

{
"data": {
"addDigitalCard": {
"__typename": "AddDigitalCardSuccessPayload",
"digitalCard": {
"id": "$YOUR_DIGITAL_CARD_ID",
"statusInfo": {
"__typename": "DigitalCardConsentPendingStatusInfo",
"consent": {
"consentUrl": "$YOUR_CONSENT_URL"
}
}
}
}
}
}

Add multiple digital cards

Add several digital cards at once with the addDigitalCards mutation. It works like addDigitalCard, but it requires only a single consent flow for the entire batch.

  1. Call the addDigitalCards mutation with the list of cardIds to digitize. Make sure you're authenticated with a user access token: the user must be the cardholder for each card, and all cards must belong to the same account.
  2. Choose the walletProvider that corresponds to the cardholder's mobile device.
  3. The mutation returns one consent for the batch; the consent is available in each digital card's status information.
Consent validity

Digital cards are only valid for 1 hour after consent validation.

Mutation

Open in API Explorer
mutation AddDigitalCards {
addDigitalCards(
input: {
cardIds: ["$YOUR_CARD_ID_1", "$YOUR_CARD_ID_2"]
walletProvider: ApplePay
consentRedirectUrl: "$YOUR_REDIRECT_URL"
}
) {
... on AddDigitalCardsSuccessPayload {
__typename
digitalCards {
id
statusInfo {
... on DigitalCardConsentPendingStatusInfo {
__typename
consent {
consentUrl
}
}
}
}
}
}
}