pie-react-native

0.1.5 • Public • Published

Pie Payment System

npm download

Index

Install

pie-react-native

Usage

PiePayment component requires the following props.

Property Type Default Description
pubKey string none Your business public key
amount number none Amount in Naira
customer string none The customer's email address
callback func none Callback to retrieve the transaction reference. This function will be called on successful charge
wallet string default The wallet tag you want to credit
commission number 0 Your commission or service charge
commissionWallet string default The business wallet tag to credit with commission
inclusive bool true true means you will incur transaction charges and vice versa

On successful charge, PiePayment will call your callback with object with the following properties

Property Type Description
trxref string The transaction reference with the prefix chg_. You can use this string to verify a transaction on your server
raw object Detail transaction response
import React, { Component } from 'react'
import { View, Button } from 'react-native'
import PiePayment from 'pie-react-native'
 
class PaymentPage extends Component {
 
  constructor() {
    this.state = {
      visibility: false
    }
  }
 
  callback(transactionData) {
    console.log(transactionData)
  }
 
  render() {
    return (
      <View>
        <Button
          onPress={() => this.setState({visibility: true})}>Pay</Button>
        <PiePayment
          pubKey="pk_WG3VlzyJ2NhcFbIr"
          wallet="default"
          commission={10}
          amount={5000}
          customer="sales@logicaladdress.com"
          visible={this.state.visibility}
          callback={(data) => this.callback(data)} />
      </View>
    )
  }
}

Development

  1. Fork/clone this repository
  2. Run npm install
  3. Make changes
  4. Run npm test when you're done
  5. Submit a pull request

Notes

For a working example, clone and run this repo

Readme

Keywords

Package Sidebar

Install

npm i pie-react-native

Weekly Downloads

1

Version

0.1.5

License

MIT

Last publish

Collaborators

  • kilobyte