
Product
Introducing Tier 1 Reachability: Precision CVE Triage for Enterprise Teams
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
simple-js-payment-system
Advanced tools
A lightweight, customizable payment modal system with Stripe integration that supports both direct invocation and visit-count based triggers.
<!-- Include Stripe.js -->
<script src="https://js.stripe.com/v3/"></script>
<!-- Include Payment System -->
<script src="https://unpkg.com/simple-js-payment-system@1.1.1/payment.js"></script>
<script>
new PaymentSystem()
.minVisitCount(5)
.discardVisitCount(1)
.stripeConfig({
test: {
publishableKey: 'your_test_key',
priceId: 'your_test_price_id'
},
live: {
publishableKey: 'your_live_key',
priceId: 'your_live_price_id'
}
})
.isLive(true)
.run();
</script>
Create a button that shows the payment modal when clicked:
<button onclick="_PaymentSystem.showModalIfNotPaid()">
Unlock Premium
</button>
Show the modal after specific number of visits:
new PaymentSystem()
.minVisitCount(5) // Show after 5 visits
.discardVisitCount(1) // Add 1 visit when user clicks "Later"
.stripeConfig({
// ...your stripe config
})
.run();
new PaymentSystem()
.modalTitle('❤️ Support Our Work')
.modalDescription('Your custom description')
.modalSubDescription('One-time payment • Instant access')
.modalActionText('Donate $2.99')
.modalDiscardText('Maybe Later')
.run();
minVisitCount
: Number of visits before showing modaldiscardVisitCount
: Number of visits to add when user clicks "Later"// Show modal after 10 visits
// Add 2 visits when dismissed
new PaymentSystem()
.minVisitCount(10)
.discardVisitCount(2)
.run();
// Automatically switch between test/live based on hostname
new PaymentSystem()
.isLive(window.location.hostname !== '127.0.0.1')
.run();
You can check if the user has already paid using the hasPaid
method:
const payment = new PaymentSystem()
.stripeConfig({
// ...your config
})
.run();
// Check payment status
if (payment.hasPaid()) {
console.log('User has paid');
} else {
console.log('User has not paid');
}
// Example with conditional modal
function checkAndShowModal() {
if (!payment.hasPaid()) {
payment.showModal();
}
}
The system automatically tracks events if Google Analytics (gtag) or Plausible is present:
custom_pay_{pageName}
: When user clicks payment buttoncustom_modal_close_{pageName}
: When modal is closedcustom_modal_show_{pageName}
: When showModalIfNotPaid is calledPayment status is tracked per device using browser fingerprinting to prevent sharing of access between devices.
FAQs
Simple payment modal system with Stripe integration
We found that simple-js-payment-system demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
Research
/Security News
Ongoing npm supply chain attack spreads to DuckDB: multiple packages compromised with the same wallet-drainer malware.
Security News
The MCP Steering Committee has launched the official MCP Registry in preview, a central hub for discovering and publishing MCP servers.