Skip to main content
Let your users add their card to Apple Pay or Google Pay with one tap inside your app. Your app opens the phone’s add-card screen, your server asks Agentcard for the card’s encrypted wallet data, and your app hands that data to the wallet. Your server and your app never hold the card number.
One tap is not live yet. Every call on this page answers wallet_provisioning_not_enabled today, because phone wallets are not switched on for Agentcard cards yet. Your users can add their card to Apple Pay or Google Pay now by typing it into the Wallet app by hand, which works and needs nothing from you. Talk to us before you build against the shapes below: the finished integration runs partly through a wallet library inside your own app, so some of these fields will change.

Check what you need

Three things have to be true before a card reaches a phone: Always call Agentcard from your server, with your company access token. Your app never holds that token: it asks your server, and your server asks Agentcard.

Add a card to Apple Pay

Show Apple’s “Add to Apple Wallet” button only when the phone can add cards and this card is not in Wallet yet. When your user taps it, open Apple’s add-card screen (PKAddPaymentPassViewController) with the card’s last four digits and the cardholder’s name. Apple then hands your app three values: a list of certificates, a nonce and a nonce signature. Encode each one in base64, send them to your server, and have your server ask Agentcard right away, because the nonce expires within a few minutes:
device_id is an id your app keeps for the phone the card goes to. Pass the three answer fields back to your app, decode them from base64, and give them to Apple in a PKAddPaymentPassRequest. Apple shows your user its terms, adds the card, and tells your app when the card is in Wallet. If your server cannot get the data, give Apple an empty request. Apple then tells your user the card could not be added, and your user can try again.

Add a card to Google Pay

Show Google’s “Add to Google Pay” button only when the card is not in your user’s Google Wallet yet. Send an id your app keeps for the phone to your server, and have your server ask Agentcard:
Pass the answer to your app. Build Google’s push request with opaque_payment_card decoded from base64, the network and token service set to Visa, and last4, then call pushTokenize. Google shows your user its terms and adds the card.

Pay with the card in the wallet

A payment from Apple Pay or Google Pay is a charge on the same card. The card’s limit, its merchant rules and its pause all apply, and every charge reaches your server as a webhook, as it does for a card your agent types in. Pause the card, and the card network declines payments from the wallet too.

Handle a refusal

Agentcard refuses a card that cannot go in a wallet before anything reaches the phone. A single-use card answers: