1.3.1 • Published 6 months ago

react-native-khenshin v1.3.1

Weekly downloads
-
License
MIT
Repository
-
Last release
6 months ago

react-native-khenshin

This is a fork of https://github.com/khipu/react-native-khenshin published to npmjs.com.

Add the library to your project

npm install react-native-khenshin

Install and configure

Usage

import React from 'react';
import {SafeAreaView, ScrollView, Button} from 'react-native';
import khenshin from 'react-native-khenshin';

function App(this: any): JSX.Element {
    const onStartPayment = () => {
        khenshin.startPaymentById('mboyd2tem42r')
            .then(({status, result}) => {
                if (status === 'CONCILIATING') {
                    // khenshin is conciliating the payment
                } else if (status === 'USER_CANCELED') {
                    // The user cancelled the transaction
                } else {
                    // Error!, see `result` for details
                    console.log(result);
                }
            })
            .catch((err: any) => console.log({err}));
    };

    return (
        <SafeAreaView>
            <ScrollView>
                <Button title={'pagar'} onPress={onStartPayment} />
            </ScrollView>
        </SafeAreaView>
);
}

export default App;

Example project