Skip to content

Instantly share code, notes, and snippets.

@wozozo
Created February 6, 2016 18:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wozozo/8517f743232afbf79989 to your computer and use it in GitHub Desktop.
Save wozozo/8517f743232afbf79989 to your computer and use it in GitHub Desktop.
import Charge from './charge';
import Customer from './customer';
import Plan from './plan';
import Subscription from './subscription';
import Token from './token';
import Transfer from './transfer';
import Event from './event';
import Account from './account';
export default class Payjp {
constructor(apikey, config = {}) {
if (!apikey) {
throw new Error('Please set apikey.');
}
this.apikey = apikey;
this.config = ((config) => {
return {
apibase: config.apibase || 'https://api.pay.jp/v1'
};
})(config);
this.charges = new Charge(this);
this.customers = new Customer(this);
this.plans = new Plan(this);
this.subscriptions = new Subscription(this);
this.tokens = new Token(this);
this.transfers = new Transfer(this);
this.events = new Event(this);
this.accounts = new Account(this);
}
call constructor(apikey, config = {}) { // eslint-disable-line
return new Payjp(apikey, config);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment