sfgboxapi

<back to all web services

CreateSubscribeCustomer

Requires Authentication
The following routes are available for this service:
POST/create-customer
"use strict";
/** @typedef {'unknown'|'account'|'card'|'charge'|'coupon'|'customer'|'discount'|'dispute'|'event'|'invoiceitem'|'invoice'|'line_item'|'plan'|'subscription'|'token'|'transfer'|'list'|'product'} */
export var StripeType;
(function (StripeType) {
    StripeType["unknown"] = "unknown"
    StripeType["account"] = "account"
    StripeType["card"] = "card"
    StripeType["charge"] = "charge"
    StripeType["coupon"] = "coupon"
    StripeType["customer"] = "customer"
    StripeType["discount"] = "discount"
    StripeType["dispute"] = "dispute"
    StripeType["event"] = "event"
    StripeType["invoiceitem"] = "invoiceitem"
    StripeType["invoice"] = "invoice"
    StripeType["line_item"] = "line_item"
    StripeType["plan"] = "plan"
    StripeType["subscription"] = "subscription"
    StripeType["token"] = "token"
    StripeType["transfer"] = "transfer"
    StripeType["list"] = "list"
    StripeType["product"] = "product"
})(StripeType || (StripeType = {}));
export class StripeObject {
    /** @param {{object?:StripeType}} [init] */
    constructor(init) { Object.assign(this, init) }
    /** @type {?StripeType} */
    object;
}
export class StripeId extends StripeObject {
    /** @param {{id?:string,object?:StripeType}} [init] */
    constructor(init) { super(init); Object.assign(this, init) }
    /** @type {string} */
    id;
}
/** @typedef {'forever'|'once'|'repeating'} */
export var StripeCouponDuration;
(function (StripeCouponDuration) {
    StripeCouponDuration["forever"] = "forever"
    StripeCouponDuration["once"] = "once"
    StripeCouponDuration["repeating"] = "repeating"
})(StripeCouponDuration || (StripeCouponDuration = {}));
export class StripeCoupon extends StripeId {
    /** @param {{amountOff?:number,created?:string,currency?:string,duration?:StripeCouponDuration,durationInMonths?:number,livemode?:boolean,maxRedemptions?:number,metadata?:{ [index: string]: string; },percentOff?:number,redeemBy?:string,timesRedeemed?:number,valid?:boolean,id?:string,object?:StripeType}} [init] */
    constructor(init) { super(init); Object.assign(this, init) }
    /** @type {?number} */
    amountOff;
    /** @type {?string} */
    created;
    /** @type {string} */
    currency;
    /** @type {StripeCouponDuration} */
    duration;
    /** @type {?number} */
    durationInMonths;
    /** @type {boolean} */
    livemode;
    /** @type {?number} */
    maxRedemptions;
    /** @type {{ [index: string]: string; }} */
    metadata;
    /** @type {?number} */
    percentOff;
    /** @type {?string} */
    redeemBy;
    /** @type {number} */
    timesRedeemed;
    /** @type {boolean} */
    valid;
}
export class StripeDiscount extends StripeId {
    /** @param {{customer?:string,coupon?:StripeCoupon,start?:string,end?:string,id?:string,object?:StripeType}} [init] */
    constructor(init) { super(init); Object.assign(this, init) }
    /** @type {string} */
    customer;
    /** @type {StripeCoupon} */
    coupon;
    /** @type {?string} */
    start;
    /** @type {?string} */
    end;
}
export class StripeAddress {
    /** @param {{city?:string,country?:string,line1?:string,line2?:string,postalCode?:string,state?:string}} [init] */
    constructor(init) { Object.assign(this, init) }
    /** @type {string} */
    city;
    /** @type {string} */
    country;
    /** @type {string} */
    line1;
    /** @type {string} */
    line2;
    /** @type {string} */
    postalCode;
    /** @type {string} */
    state;
}
export class StripeShipping {
    /** @param {{address?:StripeAddress,name?:string,phone?:string}} [init] */
    constructor(init) { Object.assign(this, init) }
    /** @type {StripeAddress} */
    address;
    /** @type {string} */
    name;
    /** @type {string} */
    phone;
}
/** @typedef {'Unknown'|'Pass'|'Fail'|'Unchecked'} */
export var StripeCvcCheck;
(function (StripeCvcCheck) {
    StripeCvcCheck["Unknown"] = "Unknown"
    StripeCvcCheck["Pass"] = "Pass"
    StripeCvcCheck["Fail"] = "Fail"
    StripeCvcCheck["Unchecked"] = "Unchecked"
})(StripeCvcCheck || (StripeCvcCheck = {}));
export class StripeCard extends StripeId {
    /** @param {{brand?:string,number?:string,last4?:string,dynamicLast4?:string,expMonth?:number,expYear?:number,cvc?:string,name?:string,addressCity?:string,addressCountry?:string,addressLine1?:string,addressLine2?:string,addressState?:string,addressZip?:string,cvcCheck?:StripeCvcCheck,addressLine1Check?:string,addressZipCheck?:string,funding?:string,fingerprint?:string,customer?:string,country?:string,id?:string,object?:StripeType}} [init] */
    constructor(init) { super(init); Object.assign(this, init) }
    /** @type {string} */
    brand;
    /** @type {string} */
    number;
    /** @type {string} */
    last4;
    /** @type {string} */
    dynamicLast4;
    /** @type {number} */
    expMonth;
    /** @type {number} */
    expYear;
    /** @type {string} */
    cvc;
    /** @type {string} */
    name;
    /** @type {string} */
    addressCity;
    /** @type {string} */
    addressCountry;
    /** @type {string} */
    addressLine1;
    /** @type {string} */
    addressLine2;
    /** @type {string} */
    addressState;
    /** @type {string} */
    addressZip;
    /** @type {?StripeCvcCheck} */
    cvcCheck;
    /** @type {string} */
    addressLine1Check;
    /** @type {string} */
    addressZipCheck;
    /** @type {string} */
    funding;
    /** @type {string} */
    fingerprint;
    /** @type {string} */
    customer;
    /** @type {string} */
    country;
}
/** @typedef {'Unknown'|'Trialing'|'Active'|'PastDue'|'Canceled'|'Unpaid'} */
export var StripeSubscriptionStatus;
(function (StripeSubscriptionStatus) {
    StripeSubscriptionStatus["Unknown"] = "Unknown"
    StripeSubscriptionStatus["Trialing"] = "Trialing"
    StripeSubscriptionStatus["Active"] = "Active"
    StripeSubscriptionStatus["PastDue"] = "PastDue"
    StripeSubscriptionStatus["Canceled"] = "Canceled"
    StripeSubscriptionStatus["Unpaid"] = "Unpaid"
})(StripeSubscriptionStatus || (StripeSubscriptionStatus = {}));
/** @typedef {'month'|'year'} */
export var StripePlanInterval;
(function (StripePlanInterval) {
    StripePlanInterval["month"] = "month"
    StripePlanInterval["year"] = "year"
})(StripePlanInterval || (StripePlanInterval = {}));
export class StripePlan extends StripeId {
    /** @param {{amount?:number,created?:string,currency?:string,interval?:StripePlanInterval,intervalCount?:number,livemode?:boolean,metadata?:{ [index: string]: string; },nickname?:string,product?:string,trialPeriodDays?:number,id?:string,object?:StripeType}} [init] */
    constructor(init) { super(init); Object.assign(this, init) }
    /** @type {number} */
    amount;
    /** @type {?string} */
    created;
    /** @type {string} */
    currency;
    /** @type {StripePlanInterval} */
    interval;
    /** @type {?number} */
    intervalCount;
    /** @type {boolean} */
    livemode;
    /** @type {{ [index: string]: string; }} */
    metadata;
    /** @type {string} */
    nickname;
    /** @type {string} */
    product;
    /** @type {?number} */
    trialPeriodDays;
}
export class StripeSubscription extends StripeId {
    /** @param {{currentPeriodEnd?:string,status?:StripeSubscriptionStatus,plan?:StripePlan,currentPeriodStart?:string,start?:string,trialStart?:string,cancelAtPeriodEnd?:boolean,trialEnd?:string,canceledAt?:string,endedAt?:string,customer?:string,quantity?:number,id?:string,object?:StripeType}} [init] */
    constructor(init) { super(init); Object.assign(this, init) }
    /** @type {?string} */
    currentPeriodEnd;
    /** @type {StripeSubscriptionStatus} */
    status;
    /** @type {StripePlan} */
    plan;
    /** @type {?string} */
    currentPeriodStart;
    /** @type {?string} */
    start;
    /** @type {?string} */
    trialStart;
    /** @type {?boolean} */
    cancelAtPeriodEnd;
    /** @type {?string} */
    trialEnd;
    /** @type {?string} */
    canceledAt;
    /** @type {?string} */
    endedAt;
    /** @type {string} */
    customer;
    /** @type {number} */
    quantity;
}
export class StripeCustomer extends StripeId {
    /** @param {{accountBalance?:number,businessVatId?:string,created?:string,defaultSource?:string,delinquent?:boolean,description?:string,discount?:StripeDiscount,email?:string,invoicePrefix?:string,livemode?:boolean,metadata?:{ [index: string]: string; },shipping?:StripeShipping,sources?:StripeCollection<StripeCard>,subscriptions?:StripeCollection<StripeSubscription>,deleted?:boolean,currency?:string,id?:string,object?:StripeType}} [init] */
    constructor(init) { super(init); Object.assign(this, init) }
    /** @type {number} */
    accountBalance;
    /** @type {string} */
    businessVatId;
    /** @type {?string} */
    created;
    /** @type {string} */
    defaultSource;
    /** @type {?boolean} */
    delinquent;
    /** @type {string} */
    description;
    /** @type {StripeDiscount} */
    discount;
    /** @type {string} */
    email;
    /** @type {string} */
    invoicePrefix;
    /** @type {boolean} */
    livemode;
    /** @type {{ [index: string]: string; }} */
    metadata;
    /** @type {StripeShipping} */
    shipping;
    /** @type {StripeCollection<StripeCard>} */
    sources;
    /** @type {StripeCollection<StripeSubscription>} */
    subscriptions;
    /** @type {boolean} */
    deleted;
    /** @type {string} */
    currency;
}
export class CreateSubscribeCustomer {
    /** @param {{email?:string}} [init] */
    constructor(init) { Object.assign(this, init) }
    /** @type {string} */
    email;
}
/** @typedef T {any} */
export class StripeCollection extends StripeId {
    /** @param {{url?:string,totalCount?:number,hasMore?:boolean,data?:T[],id?:string,object?:StripeType}} [init] */
    constructor(init) { super(init); Object.assign(this, init) }
    /** @type {string} */
    url;
    /** @type {number} */
    totalCount;
    /** @type {?boolean} */
    hasMore;
    /** @type {T[]} */
    data;
}

JavaScript CreateSubscribeCustomer DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv

HTTP + CSV

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /create-customer HTTP/1.1 
Host: sfgboxapi.dev.scadsoftware.com 
Accept: text/csv
Content-Type: text/csv
Content-Length: length

{"email":"String"}
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length

{"accountBalance":0,"businessVatId":"String","created":"\/Date(-62135596800000-0000)\/","defaultSource":"String","delinquent":false,"description":"String","discount":{"customer":"String","coupon":{"amountOff":0,"created":"\/Date(-62135596800000-0000)\/","currency":"String","duration":"forever","durationInMonths":0,"livemode":false,"maxRedemptions":0,"metadata":{"String":"String"},"percentOff":0,"redeemBy":"\/Date(-62135596800000-0000)\/","timesRedeemed":0,"valid":false,"id":"String","object":"unknown"},"start":"\/Date(-62135596800000-0000)\/","end":"\/Date(-62135596800000-0000)\/","id":"String","object":"unknown"},"email":"String","invoicePrefix":"String","livemode":false,"metadata":{"String":"String"},"shipping":{"address":{"city":"String","country":"String","line1":"String","line2":"String","postalCode":"String","state":"String"},"name":"String","phone":"String"},"sources":{"url":"String","totalCount":0,"hasMore":false,"data":[{"brand":"String","number":"String","last4":"String","dynamicLast4":"String","expMonth":0,"expYear":0,"cvc":"String","name":"String","addressCity":"String","addressCountry":"String","addressLine1":"String","addressLine2":"String","addressState":"String","addressZip":"String","cvcCheck":"Unknown","addressLine1Check":"String","addressZipCheck":"String","funding":"String","fingerprint":"String","customer":"String","country":"String","id":"String","object":"unknown"}],"id":"String","object":"unknown"},"subscriptions":{"url":"String","totalCount":0,"hasMore":false,"data":[{"currentPeriodEnd":"\/Date(-62135596800000-0000)\/","status":"Unknown","plan":{"amount":0,"created":"\/Date(-62135596800000-0000)\/","currency":"String","interval":"month","intervalCount":0,"livemode":false,"metadata":{"String":"String"},"nickname":"String","product":"String","trialPeriodDays":0,"id":"String","object":"unknown"},"currentPeriodStart":"\/Date(-62135596800000-0000)\/","start":"\/Date(-62135596800000-0000)\/","trialStart":"\/Date(-62135596800000-0000)\/","cancelAtPeriodEnd":false,"trialEnd":"\/Date(-62135596800000-0000)\/","canceledAt":"\/Date(-62135596800000-0000)\/","endedAt":"\/Date(-62135596800000-0000)\/","customer":"String","quantity":0,"id":"String","object":"unknown"}],"id":"String","object":"unknown"},"deleted":false,"currency":"String","id":"String","object":"unknown"}