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
| Name | Type | Required | Description |
|---|---|---|---|
apiKey | String | yes | Your Lib Lite API token |
system | MPSystem | yes | .live or .test |
controller | UIViewController | yes | Presenting view controller |
delegate | MPScanToPayDelegate | yes | Where the SDK calls back |
preMSISDN | String | optional | Pre-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)
| Callback | Meaning |
|---|---|
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
- Take a payment → Payments
- Pre-register a card before the first purchase → Pre-registration
- For wallet providers managing cards via API → Card provisioning
Updated 2 days ago
