.showPaymentSheet()
import EmbedReactNative from '@gr4vy/embed-react-native'; const handleCheckout = () => { EmbedReactNative.showPaymentSheet({ gr4vyId: 'mattilda', environment: 'sandbox', token: '[TOKEN]', amount: 1299, currency: 'AUD', country: 'AU', ... }) } <Button onClick={handleCheckout}>Pay</Button>
[TOKEN]
import { EmbedReactNativeEventEmitter, Gr4vyEvent } from '@gr4vy/embed-react-native'; const onEvent = (event: Gr4vyEvent) => { const { name, data } = event console[name === 'generalError' ? 'error' : 'log'](name, data) } useEffect(() => { const onEventSubscription = EmbedReactNativeEventEmitter.addListener( 'onEvent', onEvent ) return () => { onEventSubscription.remove() } }, [])
Was this page helpful?