ezet / stripe-sdk

A simple and flexible Stripe library for Flutter with complete support for SCA and PSD2.
https://pub.dev/packages/stripe_sdk
Other
137 stars 137 forks source link

Add 'Create Source' methods to Stripe API file #89

Closed r0adkll closed 3 years ago

r0adkll commented 3 years ago

Description

As per: https://stripe.com/docs/api/sources/create I added implementations for these endpoints for our use case. I also cleaned up the path variable names in customer_session.dart to be more consistent throughout the whole file as well as converted the double quoted strings to single quotes as per lint rules.

ezet commented 3 years ago

Thank you for your contribution! :) I will likely review/merge this tomorrow.

ezet commented 3 years ago

Looks good, thanks for updating the PR 👍

ezet commented 3 years ago

@r0adkll What is your use case for needing this? According to Stripe the Sources API is deprecated and replaced by Payment Method API, which is already supported. I don't mind adding sources, but I'd like to know why the current API doesn't meet your needs.

r0adkll commented 3 years ago

@ezet The current API would probably be the preferred solution, but for now I'm constrained by time and business constraints of upgrading our mobile applications (to flutter) and interface with the solution the backend server uses to manage subscriptions. If you don't want to merge it due to deprecation, that is ok as I can just continue to point at my fork until we can upgrade our payment solution across all platforms.

ezet commented 3 years ago

I know how bothersome it is to maintain a fork. I'll add this to the next release. Also Sources currently support some payment methods that are not supported by Payment Methods API yet.

r0adkll commented 3 years ago

Awesome! I appreciate it!

ezet commented 3 years ago

I will make one minor change before releasing. I will remove the createSourceFromCard convenience method to avoid encouraging using this API for regular credit cards, as the Payment Methods API is strongly encouraged for cards. But hopefully that won't matter much for your use :)

r0adkll commented 3 years ago

That is fine with me. I started out using that method but migrated since I had to add additional fields to the payment method.

ezet commented 3 years ago

Published 3.2.0 👍