1.5.2 • Published 5 months ago

@toneflix/paystack-inline v1.5.2

Weekly downloads
-
License
ISC
Repository
github
Last release
5 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

5 months ago

1.4.3

5 months ago

1.5.2

5 months ago

1.5.1

5 months ago

1.5.0

5 months ago

1.4.2

7 months ago

1.4.1

7 months ago

1.4.0

7 months ago

1.3.7

7 months ago

1.3.6

7 months ago

1.3.5

7 months ago

1.3.4

7 months ago

1.3.3

7 months ago

1.3.2

7 months ago

1.3.1

8 months ago

1.3.0

8 months ago

1.2.5

8 months ago

1.2.4

8 months ago

1.2.3

8 months ago

1.2.2

8 months ago

1.2.1

8 months ago

1.2.0

8 months ago

1.1.1

8 months ago

1.1.0

8 months ago

1.0.39

8 months ago

1.0.38

8 months ago

1.0.9

8 months ago

1.0.8

8 months ago

1.0.40

8 months ago

1.0.43

8 months ago

1.0.42

8 months ago

1.0.41

8 months ago

1.0.33

8 months ago

1.0.32

8 months ago

1.0.31

8 months ago

1.0.30

8 months ago

1.0.37

8 months ago

1.0.36

8 months ago

1.0.35

8 months ago

1.0.34

8 months ago

1.0.7

8 months ago

1.0.6

8 months ago

1.0.5

8 months ago

1.0.4

8 months ago

1.0.22

8 months ago

1.0.19

8 months ago

1.0.18

8 months ago

1.0.21

8 months ago

1.0.20

8 months ago

1.0.17

8 months ago

1.0.16

9 months ago

1.0.15

9 months ago

1.0.0

9 months ago

1.0.14

9 months ago