attachToPaymentIntent method

  1. @Deprecated("Use PaymongoClient instead")
Future<PaymentIntentAttachResponse> attachToPaymentIntent(
  1. String id,
  2. PaymentIntentAttach data
)

Attach payment intent to receive payment status.

Implementation

@Deprecated("Use PaymongoClient instead")

/// {@template attach_payment_intent}
/// Attach payment intent to receive payment status.
///
/// {@endtemplate}
Future<PaymentIntentAttachResponse> attachToPaymentIntent(
  String id,
  PaymentIntentAttach data,
) async {
  if (id.isEmpty) {
    throw ArgumentError("Payment Method ID must not be empty");
  }
  final options = PayMongoOptions(
    path: '/payment_intents/$id/attach',
    data: {
      'attributes': data.toMap(),
    },
  );
  final response = await post<Map<String, dynamic>>(options);
  final result = PaymentIntentAttachResponse.fromMap(response);
  return result;
}