npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

rn-pstack

v0.2.1

Published

This is a react native library for paystack that supports more recent conventions around how payments are handled via paystack on react native applications on both iOS and Android.

Downloads

4

Readme

react-native-paystack

This is a react native library for paystack that supports more recent conventions around how payments are handled via paystack on react native applications on both iOS and Android.

Installation

npm install rn-pstack

Usage

PayWithPaystackCheckout

1. Import the component

First, import the PayWithPaystackCheckout component from the library:

import { PayWithPaystackCheckout } from 'rn-pstack';

2. Set up the component

Use the PayWithPaystackCheckout component in your React Native app:

<PayWithPaystackCheckout
  checkoutUrl="https://checkout.paystack.com/your-unique-checkout-url"
  onSuccess={(reference) => console.log('Payment successful:', reference)}
  onCancel={() => console.log('Payment cancelled')}
  onError={(error) => console.log('Payment error:', error)}
  activityIndicatorColor="#000000"
/>

3. Props

  • checkoutUrl (required): The unique Paystack checkout URL for the transaction.
  • onSuccess (required): Callback function called when the payment is successful. It receives the transaction reference as a parameter.
  • onCancel (required): Callback function called when the user cancels the payment.
  • onError (required): Callback function called when an error occurs during the payment process.
  • activityIndicatorColor (optional): Color of the loading indicator. Default is system color.
  • containerStyle (optional): Style object for the container view.
  • webViewStyle (optional): Style object for the WebView.

4. Handling responses

The component will automatically handle the payment flow and call the appropriate callback function based on the transaction result.

  • On successful payment, onSuccess will be called with the transaction reference.
  • If the user cancels the payment, onCancel will be called.
  • If an error occurs during the payment process, onError will be called with an error message.

5. Customization

You can customize the appearance of the component using the containerStyle and webViewStyle props:

<PayWithPaystackCheckout
  checkoutUrl="https://checkout.paystack.com/your-unique-checkout-url"
  onSuccess={(reference) => console.log('Payment successful:', reference)}
  onCancel={() => console.log('Payment cancelled')}
  onError={(error) => console.log('Payment error:', error)}
  containerStyle={{ backgroundColor: '#f0f0f0' }}
  webViewStyle={{ borderRadius: 10 }}
/>

2. PayWithPaystackInline

Import the component

import { PayWithPaystackInline } from 'rn-pstack';

Use the component

<PayWithPaystackInline
  paystackKey="your-paystack-public-key"
  billingEmail="[email protected]"
  amount="10000"
  onSuccess={(reference) => console.log('Payment successful:', reference)}
  onCancel={() => console.log('Payment cancelled')}
  onError={(error) => console.log('Payment error:', error)}
  activityIndicatorColor="#000000"
/>

Props

  • paystackKey (required): Your Paystack public key.
  • billingEmail (required): The customer's email address.
  • amount (required): The amount to be paid (in the smallest currency unit, e.g., kobo for NGN).
  • onSuccess (required): Callback function called when the payment is successful. It receives the transaction reference as a parameter.
  • onCancel (required): Callback function called when the user cancels the payment.
  • onError (required): Callback function called when an error occurs during the payment process.
  • activityIndicatorColor (optional): Color of the loading indicator. Default is system color.
  • containerStyle (optional): Style object for the container view.
  • webViewStyle (optional): Style object for the WebView.
  • currency (optional): The transaction currency (default: NGN).
  • channels (optional): Payment channels to enable.
  • refNumber (optional): Unique transaction reference.
  • firstName (optional): Customer's first name.
  • lastName (optional): Customer's last name.
  • phone (optional): Customer's phone number.
  • billingName (optional): Customer's billing name.
  • subaccount (optional): The subaccount to split the payment with.

This component provides an inline payment form for Paystack transactions, allowing for a more customized payment experience within your React Native app.

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT


Made with create-react-native-library