A work-in-progress plugin intended to connect Payload CMS with It is built from the standard Payload plugin template and targets Payload 3.37 or newer. The actual Polar functionality is not yet described.
A blank template to get started with Payload 3.0
Installation
npm i payload-polar0
Stars
0
Forks
0
Open Issues
1 years ago
Last Updated
6
Weekly Downloads
v1.0.0
npm Version
26.2 KB
Unpacked Size
0
Dependencies
00 since Sep 6
| Date | Stars |
|---|---|
| Dec 5, 2026 | 0 |
| Dec 4, 2026 | 0 |
| Dec 3, 2026 | 0 |
| Dec 2, 2026 | 0 |
| Dec 1, 2026 | 0 |
| Nov 30, 2026 | 0 |
| Nov 29, 2026 | 0 |
| Nov 28, 2026 | 0 |
| Nov 27, 2026 | 0 |
| Nov 26, 2026 | 0 |
| Nov 25, 2026 | 0 |
| Nov 24, 2026 | 0 |
| Nov 23, 2026 | 0 |
| Nov 22, 2026 | 0 |
| Nov 21, 2026 | 0 |
| Nov 20, 2026 | 0 |
| Nov 19, 2026 | 0 |
| Nov 18, 2026 | 0 |
| Nov 17, 2026 | 0 |
| Nov 16, 2026 | 0 |
| Nov 15, 2026 | 0 |
| Nov 14, 2026 | 0 |
| Nov 13, 2026 | 0 |
| Nov 12, 2026 | 0 |
| Nov 11, 2026 | 0 |
| Nov 10, 2026 | 0 |
| Nov 9, 2026 | 0 |
| Nov 8, 2026 | 0 |
| Nov 7, 2026 | 0 |
| Nov 6, 2026 | 0 |
| Nov 5, 2026 | 0 |
| Nov 4, 2026 | 0 |
| Nov 3, 2026 | 0 |
| Nov 2, 2026 | 0 |
| Nov 1, 2026 | 0 |
| Oct 31, 2026 | 0 |
| Oct 30, 2026 | 0 |
| Oct 29, 2026 | 0 |
| Oct 28, 2026 | 0 |
| Oct 27, 2026 | 0 |
| Oct 26, 2026 | 0 |
| Oct 25, 2026 | 0 |
| Oct 24, 2026 | 0 |
| Oct 23, 2026 | 0 |
| Oct 22, 2026 | 0 |
| Oct 21, 2026 | 0 |
| Oct 20, 2026 | 0 |
| Oct 19, 2026 | 0 |
| Oct 18, 2026 | 0 |
| Oct 17, 2026 | 0 |
| Oct 16, 2026 | 0 |
| Oct 15, 2026 | 0 |
| Oct 14, 2026 | 0 |
| Oct 13, 2026 | 0 |
| Oct 12, 2026 | 0 |
| Oct 11, 2026 | 0 |
| Oct 10, 2026 | 0 |
| Oct 9, 2026 | 0 |
| Oct 8, 2026 | 0 |
| Oct 7, 2026 | 0 |
| Oct 6, 2026 | 0 |
| Oct 5, 2026 | 0 |
| Oct 4, 2026 | 0 |
| Oct 3, 2026 | 0 |
| Oct 2, 2026 | 0 |
| Oct 1, 2026 | 0 |
| Sep 30, 2026 | 0 |
| Sep 29, 2026 | 0 |
| Sep 28, 2026 | 0 |
| Sep 27, 2026 | 0 |
| Sep 26, 2026 | 0 |
| Sep 25, 2026 | 0 |
| Sep 24, 2026 | 0 |
| Sep 23, 2026 | 0 |
| Sep 22, 2026 | 0 |
| Sep 21, 2026 | 0 |
| Sep 20, 2026 | 0 |
| Sep 19, 2026 | 0 |
| Sep 18, 2026 | 0 |
| Sep 17, 2026 | 0 |
| Sep 16, 2026 | 0 |
| Sep 15, 2026 | 0 |
| Sep 14, 2026 | 0 |
| Sep 13, 2026 | 0 |
| Sep 12, 2026 | 0 |
| Sep 11, 2026 | 0 |
| Sep 10, 2026 | 0 |
| Sep 9, 2026 | 0 |
| Sep 8, 2026 | 0 |
| Sep 7, 2026 | 0 |
| Sep 6, 2026 | 0 |
4−2 since Sep 6
| Date | Weekly downloads |
|---|---|
| Dec 5, 2026 | 4 |
| Dec 4, 2026 | 4 |
| Dec 3, 2026 | 2 |
| Dec 2, 2026 | 2 |
| Dec 1, 2026 | 4 |
| Nov 30, 2026 | 4 |
| Nov 29, 2026 | 4 |
| Nov 28, 2026 | 4 |
| Nov 27, 2026 | 4 |
| Nov 26, 2026 | 4 |
| Nov 25, 2026 | 4 |
| Nov 24, 2026 | 2 |
| Nov 23, 2026 | 2 |
| Nov 22, 2026 | 2 |
| Nov 21, 2026 | 2 |
| Nov 20, 2026 | 1 |
| Nov 19, 2026 | 2 |
| Nov 18, 2026 | 3 |
| Nov 17, 2026 | 3 |
| Nov 16, 2026 | 5 |
| Nov 15, 2026 | 4 |
| Nov 14, 2026 | 4 |
| Nov 13, 2026 | 6 |
| Nov 12, 2026 | 7 |
| Nov 11, 2026 | 6 |
| Nov 10, 2026 | 7 |
| Nov 9, 2026 | 5 |
| Nov 8, 2026 | 6 |
| Nov 7, 2026 | 6 |
| Nov 6, 2026 | 4 |
| Nov 5, 2026 | 2 |
| Nov 4, 2026 | 2 |
| Nov 3, 2026 | 1 |
| Nov 2, 2026 | 5 |
| Nov 1, 2026 | 4 |
| Oct 31, 2026 | 4 |
| Oct 30, 2026 | 4 |
| Oct 29, 2026 | 4 |
| Oct 28, 2026 | 4 |
| Oct 27, 2026 | 5 |
| Oct 26, 2026 | 2 |
| Oct 25, 2026 | 2 |
| Oct 24, 2026 | 4 |
| Oct 23, 2026 | 4 |
| Oct 22, 2026 | 5 |
| Oct 21, 2026 | 5 |
| Oct 20, 2026 | 4 |
| Oct 19, 2026 | 3 |
| Oct 18, 2026 | 4 |
| Oct 17, 2026 | 3 |
| Oct 16, 2026 | 3 |
| Oct 15, 2026 | 3 |
| Oct 14, 2026 | 3 |
| Oct 13, 2026 | 3 |
| Oct 12, 2026 | 3 |
| Oct 11, 2026 | 3 |
| Oct 10, 2026 | 2 |
| Oct 9, 2026 | 2 |
| Oct 8, 2026 | 1 |
| Oct 7, 2026 | 1 |
| Oct 6, 2026 | 1 |
| Oct 5, 2026 | 1 |
| Oct 4, 2026 | 0 |
| Oct 3, 2026 | 1 |
| Oct 2, 2026 | 3 |
| Oct 1, 2026 | 3 |
| Sep 30, 2026 | 3 |
| Sep 29, 2026 | 4 |
| Sep 28, 2026 | 4 |
| Sep 27, 2026 | 5 |
| Sep 26, 2026 | 7 |
| Sep 25, 2026 | 5 |
| Sep 24, 2026 | 5 |
| Sep 23, 2026 | 5 |
| Sep 22, 2026 | 5 |
| Sep 21, 2026 | 5 |
| Sep 20, 2026 | 5 |
| Sep 19, 2026 | 2 |
| Sep 18, 2026 | 2 |
| Sep 17, 2026 | 3 |
| Sep 16, 2026 | 4 |
| Sep 15, 2026 | 3 |
| Sep 14, 2026 | 5 |
| Sep 13, 2026 | 4 |
| Sep 12, 2026 | 7 |
| Sep 11, 2026 | 7 |
| Sep 10, 2026 | 6 |
| Sep 9, 2026 | 6 |
| Sep 8, 2026 | 6 |
| Sep 7, 2026 | 6 |
| Sep 6, 2026 | 6 |
Each point is npm's rolling 7-day download count.
Health Score
Composite score based on GitHub activity, stars, npm downloads, publish recency, dependency count, and package size.
Badge for your README
[](https://payloaddirectory.dev/plugins/1080412127-root)<a href="https://payloaddirectory.dev/plugins/1080412127-root"><img src="https://payloaddirectory.dev/badge/1080412127-root.svg" alt="Payload Directory"></a>README
WIP: This repo is a work in progress for the polar.sh plugin for PayloadCMS
A template repo to create a Payload CMS plugin.
Payload is built with a robust infrastructure intended to support Plugins with ease. This provides a simple, modular, and reusable way for developers to extend the core capabilities of Payload.
To build your own Payload plugin, all you need is:
Here is a short recap on how to integrate plugins with Payload, to learn more visit the plugin overview page.
To install any plugin, simply add it to your payload.config() in the Plugin array.
import myPlugin from 'my-plugin'
export const config = buildConfig({
plugins: [
// You can pass options to the plugin
myPlugin({
enabled: true,
}),
],
})
The initialization process goes in the following order:
When you build a plugin, you are purely building a feature for your project and then abstracting it outside of the project.
In the Payload plugin template, you will see a common file structure that is used across all plugins:
In the root folder, you will see various files that relate to the configuration of the plugin. We set up our environment in a similar manner in Payload core and across other projects, so hopefully these will look familiar:
IMPORTANT*: You will need to modify these files.
In the dev folder, you’ll find a basic payload project, created with npx create-payload-app and the blank template.
IMPORTANT: Make a copy of the .env.example file and rename it to .env. Update the DATABASE_URI to match the database you are using and your plugin name. Update PAYLOAD_SECRET to a unique string.
You will not be able to run pnpm/yarn dev until you have created this .env file.
myPlugin has already been added to the payload.config() file in this project.
plugins: [
myPlugin({
collections: {
posts: true,
},
}),
]
Later when you rename the plugin or add additional options, make sure to update it here.
You may wish to add collections or expand the test project depending on the purpose of your plugin. Just make sure to keep this dev environment as simplified as possible - users should be able to install your plugin without additional configuration required.
When you’re ready to start development, initiate the project with pnpm/npm/yarn dev and pull up http://localhost:3000 in your browser.
Now that we have our environment setup and we have a dev project ready to - it’s time to build the plugin!
index.ts
The essence of a Payload plugin is simply to extend the payload config - and that is exactly what we are doing in this file.
export const myPlugin =
(pluginOptions: MyPluginConfig) =>
(config: Config): Config => {
// do cool stuff with the config here
return config
}
First, we receive the existing payload config along with any plugin options.
From here, you can extend the config as you wish.
Finally, you return the config and that is it!
Spread syntax (or the spread operator) is a feature in JavaScript that uses the dot notation (...) to spread elements from arrays, strings, or objects into various contexts.
We are going to use spread syntax to allow us to add data to existing arrays without losing the existing data. It is crucial to spread the existing data correctly – else this can cause adverse behavior and conflicts with Payload config and other plugins.
Let’s say you want to build a plugin that adds a new collection:
config.collections = [
...(config.collections || []),
// Add additional collections here
]
First we spread the config.collections to ensure that we don’t lose the existing collections, then you can add any additional collections just as you would in a regular payload config.
This same logic is applied to other properties like admin, hooks, globals:
config.globals = [
...(config.globals || []),
// Add additional globals here
]
config.hooks = {
...(incomingConfig.hooks || {}),
// Add additional hooks here
}
Some properties will be slightly different to extend, for instance the onInit property:
import { onInitExtension } from './onInitExtension' // example file
config.onInit = async (payload) => {
if (incomingConfig.onInit) await incomingConfig.onInit(payload)
// Add additional onInit code by defining an onInitExtension function
onInitExtension(pluginOptions, payload)
}
If you wish to add to the onInit, you must include the async/await. We don’t use spread syntax in this case, instead you must await the existing onInit before running additional functionality.
In the template, we have stubbed out some addition onInit actions that seeds in a document to the plugin-collection, you can use this as a base point to add more actions - and if not needed, feel free to delete it.
If your plugin has options, you should define and provide types for these options.
export type MyPluginConfig = {
/**
* List of collections to add a custom field
*/
collections?: Partial<Record<CollectionSlug, true>>
/**
* Disable the plugin
*/
disabled?: boolean
}
If possible, include JSDoc comments to describe the options and their types. This allows a developer to see details about the options in their editor.
Having a test suite for your plugin is essential to ensure quality and stability. Vitest is a fast, modern testing framework that works seamlessly with Vite and supports TypeScript out of the box.
Vitest organizes tests into test suites and cases, similar to other testing frameworks. We recommend creating individual tests based on the expected behavior of your plugin from start to finish.
Writing tests with Vitest is very straightforward, and you can learn more about how it works in the Vitest documentation.
For this template, we stubbed out int.spec.ts in the dev folder where you can write your tests.
describe('Plugin tests', () => {
// Create tests to ensure expected behavior from the plugin
it('some condition that must be met', () => {
// Write your test logic here
expect(...)
})
})
With this tutorial and the plugin template, you should have everything you need to start building your own plugin. In addition to the setup, here are other best practices aim we follow:
Please contact Payload with any questions about using this plugin template.
Tags
stripe
Connect Stripe and Payload CMS to work with Stripe data from your Payload project
10022.2k/wk46.1kv3 v4
payload plugin membership
Patreon-style membership tiers and category pledges billed as Stripe subscriptions, with a backers wall
791.5k/wk1v3
payload payments
Credit ledger, credit packs, plans and subscriptions for Payload with a Stripe gateway and a custom gateway contract
75849/wk0v3 v4
payload billing
Payments, invoices and refunds for Payload with Stripe, Mollie and a local test provider
68443/wk0v3
payload ecommerce tpay
Tpay payment adapter for the Payload ecommerce plugin with BLIK, bank transfers and cards for Polish shops
596/wk2v3
payload razorpay
Razorpay payment adapter for the Payload Ecommerce plugin
5526/wk0v3