# getIdempotencyKey

abstract fun getIdempotencyKey(paymentAttemptId: String): GetIdempotencyKeyResult

Retrieves the idempotency key used in the payment request associated with the given paymentAttemptId, if the paymentAttemptId was used in the last 24 hours. The returned idempotency key can be used to a cancel a payment via the Square Payments API: https://developer.squareup.com/reference/square/payments-api/cancel-payment-by-idempotency-key

#### Return

the idempotency key associated with the paymentAttemptId, null if not found, or an error if the merchant is not authorized.

#### Parameters

paymentAttemptId

the unique identifier for the payment attempt.