@adyen/react-native
Version:
Wraps Adyen Checkout Drop-In and Components for iOS and Android for convenient use with React Native
22 lines (18 loc) • 673 B
JavaScript
;
import { createContext, useContext } from 'react';
/**
* Shape of the AdyenCheckout context value.
*/
export const AdyenCheckoutContext = /*#__PURE__*/createContext(null);
/**
* Returns AdyenCheckout context. This context allows you to initiate payment with Drop-in or any payment method available in `paymentMethods` collection.
*/
export const useAdyenCheckout = () => {
const context = useContext(AdyenCheckoutContext);
if (context !== null) {
return context;
}
throw new Error(MISSING_CONTEXT_ERROR);
};
const MISSING_CONTEXT_ERROR = 'useAdyenCheckout must be used within an AdyenCheckout';
//# sourceMappingURL=useAdyenCheckout.js.map