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

vue-korapay

v1.1.2

Published

Vue Korapay for Vue 2.x.

Downloads

7

Readme

Korapay for Vue 2.x

Demo

This helps you accept payment using Korapay’s Collection Modal in your Vue app

NPM JavaScript Style Guide

Install

Vue

Install the npm package:

npm install --save vue-korapay
# OR
yarn add vue-korapay

Add the Vue plugin in your main.js and pass your public key:

import Vue from 'vue'
import Korapay from 'vue-korapay'

Vue.use(Korapay, {publicKey: 'pk_test_**********************'})

Nuxt

Install the npm package:

npm install --save vue-korapay
# OR
yarn add vue-korapay

Create a korapay.js file in your plugins folder and add the Vue plugin:

// plugins/korapay.js

import Vue from 'vue'
import Korapay from 'vue-korapay'

Vue.use(Korapay, {publicKey: 'pk_test_**********************'})

Go to your nuxt.config.js and add it to your plugin section

/*
** Plugins to load before mounting the App
** https://nuxtjs.org/guide/plugins
*/
............
plugins: [{src: '~/plugins/korapay', ssr: false},],
...........

Usage

1. Using the method

Korapay can be called using $payWithKorapay() method, see example below

<template>
  <form action="#" @submit.prevent="makePayment">
    <div class="btn-wrapper">
      <input type="number" v-model.number="amount" />
      <button type="submit">Make Payment</button>
    </div>
  </form>
</template>

<script>
export default {
  data () {
    return {
      amount: 200
    }
  },

  methods: {
    makePayment () {
      this.$payWithKorapay({
        amount: this.amount,
        customer: {
          name: 'John Doe',
          email: '[email protected]'
        },
        onClose: function () {
          // Handle when modal is closed
        },
        onSuccess: function (data) {
          // Handle when payment is successful
          console.log(data)
        },
        onFailed: function (data) {
          // Handle when payment fails
          console.log(data)
        }
      })
    }
  }
}
</script>

2. Using the component

Korapay can be called using the Korapay component eg: <Korapay>Pay Now</Korapay>. See example below

<template>
  <Korapay :amount="3000" korapayClass="btn-kpy --full-green" customer_name="John Doe" customer_email="[email protected]" @onClose="paymentClosed" @onSuccess="paymentSuccessful" @onFailed="paymentFailed">
    Make Payment
  </Korapay>
</template>

<script>
export default {
  methods: {
    makePayment () {
      paymentClosed() {
        console.log('Payment Closed')
      },
      paymentSuccessful(data) {
        console.log('Payment Succeesful', data)
      },
      paymentFailed(data) {
        console.log('Payment Failed', data)
      }
    }
  }
}
</script>

$payWithKorapay() Method

Parameters

| Field | Data Type | Description | | ---------------- | ------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | amount | integer | Required - Amount in naira | | customer | | Required - JSON object containing customer details | | customer.name | string | Required - field in the customer object. Customer name derived from name enquiry. | | customer.email | string | Required - field in the customer object. Customer email address | | currency | string | Optional - Currency of the charge. Default is NGN (Nigerian Naira) | | reference | string | Optional - transaction reference. If you do not provide one, a unique transaction reference would be generated for the transaction. | | reference | string | Optional - transaction reference. If you do not provide one, a unique transaction reference would be generated for the transaction. | | notification_url | string | Optional - HTTP endpoint to send information to on payment termination, success, or failure. This overrides the webhook URL set on your merchant dashboard for this particular transaction | | narration | string | Optional - Information/narration about the transaction | | channels | array[string] | Optional - Methods of payment eg. Bank (bank_transfer), card(card). Default is [“bank_transfer”, “card”] | | container | string | Optional - Id of HTML element you want the payment gateway to be contained in. Note that this would reset all styling on this element. The payment gateway would be resized to fit the container. If this is not set, the payment gateway fills the available screen size. |

Events

| Field | Data Type | Description | | ----------- | ---------- | --------------------------------------------------------------------------------- | | onClose | [Function] | Optional - function to be called when the payment gateway is closed | | onSuccess | [Function] | Optional - function to be called when the payment is completed successfully | | onFailed | [Function] | Optional - function to be called when the payment failed | | onTokenized | [Function] | Optional - function to be called when card tokenization is completed successfully |

Korapay Component

Parameters

| Field | Data Type | Description | | ---------------- | ------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | korapayClass | string | Optional - Pass css classes to style your component | | disabled | boolean | Optional - Disable or Enable the payment button | | amount | integer | Required - Amount in naira | | customer_name | string | Required - field in the customer object. Customer name derived from name enquiry. | | customer_email | string | Required - field in the customer object. Customer email address | | currency | string | Optional - Currency of the charge. Default is NGN (Nigerian Naira) | | reference | string | Optional - transaction reference. If you do not provide one, a unique transaction reference would be generated for the transaction. | | reference | string | Optional - transaction reference. If you do not provide one, a unique transaction reference would be generated for the transaction. | | notification_url | string | Optional - HTTP endpoint to send information to on payment termination, success, or failure. This overrides the webhook URL set on your merchant dashboard for this particular transaction | | narration | string | Optional - Information/narration about the transaction | | channels | array[string] | Optional - Methods of payment eg. Bank (bank_transfer), card(card). Default is [“bank_transfer”, “card”] | | container | string | Optional - Id of HTML element you want the payment gateway to be contained in. Note that this would reset all styling on this element. The payment gateway would be resized to fit the container. If this is not set, the payment gateway fills the available screen size. |

Events

| Field | Data Type | Description | | ------------ | ---------- | --------------------------------------------------------------------------------- | | @onClose | [Function] | Optional - function to be called when the payment gateway is closed | | @onSuccess | [Function] | Optional - function to be called when the payment is completed successfully | | @onFailed | [Function] | Optional - function to be called when the payment failed | | @onTokenized | [Function] | Optional - function to be called when card tokenization is completed successfully |

The Korapay component accepts a slot so you can pass in more data into your button apart from plain text

Please checkout Korapay Documentation for more explanation

License

Follow on Twitter @mrflamez_

MIT © kingflamez