vue-paystack is a Vue 2.x component designed to integrate the Paystack payment gateway into web applications. It provides a `<paystack>` component that wraps the Paystack inline and popup payment experiences, allowing developers to configure payment details such as amount, email, and public key via props, and handle callbacks for success and closure events. The package is currently at version 2.0.4 and appears to have a sporadic release cadence, primarily focusing on maintaining compatibility with Vue 2.x. A key differentiator is its straightforward, declarative integration for Vue 2 projects, abstracting the direct Paystack API calls into a component-based structure. It is specifically designed for Vue 2 applications, with no explicit support for Vue 3.
npm install vue-paystackVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to integrate the vue-paystack component into a Vue 2.x Single File Component, passing required props like amount, email, public key, and handling callback functions for payment success and closure.
Review the specific changes in the GitHub commit history around 'major upgrade implemented' and 'remove promise from computed' (v2.0.2) if issues arise. Ensure props like `paystackkey`, `callback`, and `close` are correctly passed as functions or strings.
For Vue 3 projects, seek an alternative Paystack integration library or consider migrating the component logic to Vue 3 manually.
Always use a secure method for managing API keys, such as environment variables (`process.env.VUE_APP_PAYSTACK_PUBLIC_KEY`) during development and fetching from a backend service in production. Double-check that you're using the correct public key (starts with `pk_`) for your environment.
Always multiply your target currency amount by 100 to convert it to kobo/cents before passing it to the `amount` prop. E.g., for NGN 10,000, set `amount: 10000 * 100 = 1000000`.
Ensure `import paystack from 'vue-paystack';` is present and the component is listed in the `components` option: `components: { paystack }`.Ensure the `<script src="https://unpkg.com/vue-paystack/dist/paystack.min.js"></script>` tag is correctly placed in your HTML, preferably after the Vue library script and before your application script.
Provide a valid Paystack public key to the `paystackkey` prop, e.g., `:paystackkey="'pk_test_xxxxxxxxxxxxxxxxxxxxxxx'"`.