Modules
paypal
paypal
A Nuxt module for simplifying the use of Paypal in your project.
A Nuxt module for simplifying the use of Paypal in your project.
Features
- Easy Integration
Quick Setup
- Add
nuxt-paypal
dependency to your project
# Using pnpm
pnpm add -D nuxt-paypal
# Using yarn
yarn add --dev nuxt-paypal
# Using npm
npm install --save-dev nuxt-paypal
- Add
nuxt-paypal
to themodules
section ofnuxt.config.ts
export default defineNuxtConfig({
modules: [
'nuxt-paypal',
],
paypal: {
clientId: 'your_client_id',
},
})
That's it! You can now use Nuxt Paypal in your Nuxt app ✨
Configuration
just add paypal
and configure it.
By default
clientId
is configured to use the value ofPAYPAL_CLIENT_ID
. If no specific value is provided, it defaults totest
.
export default defineNuxtConfig({
paypal: {
clientId: 'your_client_id',
// ...options
},
})
Usage
nuxt-paypal
has a usePaypalButton
composable which you can see the usage here.
also you can find the paypal instance from nuxtApp as $paypal
. example:
<script setup lang="ts">
const nuxt = useNuxtApp()
console.log(nuxt.$paypal?.version)
</script>
Development
# Install dependencies
npm install
# Generate type stubs
npm run dev:prepare
# Develop with the playground
npm run dev
# Build the playground
npm run dev:build
# Run ESLint
npm run lint
# Run Vitest
npm run test
npm run test:watch
# Release new version
npm run release