getInvoice method

Future<MollieInvoiceResponse?> getInvoice(
  1. String id
)

Retrieve details of an invoice, using the invoice’s identifier. If you want to retrieve the details of an invoice by its invoice number, use the list endpoint with the reference parameter.

Implementation

Future<MollieInvoiceResponse?> getInvoice(String id) async {
  var res = await http.get(Uri.parse("$_apiEndpoint/$id"), headers: _headers);

  if (res.statusCode == 200) {
    return MollieInvoiceResponse.build(json.decode(res.body));
  } else {
    throw Exception("Error getting invoice ${res.statusCode} ${res.body}");
  }
}