SavedPaymentMethod

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.

Inheritors

Constructors

Link copied to clipboard
constructor(type: PaymentMethodType, alias: String)

This constructor has to be used to initialize a saved payment method.

Types

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.

Properties

Link copied to clipboard
open var alias: String

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

Link copied to clipboard
open val isValid: Boolean = true

Checks if the saved payment method is valid.

Link copied to clipboard

Payment method type, e.g. Visa.

Functions

Link copied to clipboard
open override fun clone(): SavedPaymentMethod
Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard

For TalkBack this title is used instead of getInternalDisplayTitle.

Link copied to clipboard
open fun getDisplayTitle(context: Context): String

A human readable title.

Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
fun toJson(): String

Returns a JSON string representation of this saved payment method object to be deserialized with create.

Link copied to clipboard
open override fun toString(): String