SavedPaymentMethod

open class SavedPaymentMethod(type: PaymentMethodType, alias: String) : Serializable, Cloneable

This is the base class to save a payment method and use it to process recurring payments or fast checkouts.

This class is sufficient for some payment methods (e.g. Twint). More complex payment methods require you to specify additional details in their SavedPaymentMethod subclass (e.g. card payments, PostFinance, etc.).

Please refer to this list to see if you need to use one of the subclasses for your payments:

  • Easy payment methods: Swisscom Pay, SEPA (ELV), Twint, Google Pay, Samsung Pay, CembraPay, SwissPass, Powerpay Invoice, Klarna

  • Complex payment methods (requiring a SavedPaymentMethod subclass): Card payments, Boncard, PayPal, PostFinance, Reka

Please refer to the Datatrans documentation to see if you can register a payment method during payment or require a dedicated registration.

Parameters

type

Payment method type, e.g. PayPal or Twint.

alias

The alias that can be used to process recurring payments or fast checkouts.

Constructors

SavedPaymentMethod
Link copied to clipboard
fun SavedPaymentMethod(type: PaymentMethodType, alias: String)
This constructor has to be used to initialize a saved payment method.

Types

Companion
Link copied to clipboard
object Companion
This companion contains static methods used to deserialize a SavedPaymentMethod from a JSON string or from data created by the old payment library.

Functions

clone
Link copied to clipboard
open override fun clone(): SavedPaymentMethod
equals
Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
getAccessibilityTitle
Link copied to clipboard
open fun getAccessibilityTitle(context: Context): String
For TalkBack this title is used instead of getDisplayTitle.
getDisplayTitle
Link copied to clipboard
open fun getDisplayTitle(context: Context): String
A human readable title.
hashCode
Link copied to clipboard
open override fun hashCode(): Int
toJson
Link copied to clipboard
fun toJson(): String
Returns a JSON string representation of this saved payment method object to be deserialized with create.
toString
Link copied to clipboard
open override fun toString(): String

Properties

alias
Link copied to clipboard
open var alias: String
The alias that can be used to process recurring payments or fast checkouts.
isValid
Link copied to clipboard
open val isValid: Boolean = true
Checks if the saved payment method is valid.
type
Link copied to clipboard
val type: PaymentMethodType
Payment method type, e.g.

Inheritors

SavedBoncard
Link copied to clipboard
SavedCard
Link copied to clipboard
SavedPayPal
Link copied to clipboard
SavedSEPA
Link copied to clipboard