Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Billable::cards does not return bank accounts #507

Closed
ColinLaws opened this issue Apr 18, 2018 · 14 comments · Fixed by #1074
Closed

Billable::cards does not return bank accounts #507

ColinLaws opened this issue Apr 18, 2018 · 14 comments · Fixed by #1074
Milestone

Comments

@ColinLaws
Copy link

ColinLaws commented Apr 18, 2018

As you can see below, when pulling the sources back it's being filtered by ['object' => 'card']. This means that it will not return bank accounts. The issue with this method is that it is consumed by the deleteCards() method. This means that bank accounts are not removed by the deleteCards method, and if a customer deletes an association to a bank account, and attempts to re-add it, an exception is thrown that the bank account already exists for that customer.

    $stripeCards = $this->asStripeCustomer()->sources->all(
        // Only cards are returned here, bank accounts are not pulled
        ['object' => 'card'] + $parameters
    );
@ColinLaws
Copy link
Author

We should probably add something to Cashier for explicitly removing bank accounts. Add a bankAccounts method to the Billable trait, and add a deleteBankAccounts method.

@ColinLaws
Copy link
Author

You could also remove the filtering and handle all objects as an ExternalAccount instead of handling them as the typical StripeCard class. You still have all the same data and functions available, they abstracted the concept of a payment method to an abstract class called ExternalAccount. The only difference is the data coming back from Stripe, but that can be parsed out using the object type of either 'card' or 'bank_account'. I hope I'm making some sense here.

@driesvints
Copy link
Member

I don't really know how this problem can happen with Cashier itself as you only add cards and not bank accounts. Do you add bank accounts yourself through the Stripe API?

@ColinLaws
Copy link
Author

I am able to get a token that represents a bank account by using a third party called Plaid. I use their front-end, which securely generates me a token, and I use that through Cashier. I just wanted to point out that you could technically use bank accounts with Cashier, and that it does seem to be favoring only using credit cards. This could be changed to manage payment methods in a more abstract way, that way I can manage my customers who pay with ACH without having to dig up the underlying Stripe API objects.

@driesvints
Copy link
Member

Ah ok so this is more of a feature request. At the moment Cashier indeed only supports cards but I can see that bank accounts might be of use to more people as well. I'll mark this as a feature request.

If you could manage to implement this in a clean way for the next major version then we could consider merging a PR in.

@driesvints
Copy link
Member

Small update: we've moved to the Payment Methods API in Cashier. Support for different methods is planned by Stripe but not available atm: https://stripe.com/docs/payments/payment-methods

@lsmith77
Copy link

so the limitation is Stripe
as a work-around would the following be feasible?

  • use Cashier to create the stripe customer during checkout
  • manually setup the bank transfer and related subscription on the stripe UI
  • would this trigger the web hook so that spark would then associate the stripe customer with a subscription

not sure at which point the user has to pay .. I guess it depends on how stripe is configured, ie. if you allow people to be behind their payments and still allow the subscription to be active or not.

wdyt?

@driesvints
Copy link
Member

@lsmith77 not sure sorry. We're just going to wait until Stripe provides support for bank accounts in their payment methods api.

@lsmith77
Copy link

lsmith77 commented Nov 6, 2019

FYI https://stripe.com/docs/payments/payment-methods was just updated.

following payment methods are now supported via the new API

  • iDEAL
  • SEPA Direct Debit

@driesvints
Copy link
Member

@lsmith77 don't you mean "now" instead of "not"?

@lsmith77
Copy link

yes .. sorry for the typo. fixed it in the comment

@simonhir
Copy link
Contributor

Would it be a clean way to add the possibility for other payment methods by passing the type as parameter to the functions?

For example in the paymentMethods function replace ...

$paymentMethods = StripePaymentMethod::all(
    ['customer' => $this->stripe_id, 'type' => 'card'] + $parameters,
    $this->stripeOptions()
);

... with ...

$paymentMethods = StripePaymentMethod::all(
    ['customer' => $this->stripe_id] + $parameters + ['type' => 'card'],
    $this->stripeOptions()
);

so if you pass ['type' => 'sepa_debit'] it won't be replaced by type card.

Of course you would have to adjust the other functions as well.

@driesvints
Copy link
Member

@ZiIMoIN I'm more thinking of passing a second parameter to that method in an upcoming release like so:

    public function paymentMethods($parameters = [], $type = 'card')

But we'd need to make sure that the rest of the methods indeed would still work. Like updateDefaultPaymentMethodFromStripe & fillPaymentMethodDetails.

@driesvints
Copy link
Member

I'm happy to say that the next version of Cashier will support all possible payment methods. All current methods on a billable will support a $type parameter that can be passed to reference specific payment method types.

At the moment we're still looking at updating the payment.blade.php view to also support more payment types.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants