Skip to content

Instantly share code, notes, and snippets.

@jdnichollsc
Last active June 8, 2020 06:41
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jdnichollsc/23d7d1c22db0a11639886530c92d35da to your computer and use it in GitHub Desktop.
Save jdnichollsc/23d7d1c22db0a11639886530c92d35da to your computer and use it in GitHub Desktop.
React Native plugin for Mercado Pago (Mobile Checkout)

MercadoPago for React Native (Android & iOS)

A native bridge to use Mercado Pago SDK V4 with React Native.

import MercadoPago from 'react-native-mercado-pago';

async startPayment() {
  try {
    const publicKey = 'TEST-dc0b51e0-0eb7-47ce-b145-5585a0189eb0';
    const preferenceId = '113196323-082708db-09c3-4c7d-a65a-727e237c76e0';
    const result = await MercadoPago.startPayment(publicKey, preferenceId, {
      color: '#6200EE',
      enableBankDeals: true,
      language: 'es',
    });
    if (result.type === 'success') {
      Alert.alert('Success', JSON.stringify(result));
    } else {
      Alert.alert('Canceled', 'Se canceló la transacción');
    }
  } catch (error) {
    Alert.alert(error.message);
  }
}

Buy 💼

You can buy this product here: https://github.com/proyecto26/react-native-mercado-pago-enterprise

Happy coding 💯

Made with ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment