Token constructor

const Token({
  1. required String id,
  2. @Default("token") String object,
  3. @JsonKey(name: "bank_account") BankAccountToken? bankAccount,
  4. CardToken? card,
  5. @JsonKey(name: "client_ip") String? clientIP,
  6. int? created,
  7. @Default(true) bool livemode,
  8. required TokenType type,
  9. @Default(false) bool used,
})

Implementation

const factory Token({
  /// Unique identifier for the object.
  required String id,

  /// String representing the object’s type.
  /// Objects of the same type share the same value.
  /// Value is "token".
  @Default("token") String object,

  /// Hash describing the bank account.
  @JsonKey(name: "bank_account") BankAccountToken? bankAccount,

  /// Hash describing the card used to make the charge.
  CardToken? card,

  /// IP address of the client that generated the token.
  @JsonKey(name: "client_ip") String? clientIP,

  /// Time at which the object was created. Measured in seconds since the Unix epoch.
  int? created,

  /// Type of the token: account, bank_account, card, or pii.
  @Default(true) bool livemode,

  /// Has the value true if the object exists in live mode or the
  /// value false if the object exists in test mode.
  required TokenType type,

  /// Whether this token has already been used
  /// (tokens can be used only once).
  @Default(false) bool used,
}) = _Token;