CustomerSession.fromJson constructor

CustomerSession.fromJson(
  1. Object? json
)

Implementation

factory CustomerSession.fromJson(Object? json) {
  final map = (json as Map).cast<String, Object?>();
  return CustomerSession(
    clientSecret: (map['client_secret'] as String),
    components: map['components'] == null
        ? null
        : CustomerSessionResourceComponents.fromJson(map['components']),
    created:
        DateTime.fromMillisecondsSinceEpoch((map['created'] as int).toInt()),
    customer: CustomerOrId.fromJson(map['customer']),
    expiresAt: DateTime.fromMillisecondsSinceEpoch(
        (map['expires_at'] as int).toInt()),
    livemode: (map['livemode'] as bool),
  );
}