We've moved discussions to Discord

Where is Stripe being initialized?

Gordon Evans
More out of curiosity and to understand how it's being done, I'm trying to figure out where you're initializing Stripe for backend use.

I've added my secret / publishable keys to the encrypted credential file and it's obvious that stripe is talking to my account as it's successfully processing orders & charges. For example, I can do things like creating a order.

stripe_order = ::Stripe::Order.create(
  currency: CURRENCY,
  customer: user.teams.first.processor_id,
  email: user.email,
  items: items,
  shipping: stripe_shipping_address_format(shipping_address),
)

However, I cannot find where, in the code base, Stripe is being initialized or more importantly where you're actually setting the Stipe API key for the library.

I can see it happening on the frontend, but nothing for the use of Stripe in the backend.
<% content_for :head, tag(:meta, name: "stripe-key", content: Pay::Stripe.public_key) %>

I'm used to doing something along the lines of:
require "stripe"
Stripe.api_key = "sk_test_..."

Thoughts?
Dan Weaver
Jumpstart uses the Pay gem and it looks like all the initialization is done within that.

https://github.com/excid3/pay
https://github.com/excid3/pay/blob/master/lib/pay/stripe.rb
Chris Oliver
Correct, the Pay gem is where it's setting up the API keys. 👍
Notifications
You’re not receiving notifications from this thread.