-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(workingparty): Lazy initialization of stripe client
- Loading branch information
1 parent
918bf3d
commit 1166665
Showing
4 changed files
with
27 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,14 @@ | ||
import Stripe from 'stripe'; | ||
|
||
export const stripe = new Stripe( | ||
process.env.STRIPE_SECRETKEY ?? '', | ||
{ | ||
let stripe: Stripe | null = null; | ||
|
||
export function getStripe() { | ||
if (!stripe) { | ||
stripe = new Stripe( | ||
process.env.STRIPE_SECRETKEY ?? '', | ||
{ | ||
} | ||
); | ||
} | ||
); | ||
return stripe; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters