| 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 .xml suffix or ?format=xml
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: api.sfgtec.com
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<CreateSubscribeCustomer xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/sfgboxapi.ServiceModel">
<Email>String</Email>
</CreateSubscribeCustomer>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length
<StripeCustomer xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/ServiceStack.Stripe.Types">
<Object>unknown</Object>
<Id>String</Id>
<AccountBalance>0</AccountBalance>
<BusinessVatId>String</BusinessVatId>
<Created>0001-01-01T00:00:00</Created>
<Currency>String</Currency>
<DefaultSource>String</DefaultSource>
<Deleted>false</Deleted>
<Delinquent>false</Delinquent>
<Description>String</Description>
<Discount>
<Object>unknown</Object>
<Id>String</Id>
<Coupon>
<Object>unknown</Object>
<Id>String</Id>
<AmountOff>0</AmountOff>
<Created>0001-01-01T00:00:00</Created>
<Currency>String</Currency>
<Duration>forever</Duration>
<DurationInMonths>0</DurationInMonths>
<Livemode>false</Livemode>
<MaxRedemptions>0</MaxRedemptions>
<Metadata xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d4p1:KeyValueOfstringstring>
<d4p1:Key>String</d4p1:Key>
<d4p1:Value>String</d4p1:Value>
</d4p1:KeyValueOfstringstring>
</Metadata>
<PercentOff>0</PercentOff>
<RedeemBy>0001-01-01T00:00:00</RedeemBy>
<TimesRedeemed>0</TimesRedeemed>
<Valid>false</Valid>
</Coupon>
<Customer>String</Customer>
<End>0001-01-01T00:00:00</End>
<Start>0001-01-01T00:00:00</Start>
</Discount>
<Email>String</Email>
<InvoicePrefix>String</InvoicePrefix>
<Livemode>false</Livemode>
<Metadata xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d2p1:KeyValueOfstringstring>
<d2p1:Key>String</d2p1:Key>
<d2p1:Value>String</d2p1:Value>
</d2p1:KeyValueOfstringstring>
</Metadata>
<Shipping>
<Address xmlns:d3p1="http://schemas.datacontract.org/2004/07/ServiceStack.Stripe">
<d3p1:City>String</d3p1:City>
<d3p1:Country>String</d3p1:Country>
<d3p1:Line1>String</d3p1:Line1>
<d3p1:Line2>String</d3p1:Line2>
<d3p1:PostalCode>String</d3p1:PostalCode>
<d3p1:State>String</d3p1:State>
</Address>
<Name>String</Name>
<Phone>String</Phone>
</Shipping>
<Sources>
<Object>unknown</Object>
<Id>String</Id>
<Data>
<StripeCard>
<Object>unknown</Object>
<Id>String</Id>
<AddressCity>String</AddressCity>
<AddressCountry>String</AddressCountry>
<AddressLine1>String</AddressLine1>
<AddressLine1Check>String</AddressLine1Check>
<AddressLine2>String</AddressLine2>
<AddressState>String</AddressState>
<AddressZip>String</AddressZip>
<AddressZipCheck>String</AddressZipCheck>
<Brand>String</Brand>
<Country>String</Country>
<Customer>String</Customer>
<Cvc>String</Cvc>
<CvcCheck>Unknown</CvcCheck>
<DynamicLast4>String</DynamicLast4>
<ExpMonth>0</ExpMonth>
<ExpYear>0</ExpYear>
<Fingerprint>String</Fingerprint>
<Funding>String</Funding>
<Last4>String</Last4>
<Name>String</Name>
<Number>String</Number>
</StripeCard>
</Data>
<HasMore>false</HasMore>
<TotalCount>0</TotalCount>
<Url>String</Url>
</Sources>
<Subscriptions>
<Object>unknown</Object>
<Id>String</Id>
<Data>
<StripeSubscription>
<Object>unknown</Object>
<Id>String</Id>
<CancelAtPeriodEnd>false</CancelAtPeriodEnd>
<CanceledAt>0001-01-01T00:00:00</CanceledAt>
<CurrentPeriodEnd>0001-01-01T00:00:00</CurrentPeriodEnd>
<CurrentPeriodStart>0001-01-01T00:00:00</CurrentPeriodStart>
<Customer>String</Customer>
<EndedAt>0001-01-01T00:00:00</EndedAt>
<Plan>
<Object>unknown</Object>
<Id>String</Id>
<Amount>0</Amount>
<Created>0001-01-01T00:00:00</Created>
<Currency>String</Currency>
<Interval>month</Interval>
<IntervalCount>0</IntervalCount>
<Livemode>false</Livemode>
<Metadata xmlns:d6p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d6p1:KeyValueOfstringstring>
<d6p1:Key>String</d6p1:Key>
<d6p1:Value>String</d6p1:Value>
</d6p1:KeyValueOfstringstring>
</Metadata>
<Nickname>String</Nickname>
<Product>String</Product>
<TrialPeriodDays>0</TrialPeriodDays>
</Plan>
<Quantity>0</Quantity>
<Start>0001-01-01T00:00:00</Start>
<Status>Unknown</Status>
<TrialEnd>0001-01-01T00:00:00</TrialEnd>
<TrialStart>0001-01-01T00:00:00</TrialStart>
</StripeSubscription>
</Data>
<HasMore>false</HasMore>
<TotalCount>0</TotalCount>
<Url>String</Url>
</Subscriptions>
</StripeCustomer>