# PaymentHandle

interface PaymentHandle

Representation of a payment process available immediately from PaymentManager.startPaymentActivity. Provides a way to interact with an ongoing payment, e.g. cancel it or select additionalPaymentMethods. Additionally, one can get idempotencyKey of the payment that was just created.

## Types

CancelResult
Link copied to clipboard
enum CancelResult : Enum<PaymentHandle.CancelResult>

Return values from PaymentHandle.cancel.

## Properties

additionalPaymentMethods
Link copied to clipboard
abstract val additionalPaymentMethods: List<AdditionalPaymentMethod>

Provides access to non-cardreader payment methods.

idempotencyKey
Link copied to clipboard
abstract val idempotencyKey: String

The unique key assigned to the payment immediately from PaymentManager.startPaymentActivity. Used for disaster recovery if a crash occurs before the larger set of information reported to the payment callbacks.The idempotency key is assigned very early, and does not suggest anything about the payment's success or even validity. If valid, however, it can be used to refer to the payment in other calls to Square's Connect API. For example, an incomplete payment created using PaymentParameters.autocomplete=false can be completed with a call to /v2/payments/idempotencyKey/complete.

## Functions

cancel
Link copied to clipboard
abstract fun cancel(): PaymentHandle.CancelResult

Cancels a pending payment, if one exists and can be canceled. In this case, the method returns CancelResult.CANCELED and the payment callbacks will be called with PaymentErrorCode.CANCELED to indicate the cancellation.

findMethod
Link copied to clipboard
abstract fun findMethod(type: AdditionalPaymentMethod.Type): AdditionalPaymentMethod?

Searches for a specific additional payment method by its type.