5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
# File 'app/services/spree_stripe/create_setup_intent.rb', line 5
def call(gateway:, user:)
customer = gateway.fetch_or_create_customer(user: user)
ephemeral_key_response = gateway.create_ephemeral_key(customer.profile_id)
setup_intent = gateway.create_setup_intent(customer.profile_id)
success(
{
customer_id: customer.profile_id,
ephemeral_key_secret: ephemeral_key_response.params['secret'],
setup_intent_client_secret: setup_intent.params['client_secret']
}
)
end
|