solidusio / solidus_stripe

💳 Integrate Solidus with Stripe
https://stripe.com
BSD 3-Clause "New" or "Revised" License
36 stars 61 forks source link

Support ephemeral keys for iOS/Android #207

Open elia opened 1 year ago

elia commented 1 year ago
          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 ](https://stripe.com/docs/payments/accept-a-payment?platform=ios&ui=payment-sheet#add-server-endpoint)

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'],
}

_Originally posted by @loicginoux in https://github.com/solidusio/solidus_stripe/issues/164#issuecomment-1433799509_