RazorpayOrder constructor

  1. @JsonSerializable(includeIfNull: false)
const RazorpayOrder({
  1. required String id,
  2. required String entity,
  3. required dynamic amount,
  4. required int amount_paid,
  5. required int amount_due,
  6. required String currency,
  7. required String status,
  8. required int created_at,
  9. String? offer_id,
  10. String? method,
  11. RazorpayOrderBankDetailsCreateRequestBody? bank_account,
  12. IMap? notes,
  13. bool? partial_payment,
  14. int? first_payment_min_amount,
  15. String? description,
  16. RazorpayAuthorizationToken? token,
  17. Map<String, String>? payments,
  18. Map<String, String>? offers,
  19. List<RazorpayTransfer>? transfers,
  20. bool? rto_review,
  21. List<LineItems>? line_items,
  22. dynamic line_items_total,
  23. int? shipping_fee,
  24. int? cod_fee,
  25. CustomerDetails? customer_details,
  26. List<Promotion>? promotions,
  27. DeviceDetails? device_details,
  28. String? phonepe_switch_context,
})

Implementation

@JsonSerializable(includeIfNull: false)
const factory RazorpayOrder({
  required String id,
  required String entity,
  required dynamic amount, // number | string
  required int amount_paid,
  required int amount_due,
  required String currency,
  required String
      status, // 'created' | 'attempted' | 'paid', required int attempts, required int created_at, String? receipt,
  required int created_at,
  String? offer_id,
  String? method, // 'netbanking' | 'upi' | 'card' | 'emandate' | 'nach'
  RazorpayOrderBankDetailsCreateRequestBody?
      bank_account, // Response might contain this if created with it
  IMap<dynamic>? notes,
  bool? partial_payment,
  int? first_payment_min_amount,
  String? description, // Often added by system if not provided
  RazorpayAuthorizationToken? token, // Response token structure
  Map<String, String>? payments, // { [key:string] : string }
  Map<String, String>? offers, // { [key:string] : string }
  // Transfers structure in response
  List<RazorpayTransfer>?
      transfers, // Transfers.RazorpayTransfer[] | {entity: string; count: string; items: Transfers.RazorpayTransfer[] }
  // Use dynamic or create a union type/check type at runtime

  // RTO related fields in response (might not always be present)
  bool? rto_review,
  List<LineItems>? line_items,
  dynamic line_items_total,
  int? shipping_fee,
  int? cod_fee,
  CustomerDetails? customer_details,
  List<Promotion>? promotions,
  DeviceDetails? device_details,
  String? phonepe_switch_context,
}) = _RazorpayOrder;