create method

With subscriptions, you can schedule recurring payments to take place at regular intervals. For example, by simply specifying an amount and an interval, you can create an endless subscription to charge a monthly fee, until you cancel the subscription. Or, you could use the times parameter to only charge a limited number of times, for example to split a big transaction in multiple parts.

Implementation

Future<MollieSubscriptionResponse> create(MollieSubscriptionRequest sub, String customerId) async {
  var res =
      await http.post(Uri.parse("$_apiEndpoint/$customerId/subscriptions"), headers: _headers, body: sub.toJson());

  dynamic data = json.decode(res.body);

  return MollieSubscriptionResponse.build(data);
}