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

Allow to optionally create token with customer_id option #56

Closed
skukx opened this issue Mar 6, 2017 · 0 comments
Closed

Allow to optionally create token with customer_id option #56

skukx opened this issue Mar 6, 2017 · 0 comments

Comments

@skukx
Copy link
Contributor

skukx commented Mar 6, 2017

Right now Solidus::Gateway::BraintreeGateway model allows options to be passed to the generate_client_token method when generating the braintree token.

def generate_client_token(options = {})

However when calling the api to call generate the token. No options are passed or considered
https://github.com/solidusio/solidus_braintree/blob/d9c8f26f941d912c482ba3b98934f331c50370ac/app/controllers/spree/api/braintree_client_token_controller.rb

This means every card is created on a new Braintree Customer. If a user is logged in, that user should belong to 1 Braintree Customer and all cards created should be attached to that same customer. The hosted fields right now does not support this as far as I can see.

This feature becomes extremely important with braintree recurring billing and updating a payment method. The update will fail because the newly created card belongs to another customer and not the same customer as on the subscription.

The token creation would look something like:

Braintree::ClientToken.generate customer_id: <customer id>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants