Cards
CardManager object needs to be obtained first to start working with cards:
val mercuryo: Mercuryo = Mercuryo.create(...)
val cardManager: CardManager = mercuryo.cardvar mercuryoSDK: IMercuryo = IMercuryo(isDebug: true, baseHost: "HOST_HERE")
var card = mercuryoSDK.cardList of cards
To get a list of linked cards, call the method:
cardManager.getCards(limit: Int, offset: Int): List<Card>mercuryoSDK.card.getCards(limit: 20, offset: 0) { cards, error in
//do some magic here
}
Adding card
cardManager.bindCard(holderName: String, number: String, cvv: String, expirationMonth: String, expirationYear: String, redirectUrl: String): BindCardmercuryoSDK.card.bindCard(holderName: "HOLDER_NAME HERE", number: "5536 ...", cvv: "123", expirationMonth: "MM", expirationYear: "YYYY", redirectUrl: "REDIRECT_URL HELE") { bindCardInfo, error in
//do magic here
}Parameter
Description
holderName
Cardholder name
number
Number of card
cvv
CVV of card
expirationMonth
Expiration month
expirationYear
Expiration year
redirectUrl
URL where user will be redirected to after operation. Example: http://my.mercuryo.io/orders?invoice={invoice_id}
Removing card
To delete a card call the deleteCard method passing the card identifier.
cardManager.deleteCard(cardId: String) mercuryoSDK.card.deleteCard(cardId: "CARD_ID HERE") { _, error in
//if no error than card deleted
}Last updated
Was this helpful?