Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have two Stripe accounts:

# Stripe API Keys
STRIPE_KEY=pk_test_abc
STRIPE_SECRET=sk_test_abc
STRIPE_KEY_MAPPING=pk_test_opr
STRIPE_SECRET_MAPPING_MASTER=sk_test_opr

I put both in an array:

$stripe_accounts = [
    env('STRIPE_SECRET'),
    env('STRIPE_SECRET_MAPPING_MASTER')
]

Now I want to create user in both accounts :

foreach ($stripe_accounts as $item) {
  Stripe::setApiKey($item);
  $hotel = session('hotel');
  $stripeUser = $hotel->createOrGetStripeCustomer();
  $hotel->updateDefaultPaymentMethodFromStripe();
}

I have no errors, but when I check stripe dashboard for this account STRIPE_KEY_MAPPING I don't see any test data. How can I make a flow in which I create same Stripe customer in two different accounts?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
200 views
Welcome To Ask or Share your Answers For Others

1 Answer

Laravel Cashier gets Stripe API keys from the .env file, which uses the DotEnv library.

Try the approaches in the answers to this question to change the Stripe API keys in your code: How to set .env values in laravel programmatically on the fly


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...