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

@zeply-ou/payments

v1.29.1

Published

It is a React Components and Capacitor plugin library built in `React 18.2.0` and `Capacitor 5.0.0`.

Downloads

586

Readme

@zeply-ou/payments

It is a React Components and Capacitor plugin library built in React 18.2.0 and Capacitor 5.0.0.

For users having their application built using another framework, e.g Angular, Vue or for version incompatibility issues with React, we provide a helper package which wraps this package and export is as a web component.

More details here

Installation

Install it with NPM / YARN

npm install @zeply-ou/payments

or:

yarn add @zeply-ou/payments

Documentation

Visit the official Zeply developer site for more information about integrating this package into your website.

Usage

import React from 'react';
import ReactDOM from 'react-dom';
import {
    PaymentEvent,
    PaymentEventType,
    PaymentGatewayEnvType,
    PaymentGatewaySupportedLanguages,
    TransactionTokenType,
    ZPCTheme,
    ZeplyPayConnect
} from "@zeply-ou/payments";

const App = () => {
   /**
    * You need to provide a valid token value 
    * based on the environment and the transaction type.
    **/
    const token = '[RAW JWT TOKEN]',

    const theme: ZPCTheme = {
        background: '#FFFFFF',
        primary: '#000000',
        text: '#000000',
        success: '#25AE88',
        error: '#D75A4A',
        buttonsMode: 'black'
    };
     
    return (
        <ZeplyPayConnect
            transactionToken={token}
            transactionType={TransactionTokenType.PAYIN}
            environment={PaymentGatewayEnvType.DEV}
            locale={PaymentGatewaySupportedLanguages.EN}
            theme={theme}
        />
    );
};

ReactDOM.render(<App/>, document.getElementById('root'));

Callbacks

Below is a React code snippet showing how to listen and add your own custom logic based on the variety of values of the paymentEvent variable, using window event listeners.

import React, { useContext, useEffect } from 'react'; 
import { PaymentEvent, ZEPLY_PAY_CONNECT_EVENT } from "@zeply-ou/payments"

 useEffect(() => {
    const customEventListener =
      (event: CustomEventInit<PaymentEvent>) => {
      switch (event.detail?.type) {
        case PaymentEvenType.INITIATING:
          // custom logic you may add while the ZPC is initiating
          // useful for adding your own custom loader perhaps
          break;
        case PaymentEventType.IDLE:
          // custom logic you may add while the ZPC has been loaded
          // useful for removing your own loader perhaps
          break;
        case PaymentEventType.PAYMENT_SUBMITTED:
          // custom on payment submitted logic
          break;
        case PaymentEventType.PAYMENT_SUCCESS:
          // custom on payment success logic
          break;
        case PaymentEventType.PAYMENT_FAILED:
          // custom on payment fail logic
          break;
        case PaymentEventType.PAYMENT_ERROR:
          // custom on payment error logic
          break;
        case PaymentEventType.PAYMENT_CANCELED:
          // custom on payment cancel logic
          break;
        case PaymentEventType.PAYOUT_SUBMITTED:
          // custom on payout submitted logic
          break;
        case PaymentEventType.PAYOUT_FAILED:
          // custom on payout fail logic
          break;
        case PaymentEventType.PAYOUT_CANCELED:
          // custom on payout cancel logic
          break;
        case PaymentEventType.PAYOUT_ERROR:
          // custom on payout error logic
          break;
        case PaymentEventType.APPLE_PAY_CANCELED:
          // custom on payment apple pay cancelled logic
          // applicable only for apple pay payments
          break;
        case PaymentEventType.GOOGLE_PAY_CANCELED:
          // custom on payment google pay cancelled logic
          // applicable only for google pay payments
          break;
        {/* and so on.. */}
      }
    };

    window.addEventListener(ZEPLY_PAY_CONNECT_EVENT, customEventListener);

    return () => {
      window.removeEventListener(ZEPLY_PAY_CONNECT_EVENT, customEventListener);
    };
  }, []);

Normally as you are integrating with our all in one solution you won't care to add your own custom logic in most of those events.

Usually for these cases the most important ones that you may want to listen are the

  • PAYMENT_CANCELED
  • PAYMENT_CLOSED
  • PAYOUT_CANCELED
  • PAYOUT_CLOSED

Of course you are eligible to listen to all type of event if desire.

Options

| Option | Description | Type | Required | | ------------------- | ------------------------------------------------------------------------------------- | ---------------------------------- | ------------ | | transactionToken | The raw jwt value of the token related to either payins or payouts. | string | true | | transactionType | The type of transaction. | TransactionTokenType | true |
| environment | This should be one of the 3 Zeply environments in addition with a local environment. | PaymentGatewayEnvType | true | | locale | One of zeply pay connect supported languages. | PaymentGatewaySupportedLanguages | true | | debug | Allows zpc logs for debugging purposes | boolean | false | | theme | The theme of the payment gateway | ZPCTheme | false |

Interfaces

TransactionTokenType

enum TransactionTokenType {
  PAYIN = 'PAYIN',
  PAYOUT = 'PAYOUT'
}

PaymentGatewayEnvType

enum PaymentGatewayEnvType {
  /**
   * LOCAL env is used for local development purposes only
   * and only used along with proxy configuration.
   */
  LOCAL = '/',
  DEV = 'https://dev-payments.zeply.com',
  STG = 'https://stg-payments.zeply.com',
  PROD = 'https://payments.zeply.com'
}

PaymentGatewaySupportedLanguages

enum PaymentGatewaySupportedLanguages {
  EN = 'en',
  ET = 'et',
  ES = 'es',
  FR = 'fr',
  DE = 'de',
  NL = 'nl',
  PT = 'pt'
}

ZPCTheme

type ButtonsMode = 'white' | 'black';

type ZPCTheme = {
  background: string;
  primary: string;
  text: string;
  success: string;
  error: string;
  buttonsMode: ButtonsMode;
};

PaymentEvent

interface PaymentEvent {
  type: PaymentEventType;
  details?: string;
  code?: HttpStatusCode;
}