showOrderDetails method

Future<Order> showOrderDetails(
  1. String id, {
  2. List<String>? fields,
})

Shows details for an order, by ID.

Parameter id: The id of the order

Parameter fields: A comma-separated list of fields that should be returned for the order. Valid filter field is payment_source.

Implementation

Future<Order> showOrderDetails(
  String id, {
  List<String>? fields,
}) async {
  var queryParameters = fields != null ? {'fields': fields} : null;
  var uri = _payPalHttpClient.getUrl('/v2/checkout/orders/$id',
      queryParameters: queryParameters);

  var response = await _payPalHttpClient.get(uri);
  return Order.fromJson(jsonDecode(response.body));
}