1.5.2 • Published 8 months ago

@toneflix/paystack-inline v1.5.2

Weekly downloads
-
License
ISC
Repository
github
Last release
8 months ago

Vue Paystack Inline

npm npm

Simple Paystack Inline component for Vue 3

Documentation

Read the full documentation here: https://toneflix.github.io/vue-component-pack/paystack-inline

Installation

npm install @toneflix/paystack-inline
#or
yarn add @toneflix/paystack-inline
#or
pnpm add @toneflix/paystack-inline

Usage

Global Registration

You can make Paystack Inline available throughout your Vue project.

main.js or main.ts

import '@toneflix/paystack-inline/dist/lib/style.css'
import { createApp } from 'vue'
import App from './app.vue'
import PaystackInline from '@toneflix/paystack-inline'

const app = createApp(App)
app.use(PaystackInline)
app.mount('#app')

Local Registration

You can also import the component in your Vue component.

SomeComponent.vue

<script setup>
import '@toneflix/paystack-inline/dist/lib/style.css'
import { PaystackInline } from '@toneflix/paystack-inline'
</script>

Use the Registered Component in Your Vue Template

SomeComponent.vue

<script setup lang="ts">
import '@toneflix/paystack-inline/dist/lib/style.css'
import { PaystackInline } from '@toneflix/paystack-inline'
import { ref } from 'vue'

const pKey = ref('pk_test_TYooMQauvdEDq54NiTphI7jx')
</script>

<template>
  <div style="display: flex; flex-direction: row;">
    <PaystackInline
      dont-verify
      :amount="1000"
      :customer="{
        email: 'john@example.com'
      }"
      :public-key="pKey"
    />
  </div>
</template>

Verify Payment

To verify a payment, simply set the value of the reference model attribute and provide the verify-callback attribute which is a function that returns a promise that resolves to an object of {status: boolean, message: string}. Also set the hidden attribute if you do not want to display the payment button.

VerifyComponent.vue

<script setup lang="ts">
import '@toneflix/paystack-inline/dist/lib/style.css'
import { PaystackInline } from '@toneflix/paystack-inline'
import { ref } from 'vue'

const pKey = ref('pk_test_TYooMQauvdEDq54NiTphI7jx')
const reference = ref()

const verify = () => {
  reference = 'sdsdsdsd'
}
</script>

<template>
  <div style="display: flex; flex-direction: row;">
    <PaystackInline
      hidden
      :amount="1000"
      :customer="{
        email: 'john@example.com'
      }"
      v-model:reference="reference"
      :verify-callback="
        () => {
          return new Promise((resolve) =>
            resolve({
              status: true,
              message: 'Verified'
            })
          )
        }
      "
    />
  </div>
</template>

Default Slot

SlutComponent.vue

<script setup lang="ts">
import '@toneflix/paystack-inline/dist/lib/style.css'
import { PaystackInline } from '@toneflix/paystack-inline'
import { ref } from 'vue'

const pKey = ref('pk_test_TYooMQauvdEDq54NiTphI7jx')
</script>

<template>
  <div style="display: flex; flex-direction: row;">
    <PaystackInline
      dont-verify
      :amount="1000"
      :customer="{
        email: 'john@example.com'
      }"
      :public-key="pKey"
    >
      <template #default="{ initialize, loading }">
        <button class="pay-button" :disabled="loading" @click="initialize()">
          {{ !loading ? 'Pay Now' : '' }}
          <div class="spinner" v-if="loading"></div>
        </button>
      </template>
    </PaystackInline>
  </div>
</template>
1.4.4

8 months ago

1.4.3

8 months ago

1.5.2

8 months ago

1.5.1

8 months ago

1.5.0

8 months ago

1.4.2

9 months ago

1.4.1

9 months ago

1.4.0

9 months ago

1.3.7

10 months ago

1.3.6

10 months ago

1.3.5

10 months ago

1.3.4

10 months ago

1.3.3

10 months ago

1.3.2

10 months ago

1.3.1

10 months ago

1.3.0

10 months ago

1.2.5

10 months ago

1.2.4

10 months ago

1.2.3

10 months ago

1.2.2

10 months ago

1.2.1

10 months ago

1.2.0

10 months ago

1.1.1

10 months ago

1.1.0

10 months ago

1.0.39

10 months ago

1.0.38

10 months ago

1.0.9

11 months ago

1.0.8

11 months ago

1.0.40

10 months ago

1.0.43

10 months ago

1.0.42

10 months ago

1.0.41

10 months ago

1.0.33

11 months ago

1.0.32

11 months ago

1.0.31

11 months ago

1.0.30

11 months ago

1.0.37

10 months ago

1.0.36

11 months ago

1.0.35

11 months ago

1.0.34

11 months ago

1.0.7

11 months ago

1.0.6

11 months ago

1.0.5

11 months ago

1.0.4

11 months ago

1.0.22

11 months ago

1.0.19

11 months ago

1.0.18

11 months ago

1.0.21

11 months ago

1.0.20

11 months ago

1.0.17

11 months ago

1.0.16

11 months ago

1.0.15

11 months ago

1.0.0

11 months ago

1.0.14

11 months ago