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

Link SolidusStripe::Customer to reusable payment sources #164

Closed
elia opened this issue Feb 9, 2023 · 4 comments
Closed

Link SolidusStripe::Customer to reusable payment sources #164

elia opened this issue Feb 9, 2023 · 4 comments
Labels
enhancement New feature or request
Milestone

Comments

@elia
Copy link
Member

elia commented Feb 9, 2023

What

Associate it to the stripe customer id that was created for the order's user whenever a payment source is created for a reusable profile.

See also https://github.com/solidusio/solidus_braintree/blob/c2c6452bb54244afce6af4f27d81b081da10bff6/app/models/solidus_braintree/gateway.rb#L227-L249.

Dependencies

Why

Payments should be tied to a single customer on stripe as they're coming from a single user on solidus, this will make handling issues and investigations much easier (e.g. from customer support team members).

@elia elia added the enhancement New feature or request label Feb 9, 2023
@elia elia changed the title Link SolidusStripe::Customer with SolidusStripe::PaymentSource Link SolidusStripe::Customer to reusable payment sources Feb 9, 2023
@loicginoux
Copy link
Contributor

This might be for another ticket, let me know but when having a customer created and linked to a payment intent, from my understanding of Stripe, iOS and Android clients will also need an ephemeral key as described in the Stripe documentation
Something like:

ephemeral_key = Stripe::EphemeralKey.create({
  customer: customer['id'],
}, { stripe_version: Stripe.api_version})

and then the PaymentIntentController#create will respond with all the info need o that any kind of api client can handle it

render json: { 
  client_secret: intent.client_secret,
  ephemeral_key: ephemeral_key['secret'],
  customer: customer['id'],
}

@elia
Copy link
Member Author

elia commented Feb 17, 2023

For serving iOS clients it's probably best to add a dedicated controller under Spree::Api and return what's needed there.

In the latest branch (which we'll hopefully merge soon) the secret is not fetched via Ajax anymore and it's instead being provided by to the payment view directly.

@elia
Copy link
Member Author

elia commented Mar 7, 2023

@loicginoux I extracted your comment about iOS/android to #207, so we don't lose track

@elia
Copy link
Member Author

elia commented Mar 7, 2023

Fixed in #172

@elia elia closed this as completed Mar 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants