0.3.0 • Published 3 months ago

@discue/paddle-test-utils v0.3.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

GitHub tag Latest Stable Version License NPM Downloads NPM Downloads contributions - welcome Made with Node.js

paddle-test-kit

Test kit for paddle.com payments.

This module provides

  • a function to create an active paddle subscription for testing purposes

Installation

npm install @discue/paddle-test-kit

Creating a new subscription

The module is able to create a new Paddle subscription for a given vendor_id. The module will start a puppeteer instance in the background, generate a checkout page with inline mode and finish the checkout process.

'use strict'

const { createActivePaddleSubscription } = require('../lib/index.js')

const productId = 36631 // the product id is vendor specific
const vendorId = process.env.VENDOR_ID

const { checkout, order } = await createActivePaddleSubscription({
    productId,
    vendorId
})

const { subscription_id } = order

Removing test subscriptions

The exported function cancelTestSubscriptions cancels all active subscriptions created by this module.

'use strict'

const { cancelTestSubscriptions } = require('../lib/index.js')

const vendorId = process.env.VENDOR_ID
const authCode = process.env.AUTH_CODE

await cancelTestSubscriptions({
    vendorId, authCode
})

License

MIT

0.3.0

3 months ago

0.2.0

9 months ago

0.1.0

9 months ago