requestTokenPayment method

  1. @override
Future<PaymentResponse> requestTokenPayment({
  1. required PaymentRequest paymentRequest,
  2. CreditCard? card,
  3. ApplePayTokenData? applePayTokenData,
  4. required PaymentMethod method,
})
override

pay using The Checkout.com token (e.g., a card or digital wallet token)

Implementation

@override
Future<PaymentResponse> requestTokenPayment({
  required PaymentRequest paymentRequest,
  CreditCard? card,
  ApplePayTokenData? applePayTokenData,
  required PaymentMethod method,
}) async {
  final token = await _tokenize(
    method,
    applePayTokenData: applePayTokenData,
    card: card,
  );

  Map<String, dynamic> response = await apiBase.call(
    RESTOption.post,
    resource: _payments,
    headers: headers,
    body: paymentRequest.copyWith(token: token).toJson(),
  );

  return PaymentResponse.fromMap(response);
}