Using Saved Cards for Deposits


Saving a Card

When a user pays for a transaction using a card they have the option of saving the card for future transactions.

Save Card

Reusing a Card - Payment Page

If a user previously save a card it will be made available as a payment option on the payment page the next time they pay for a transaction.

Reuse Card

Reusing a Card - API

If a user has saved a card it can be used via the api without any interaction required from the user.

Thi this is done using the transactionDepositCard mutation and requires the transaction ID and Card ID.

Getting the Card ID for a token

Cards are linked to a token, you can get a list of saved cards using the cards query.

query cards {
    cards(tokenId: "33uTTKcYSygVhRx6vWvQ1S") {
        id
        name
        number
        month
        year
    }
}

This will provide a list of cards saved by the user in previous transactions along with some additional information about the card.

{
    "data": {
        "cards": [
            {
                "id": "F24CFD9E-D459-486B-9E9C-772DA9DE7540",
                "name": "Test Card",
                "number": "557678******2300",
                "month": 2,
                "year": 2024
            }
        ]
    }
}

Request a Deposit

Using the card ID you can create a deposit request via the api. The response will be identical to transactionDeposit but a redirect to the payment page is not required.

The payment will be initiated immediately and the transaction will be updated if successful along with the appropriate callback to confirm success.

{warning}Requirements:

A user must have already saved a card.

the card must-have been used in at least one successful transaction previously (only cards with that have been successfully authorised can be used).

The transaction value cannot exceed R50 000.

Card ID must be linked to buyers token.

mutation transactionDepositCard {
    transactionDepositCard(id: "2iDaQZwUZz3GNTKLpNe1Gj", cardId: "F24CFD9E-D459-486B-9E9C-772DA9DE7540") {
        id
    }
}

If there is an error processing a card an error will be thrown immediately.

Error Example

{
    "errors": [
        {
            "message": "The transaction failed",
            "extensions": {
                "reason": "There was a problem processing the card",
                "errors": [],
                "category": "custom"
            },
            "locations": [
                {
                    "line": 1136,
                    "column": 2
                }
            ],
            "path": [
                "transactionDepositCard"
            ]
        }
    ],
    "data": {
        "transactionDepositCard": null
    }
}