0.1.5 • Published 7 years ago

pie-react-native v0.1.5

Weekly downloads
13
License
MIT
Repository
github
Last release
7 years ago

Pie Payment System

npm download

Index

Install

pie-react-native

Usage

PiePayment component requires the following props.

PropertyTypeDefaultDescription
pubKeystringnoneYour business public key
amountnumbernoneAmount in Naira
customerstringnoneThe customer's email address
callbackfuncnoneCallback to retrieve the transaction reference. This function will be called on successful charge
walletstringdefaultThe wallet tag you want to credit
commissionnumber0Your commission or service charge
commissionWalletstringdefaultThe business wallet tag to credit with commission
inclusivebooltruetrue means you will incur transaction charges and vice versa

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

PropertyTypeDescription
trxrefstringThe transaction reference with the prefix chg_. You can use this string to verify a transaction on your server
rawobjectDetail 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