createCardPaymentMethod

Creates a new card payment method, optionally encrypting sensitive fields via Evervault.

When encryptData is true, PaymentMethodRequests.CreateCardPaymentMethodRequest.cardNumber and PaymentMethodRequests.CreateCardPaymentMethodRequest.cvc are encrypted before the request is sent.

Return

A pair of the created payment method and a networking error.

Parameters

request

The card details and optional customer or account associations.

encryptData

Whether to encrypt the card number and CVC before transmission. Defaults to true.


fun createCardPaymentMethod(request: PaymentMethodRequests.CreateCardPaymentMethodRequest, encryptData: Boolean = true, scope: CoroutineScope, completionHandler: (FrameObjects.PaymentMethod?, NetworkingError?) -> Unit)

Creates a new card payment method on the provided coroutine scope and delivers the result to a callback on the main thread.

When encryptData is true, the card number and CVC are encrypted via Evervault before transmission. The completion handler is always invoked on the main dispatcher.

Parameters

request

The card details and optional customer or account associations.

encryptData

Whether to encrypt the card number and CVC before transmission. Defaults to true.

scope

The CoroutineScope on which the encryption and network work is launched.

completionHandler

Called on the main thread with the created payment method on success, or a NetworkingError on failure.