createPaymentIntent method

  1. @Deprecated("Use PaymongoClient instead")
Future<PaymentIntentResponse> createPaymentIntent(
  1. PaymentIntentAttributes attributes
)

Create payment and call attachToPaymentIntent to your backend using secret key

Implementation

@Deprecated("Use PaymongoClient instead")

/// {@template create_payment_intent}
/// Create payment and call [attachToPaymentIntent] to your backend using
/// secret key
///
/// {@endtemplate}
Future<PaymentIntentResponse> createPaymentIntent(
  PaymentIntentAttributes attributes,
) async {
  if (attributes.amount <= 100) {
    throw ArgumentError("Amount should be at least above P 100.00");
  }
  final options = PayMongoOptions(
    path: '/payment_intents',
    data: {
      'attributes': attributes.toMap(),
    },
  );
  final response = await post<Map<String, dynamic>>(options);
  return PaymentIntentResponse.fromMap(response);
}