0.1.3 • Published 4 years ago

baokim-react v0.1.3

Weekly downloads
5
License
ISC
Repository
gitlab
Last release
4 years ago

Baokim React

Installation

npm i baokim-react

How To Use

First import this component where you want to use it

import Baokim from "baokim-react";

Then just renders it:

<Baokim
    type='pro' // pro or checkout
    apiKey = 'a18ff78e7a9e44f38de372e093d87ca1'
    configOrder = {{ // order config
        mrc_order_id: `my_order_id_${Math.random().toString(36).substring(2)}_${Date.now()}`,
        total_amount: 60000,
        payment_method_type: 'card',
        description: 'thanh toan dien thoai iphone xs max gia re',
        success_url: 'http://my-merchant.com/callback-success',
        cancel_url: 'http://my-merchant.com/callback-cancel',
    }}
    configButton = {{ // button config
        title: 'Thanh toán voi baokim',
        style: {
            background: '#fff',
            color: '#333'
        }
    }}
/>

Props

PropDescriptionRequireDefaultValue
typetype for displaytruemust be checkout or pro
apiKeykey from baokimtrueNULL
configOrderparams for send to baokimtrueobject
configButtonconfig for display button when type is checkoutfalseobject

configOrder

PropDescriptionRequireDefault Value
mrc_order_idmerchant order idtrueanything string
total_amounttotal amounttrueNULL
payment_method_typepayment_method_typetrueanything string
descriptiondescription about this orderfalseNULL
success_urlwebhook when order successtrueNULL
cancel_urlwebhook when order canceltrueNULL

configButton

PropDescriptionRequireDefault Value
titlebutton titlefalseThanh toán với bảo kim
stylestyle css for this buttonfalsecolor: #333

Example

import React, { Component } from "react";
import Baokim from "baokim-react";

class App extends Component {
  render() {
        return (
            <Baokim
                type='pro' // pro or checkout
                apiKey = 'a18ff78e7a9e44f38de372e093d87ca1'
                configOrder = {{ // order config
                    mrc_order_id: `my_order_id_${Math.random().toString(36).substring(2)}_${Date.now()}`,
                    total_amount: 60000,
                    payment_method_type: 'card',
                    description: 'thanh toan dien thoai iphone xs max gia re',
                    success_url: 'http://my-merchant.com/callback-success',
                    cancel_url: 'http://my-merchant.com/callback-cancel',
                }}
                configButton = {{ // button config
                    title: 'Thanh toán voi baokim',
                    style: {
                        background: '#fff',
                        color: '#333'
                    }
                }}
            />
        );
  }
}

export default App;
0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago