How to use the chargebee.configure function in chargebee

To help you get started, we’ve selected a few chargebee examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github WorldBrain / Memex / functions / src / index.ts View on Github external
const _refreshUserSubscriptionStatus = async (userId: string) => {
    chargebee.configure(getChargebeeOptions())

    const claims: Claims = {
        subscriptions: {},
        lastSubscribed: null,
    }

    const subscriptionQuery = {
        customer_id: userId,
        'sort_by[asc]': 'created_at',
    }

    // Query the Chargebee API for this user's subscriptions, adding every active/in_trial sub to the claims object.
    // any past subscription updates the lastSubscribed property to know whether a user has subscribed in the past.
    await chargebee.subscription
        .list(subscriptionQuery)
        .request(function(error: any, result: any) {
github staart / api / src / helpers / stripe.ts View on Github external
import Stripe from "stripe";
import chargebee, { Customer } from "chargebee";
import {
  STRIPE_SECRET_KEY,
  CHARGEBEE_SECRET_KEY,
  CHARGEBEE_SITE
} from "../config";
import { updateOrganization } from "../crud/organization";
const stripe = new Stripe(STRIPE_SECRET_KEY);
chargebee.configure({
  api_key: CHARGEBEE_SECRET_KEY,
  site: CHARGEBEE_SITE
});

/**
 * @param id - Stripe customer ID
 */
export const getStripeCustomer = (id: string) =>
  new Promise((resolve, reject) => {
    chargebee.customer.retrieve(id).request((error: any, result: any) => {
      if (error) return reject(error);
      resolve(result.customer as Customer);
    });
  });

/**
github rrecuero / fstack-ethdapp-template / backend / subscriptions / subscriptionsManager.js View on Github external
constructor() {
    if (!instance) {
      chargebee.configure({
        site: configChargebee.site,
        api_key: configChargebee.api_key
      });
      instance = this;
    }
    return instance;
  }
github getguesstimate / guesstimate-app / src / server / chargebee / index.js View on Github external
import chargebee from 'chargebee'
import variables from './constants.js'

chargebee.configure({
  site: variables.CHARGEBEE_SITE,
  api_key:  variables.CHARGEBEE_API_KEY
})

chargebee

A library for integrating with Chargebee.

MIT
Latest version published 8 days ago

Package Health Score

78 / 100
Full package analysis