Manage card

Launch the Scan to PayKit card-management flow standalone — let customers add or remove cards without making a purchase.

The manage-card flow lets a customer add, view, or delete cards on their Scan to Pay profile from inside your app — without going through a checkout. Use it when you want a "My cards" or "Payment methods" section in your app.

For payments themselves, see Payments.


Invoking wallet management

import ScanToPayKit

@IBAction func manageCardList(_ sender: Any) {
    let apiKey  = "YOUR_API_KEY"
    let system  = MPSystem.test

    let scanToPay = MPScanToPay()
    scanToPay.walletManagement(apiKey,
                               system:    system,
                               controller: self,
                               delegate:   self)
}

Optionally pre-fill the MSISDN:

scanToPay.walletManagement(apiKey,
                           system:    system,
                           controller: self,
                           delegate:   self,
                           preMSISDN: "27832006283")

Parameters

NameTypeRequiredDescription
apiKeyStringyesYour Lib Lite API token
systemMPSystemyes.live or .test
controllerUIViewControlleryesPresenting view controller
delegateMPScanToPayDelegateyesWhere the SDK calls back
preMSISDNStringoptionalPre-fills MSISDN if known

Note: no code parameter — manage-card doesn't involve a transaction.


Result handling

The same MPScanToPayDelegate you use for payments will receive manage-card callbacks. The relevant ones:

extension CardsViewController: MPScanToPayDelegate {
    func scanToPayUserCompletedWallet() {
        // Customer finished managing cards
    }

    func scanToPayUserDidCancel() {
        // Customer closed the wallet without finishing
    }

    func scanToPayError(_ error: MPError) {
        // Something errored
        handleError(error)
    }
}

Delegate callbacks (manage-card scope)

CallbackMeaning
scanToPayUserCompletedWallet()Customer finished using the wallet
scanToPayUserDidCancel()Customer closed the wallet
scanToPayError(_:)An error occurred — see Errors

The payment-specific callbacks (scanToPayPaymentSucceeded(...), scanToPayPaymentFailed(...), scanToPayInvalidCode()) are never called in the manage-card flow.


What's next