23 lines
427 B
JavaScript
23 lines
427 B
JavaScript
|
/**
|
||
|
* External dependencies
|
||
|
*/
|
||
|
import { loadStripe } from '@stripe/stripe-js';
|
||
|
|
||
|
/**
|
||
|
* Internal dependencies
|
||
|
*/
|
||
|
import { getApiKey } from './utils';
|
||
|
|
||
|
const stripePromise = new Promise( ( resolve ) => {
|
||
|
let stripe = null;
|
||
|
try {
|
||
|
stripe = loadStripe( getApiKey() );
|
||
|
} catch ( error ) {
|
||
|
// eslint-disable-next-line no-console
|
||
|
//console.error( error.message );
|
||
|
}
|
||
|
resolve( stripe );
|
||
|
} );
|
||
|
|
||
|
export default stripePromise;
|