0.2.4 • Published 3 years ago

@blackbox-vision/react-native-mercadopago-tokenize-checkout v0.2.4

Weekly downloads
10
License
MIT
Repository
github
Last release
3 years ago

MercadoPago Tokenize Checkout RN License: MIT

A component to integrate MercadoPago tokenize checkout into a RN app.

Why this exists?

Currently, MercadoPago native SDKs doesn't support card tokenization and card save/restore from user.

Table of contents

Use case

You're using RN for building an app, and you need to integrate MercadoPago checkout in your app.

Compatibility

Our package currently supports apps with RN >= 0.60. We don't have a plan currently to support olders ones, but if you need we're open to support it.

Pre Requisites

As a pre requisite you'll need the following before integrating the library:

  1. A MercadoPago Account
  2. A publicKey from your MercadoPago Account

If you don't have any of the followings, you can start from here:

  1. Creating a MercadoPago Account
  2. Creating a MercadoPago Application

If you've more doubts you can read more documentation in this portal:

Installation

You can install this library via NPM or YARN.

NPM

npm i @blackbox-vision/react-native-mercadopago-tokenize-checkout

YARN

yarn add @blackbox-vision/react-native-mercadopago-tokenize-checkout

Example Usage

After reading and performing the previous steps, you should be able to import the library and use it like in this example:

import Env from 'react-native-config';
import React, { useState } from 'react';
import { StyleSheet, View, Text, TouchableOpacity, Alert } from 'react-native';

import MercadoPagoWebTokenizeCheckout from '@blackbox-vision/react-native-mercadopago-tokenize-checkout';

import styles from './styles';

export default function App() {
  return (
    <MercadoPagoWebTokenizeCheckout
      amount="100.00"
      action="yourServerUrl"
      productLabel="Awesome Product"
      publicKey={Env.PUBLIC_KEY}
      style={styles.container}
      theme={{
        elements: '#000',
        header: '#000',
      }}
    />
  );
}

Realistic Example

We provide a more real sample app here.

Example App Running

Props

The MercadoPago WebTokenize Checkout component support the following props:

PropertiesTypesDefault ValueDescription
amountnumbernoneThe amount to pay for the product
actionstringnoneThe action where the data will be sent
publicKeystringnoneThe Public Key for MP
keepOpenbooleannoneFlag to restore the payment state if failure
cardsIdsstring[]noneThe cards associated to the customer
customerIdstringnoneThe ID for the customer
themeobjectnoneThe theme for the checkout
productLabelstringnoneThe label for the product
discountLabelstringnoneThe theme for the checkout
maxInstallmentsnumbernoneThe label for the discount
discountnumbernoneThe amount for the discount
shippingnumbernoneThe amount for the shipping
chargenumbernoneThe amount for the additional charge
taxesnumbernoneThe amount for the taxes
arrearsnumbernoneThe amount for the arrears
styleobjectnoneThe additional styles to customize the WebView

The theme has the following props:

PropertiesTypesDefault ValueDescription
elementsstringnoneHexadecimal color for all the elements
headerstringnoneHexadecimal color for the header

Issues

Please, open an issue following one of the issues templates. We will do our best to fix them.

Contributing

If you want to contribute to this project see contributing for more information.

License

Distributed under the MIT license. See LICENSE for more information.