CustomerSession

class CustomerSession

Represents a logged-in session of a single Customer.

See Creating ephemeral keys

Types

Link copied to clipboard
object Companion
Link copied to clipboard
interface CustomerRetrievalListener : CustomerSession.RetrievalListener
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
interface RetrievalListener
Link copied to clipboard
interface SourceRetrievalListener : CustomerSession.RetrievalListener

Functions

Link copied to clipboard
fun addCustomerSource(    sourceId: String,     sourceType: String,     listener: CustomerSession.SourceRetrievalListener)

Add the Source to the current customer.

Link copied to clipboard
fun attachPaymentMethod(paymentMethodId: String, listener: CustomerSession.PaymentMethodRetrievalListener)

Attaches a PaymentMethod to a customer.

Link copied to clipboard
fun deleteCustomerSource(sourceId: String, listener: CustomerSession.SourceRetrievalListener)

Delete the Source from the current customer.

Link copied to clipboard
fun detachPaymentMethod(paymentMethodId: String, listener: CustomerSession.PaymentMethodRetrievalListener)

Detaches a PaymentMethod from a customer.

Link copied to clipboard
fun getPaymentMethods(paymentMethodType: PaymentMethod.Type, listener: CustomerSession.PaymentMethodsRetrievalListener)

fun getPaymentMethods(    paymentMethodType: PaymentMethod.Type,     @IntRange(from = 1, to = 100) limit: Int?,     endingBefore: String? = null,     startingAfter: String? = null,     listener: CustomerSession.PaymentMethodsRetrievalListener)

Retrieves all of the customer's PaymentMethod objects, filtered by a PaymentMethod.Type.

Link copied to clipboard
fun retrieveCurrentCustomer(listener: CustomerSession.CustomerRetrievalListener)

Retrieve the current Customer. If customer is not stale, this returns immediately with the cache. If not, it fetches a new value and returns that to the listener.

Link copied to clipboard
fun setCustomerDefaultSource(    sourceId: String,     sourceType: String,     listener: CustomerSession.CustomerRetrievalListener)

Set the default Source of the current customer.

Link copied to clipboard
fun setCustomerShippingInformation(shippingInformation: ShippingInformation, listener: CustomerSession.CustomerRetrievalListener)

Set the shipping information on the current customer.

Link copied to clipboard
fun updateCurrentCustomer(listener: CustomerSession.CustomerRetrievalListener)

Force an update of the current customer, regardless of how much time has passed.

Properties

Link copied to clipboard
val cachedCustomer: Customer?

A cached Customer, or null if the current customer has expired.