toPaymentMethod method

Map<String, Object> toPaymentMethod()

Returns a stripe hash that represents this card. It only sets the type and card details. In order to add additional details such as name and address, you need to insert these keys into the hash before submitting it.

Implementation

Map<String, Object> toPaymentMethod() {
  final Map<String, Object> map = {
    'type': 'card',
    'card': {
      'number': number,
      'cvc': cvc,
      'exp_month': expMonth,
      'exp_year': expYear,
    },
    'billing_details': {
      'address': {'postal_code': postalCode}
    }
  };
  _removeNullAndEmptyParams(map);
  return map;
}