| POST | /create-customer |
|---|
import 'package:servicestack/servicestack.dart';
enum StripeType
{
unknown,
account,
card,
charge,
coupon,
customer,
discount,
dispute,
event,
invoiceitem,
invoice,
line_item,
plan,
subscription,
token,
transfer,
list,
product,
}
class StripeObject implements IConvertible
{
StripeType? object;
StripeObject({this.object});
StripeObject.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
object = JsonConverters.fromJson(json['object'],'StripeType',context!);
return this;
}
Map<String, dynamic> toJson() => {
'object': JsonConverters.toJson(object,'StripeType',context!)
};
getTypeName() => "StripeObject";
TypeContext? context = _ctx;
}
class StripeId extends StripeObject implements IConvertible
{
String? id;
StripeId({this.id});
StripeId.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
super.fromMap(json);
id = json['id'];
return this;
}
Map<String, dynamic> toJson() => super.toJson()..addAll({
'id': id
});
getTypeName() => "StripeId";
TypeContext? context = _ctx;
}
enum StripeCouponDuration
{
forever,
once,
repeating,
}
class StripeCoupon extends StripeId implements IConvertible
{
int? amountOff;
DateTime? created;
String? currency;
StripeCouponDuration? duration;
int? durationInMonths;
bool? livemode;
int? maxRedemptions;
Map<String,String?>? metadata;
int? percentOff;
DateTime? redeemBy;
int? timesRedeemed;
bool? valid;
StripeCoupon({this.amountOff,this.created,this.currency,this.duration,this.durationInMonths,this.livemode,this.maxRedemptions,this.metadata,this.percentOff,this.redeemBy,this.timesRedeemed,this.valid});
StripeCoupon.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
super.fromMap(json);
amountOff = json['amountOff'];
created = JsonConverters.fromJson(json['created'],'DateTime',context!);
currency = json['currency'];
duration = JsonConverters.fromJson(json['duration'],'StripeCouponDuration',context!);
durationInMonths = json['durationInMonths'];
livemode = json['livemode'];
maxRedemptions = json['maxRedemptions'];
metadata = JsonConverters.toStringMap(json['metadata']);
percentOff = json['percentOff'];
redeemBy = JsonConverters.fromJson(json['redeemBy'],'DateTime',context!);
timesRedeemed = json['timesRedeemed'];
valid = json['valid'];
return this;
}
Map<String, dynamic> toJson() => super.toJson()..addAll({
'amountOff': amountOff,
'created': JsonConverters.toJson(created,'DateTime',context!),
'currency': currency,
'duration': JsonConverters.toJson(duration,'StripeCouponDuration',context!),
'durationInMonths': durationInMonths,
'livemode': livemode,
'maxRedemptions': maxRedemptions,
'metadata': metadata,
'percentOff': percentOff,
'redeemBy': JsonConverters.toJson(redeemBy,'DateTime',context!),
'timesRedeemed': timesRedeemed,
'valid': valid
});
getTypeName() => "StripeCoupon";
TypeContext? context = _ctx;
}
class StripeDiscount extends StripeId implements IConvertible
{
String? customer;
StripeCoupon? coupon;
DateTime? start;
DateTime? end;
StripeDiscount({this.customer,this.coupon,this.start,this.end});
StripeDiscount.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
super.fromMap(json);
customer = json['customer'];
coupon = JsonConverters.fromJson(json['coupon'],'StripeCoupon',context!);
start = JsonConverters.fromJson(json['start'],'DateTime',context!);
end = JsonConverters.fromJson(json['end'],'DateTime',context!);
return this;
}
Map<String, dynamic> toJson() => super.toJson()..addAll({
'customer': customer,
'coupon': JsonConverters.toJson(coupon,'StripeCoupon',context!),
'start': JsonConverters.toJson(start,'DateTime',context!),
'end': JsonConverters.toJson(end,'DateTime',context!)
});
getTypeName() => "StripeDiscount";
TypeContext? context = _ctx;
}
class StripeAddress implements IConvertible
{
String? city;
String? country;
String? line1;
String? line2;
String? postalCode;
String? state;
StripeAddress({this.city,this.country,this.line1,this.line2,this.postalCode,this.state});
StripeAddress.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
city = json['city'];
country = json['country'];
line1 = json['line1'];
line2 = json['line2'];
postalCode = json['postalCode'];
state = json['state'];
return this;
}
Map<String, dynamic> toJson() => {
'city': city,
'country': country,
'line1': line1,
'line2': line2,
'postalCode': postalCode,
'state': state
};
getTypeName() => "StripeAddress";
TypeContext? context = _ctx;
}
class StripeShipping implements IConvertible
{
StripeAddress? address;
String? name;
String? phone;
StripeShipping({this.address,this.name,this.phone});
StripeShipping.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
address = JsonConverters.fromJson(json['address'],'StripeAddress',context!);
name = json['name'];
phone = json['phone'];
return this;
}
Map<String, dynamic> toJson() => {
'address': JsonConverters.toJson(address,'StripeAddress',context!),
'name': name,
'phone': phone
};
getTypeName() => "StripeShipping";
TypeContext? context = _ctx;
}
enum StripeCvcCheck
{
Unknown,
Pass,
Fail,
Unchecked,
}
class StripeCard extends StripeId implements IConvertible
{
String? brand;
String? number;
String? last4;
String? dynamicLast4;
int? expMonth;
int? expYear;
String? cvc;
String? name;
String? addressCity;
String? addressCountry;
String? addressLine1;
String? addressLine2;
String? addressState;
String? addressZip;
StripeCvcCheck? cvcCheck;
String? addressLine1Check;
String? addressZipCheck;
String? funding;
String? fingerprint;
String? customer;
String? country;
StripeCard({this.brand,this.number,this.last4,this.dynamicLast4,this.expMonth,this.expYear,this.cvc,this.name,this.addressCity,this.addressCountry,this.addressLine1,this.addressLine2,this.addressState,this.addressZip,this.cvcCheck,this.addressLine1Check,this.addressZipCheck,this.funding,this.fingerprint,this.customer,this.country});
StripeCard.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
super.fromMap(json);
brand = json['brand'];
number = json['number'];
last4 = json['last4'];
dynamicLast4 = json['dynamicLast4'];
expMonth = json['expMonth'];
expYear = json['expYear'];
cvc = json['cvc'];
name = json['name'];
addressCity = json['addressCity'];
addressCountry = json['addressCountry'];
addressLine1 = json['addressLine1'];
addressLine2 = json['addressLine2'];
addressState = json['addressState'];
addressZip = json['addressZip'];
cvcCheck = JsonConverters.fromJson(json['cvcCheck'],'StripeCvcCheck',context!);
addressLine1Check = json['addressLine1Check'];
addressZipCheck = json['addressZipCheck'];
funding = json['funding'];
fingerprint = json['fingerprint'];
customer = json['customer'];
country = json['country'];
return this;
}
Map<String, dynamic> toJson() => super.toJson()..addAll({
'brand': brand,
'number': number,
'last4': last4,
'dynamicLast4': dynamicLast4,
'expMonth': expMonth,
'expYear': expYear,
'cvc': cvc,
'name': name,
'addressCity': addressCity,
'addressCountry': addressCountry,
'addressLine1': addressLine1,
'addressLine2': addressLine2,
'addressState': addressState,
'addressZip': addressZip,
'cvcCheck': JsonConverters.toJson(cvcCheck,'StripeCvcCheck',context!),
'addressLine1Check': addressLine1Check,
'addressZipCheck': addressZipCheck,
'funding': funding,
'fingerprint': fingerprint,
'customer': customer,
'country': country
});
getTypeName() => "StripeCard";
TypeContext? context = _ctx;
}
enum StripeSubscriptionStatus
{
Unknown,
Trialing,
Active,
PastDue,
Canceled,
Unpaid,
}
enum StripePlanInterval
{
month,
year,
}
class StripePlan extends StripeId implements IConvertible
{
int? amount;
DateTime? created;
String? currency;
StripePlanInterval? interval;
int? intervalCount;
bool? livemode;
Map<String,String?>? metadata;
String? nickname;
String? product;
int? trialPeriodDays;
StripePlan({this.amount,this.created,this.currency,this.interval,this.intervalCount,this.livemode,this.metadata,this.nickname,this.product,this.trialPeriodDays});
StripePlan.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
super.fromMap(json);
amount = json['amount'];
created = JsonConverters.fromJson(json['created'],'DateTime',context!);
currency = json['currency'];
interval = JsonConverters.fromJson(json['interval'],'StripePlanInterval',context!);
intervalCount = json['intervalCount'];
livemode = json['livemode'];
metadata = JsonConverters.toStringMap(json['metadata']);
nickname = json['nickname'];
product = json['product'];
trialPeriodDays = json['trialPeriodDays'];
return this;
}
Map<String, dynamic> toJson() => super.toJson()..addAll({
'amount': amount,
'created': JsonConverters.toJson(created,'DateTime',context!),
'currency': currency,
'interval': JsonConverters.toJson(interval,'StripePlanInterval',context!),
'intervalCount': intervalCount,
'livemode': livemode,
'metadata': metadata,
'nickname': nickname,
'product': product,
'trialPeriodDays': trialPeriodDays
});
getTypeName() => "StripePlan";
TypeContext? context = _ctx;
}
class StripeSubscription extends StripeId implements IConvertible
{
DateTime? currentPeriodEnd;
StripeSubscriptionStatus? status;
StripePlan? plan;
DateTime? currentPeriodStart;
DateTime? start;
DateTime? trialStart;
bool? cancelAtPeriodEnd;
DateTime? trialEnd;
DateTime? canceledAt;
DateTime? endedAt;
String? customer;
int? quantity;
StripeSubscription({this.currentPeriodEnd,this.status,this.plan,this.currentPeriodStart,this.start,this.trialStart,this.cancelAtPeriodEnd,this.trialEnd,this.canceledAt,this.endedAt,this.customer,this.quantity});
StripeSubscription.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
super.fromMap(json);
currentPeriodEnd = JsonConverters.fromJson(json['currentPeriodEnd'],'DateTime',context!);
status = JsonConverters.fromJson(json['status'],'StripeSubscriptionStatus',context!);
plan = JsonConverters.fromJson(json['plan'],'StripePlan',context!);
currentPeriodStart = JsonConverters.fromJson(json['currentPeriodStart'],'DateTime',context!);
start = JsonConverters.fromJson(json['start'],'DateTime',context!);
trialStart = JsonConverters.fromJson(json['trialStart'],'DateTime',context!);
cancelAtPeriodEnd = json['cancelAtPeriodEnd'];
trialEnd = JsonConverters.fromJson(json['trialEnd'],'DateTime',context!);
canceledAt = JsonConverters.fromJson(json['canceledAt'],'DateTime',context!);
endedAt = JsonConverters.fromJson(json['endedAt'],'DateTime',context!);
customer = json['customer'];
quantity = json['quantity'];
return this;
}
Map<String, dynamic> toJson() => super.toJson()..addAll({
'currentPeriodEnd': JsonConverters.toJson(currentPeriodEnd,'DateTime',context!),
'status': JsonConverters.toJson(status,'StripeSubscriptionStatus',context!),
'plan': JsonConverters.toJson(plan,'StripePlan',context!),
'currentPeriodStart': JsonConverters.toJson(currentPeriodStart,'DateTime',context!),
'start': JsonConverters.toJson(start,'DateTime',context!),
'trialStart': JsonConverters.toJson(trialStart,'DateTime',context!),
'cancelAtPeriodEnd': cancelAtPeriodEnd,
'trialEnd': JsonConverters.toJson(trialEnd,'DateTime',context!),
'canceledAt': JsonConverters.toJson(canceledAt,'DateTime',context!),
'endedAt': JsonConverters.toJson(endedAt,'DateTime',context!),
'customer': customer,
'quantity': quantity
});
getTypeName() => "StripeSubscription";
TypeContext? context = _ctx;
}
class StripeCustomer extends StripeId implements IConvertible
{
int? accountBalance;
String? businessVatId;
DateTime? created;
String? defaultSource;
bool? delinquent;
String? description;
StripeDiscount? discount;
String? email;
String? invoicePrefix;
bool? livemode;
Map<String,String?>? metadata;
StripeShipping? shipping;
StripeCollection<StripeCard>? sources;
StripeCollection<StripeSubscription>? subscriptions;
bool? deleted;
String? currency;
StripeCustomer({this.accountBalance,this.businessVatId,this.created,this.defaultSource,this.delinquent,this.description,this.discount,this.email,this.invoicePrefix,this.livemode,this.metadata,this.shipping,this.sources,this.subscriptions,this.deleted,this.currency});
StripeCustomer.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
super.fromMap(json);
accountBalance = json['accountBalance'];
businessVatId = json['businessVatId'];
created = JsonConverters.fromJson(json['created'],'DateTime',context!);
defaultSource = json['defaultSource'];
delinquent = json['delinquent'];
description = json['description'];
discount = JsonConverters.fromJson(json['discount'],'StripeDiscount',context!);
email = json['email'];
invoicePrefix = json['invoicePrefix'];
livemode = json['livemode'];
metadata = JsonConverters.toStringMap(json['metadata']);
shipping = JsonConverters.fromJson(json['shipping'],'StripeShipping',context!);
sources = JsonConverters.fromJson(json['sources'],'StripeCollection<StripeCard>',context!);
subscriptions = JsonConverters.fromJson(json['subscriptions'],'StripeCollection<StripeSubscription>',context!);
deleted = json['deleted'];
currency = json['currency'];
return this;
}
Map<String, dynamic> toJson() => super.toJson()..addAll({
'accountBalance': accountBalance,
'businessVatId': businessVatId,
'created': JsonConverters.toJson(created,'DateTime',context!),
'defaultSource': defaultSource,
'delinquent': delinquent,
'description': description,
'discount': JsonConverters.toJson(discount,'StripeDiscount',context!),
'email': email,
'invoicePrefix': invoicePrefix,
'livemode': livemode,
'metadata': metadata,
'shipping': JsonConverters.toJson(shipping,'StripeShipping',context!),
'sources': JsonConverters.toJson(sources,'StripeCollection<StripeCard>',context!),
'subscriptions': JsonConverters.toJson(subscriptions,'StripeCollection<StripeSubscription>',context!),
'deleted': deleted,
'currency': currency
});
getTypeName() => "StripeCustomer";
TypeContext? context = _ctx;
}
class CreateSubscribeCustomer implements IPost, IConvertible
{
String? email;
CreateSubscribeCustomer({this.email});
CreateSubscribeCustomer.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
email = json['email'];
return this;
}
Map<String, dynamic> toJson() => {
'email': email
};
getTypeName() => "CreateSubscribeCustomer";
TypeContext? context = _ctx;
}
class StripeCollection<T> extends StripeId implements IConvertible
{
String? url;
int? totalCount;
bool? hasMore;
List<T>? data;
StripeCollection({this.url,this.totalCount,this.hasMore,this.data});
StripeCollection.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
super.fromMap(json);
url = json['url'];
totalCount = json['totalCount'];
hasMore = json['hasMore'];
data = JsonConverters.fromJson(json['data'],'List<${runtimeGenericTypeDefs(this,[0]).join(",")}>',context!);
return this;
}
Map<String, dynamic> toJson() => super.toJson()..addAll({
'url': url,
'totalCount': totalCount,
'hasMore': hasMore,
'data': JsonConverters.toJson(data,'List<T>',context!)
});
getTypeName() => "StripeCollection<$T>";
TypeContext? context = _ctx;
}
TypeContext _ctx = TypeContext(library: 'api.sfgtec.com', types: <String, TypeInfo> {
'StripeType': TypeInfo(TypeOf.Enum, enumValues:StripeType.values),
'StripeObject': TypeInfo(TypeOf.Class, create:() => StripeObject()),
'StripeId': TypeInfo(TypeOf.Class, create:() => StripeId()),
'StripeCouponDuration': TypeInfo(TypeOf.Enum, enumValues:StripeCouponDuration.values),
'StripeCoupon': TypeInfo(TypeOf.Class, create:() => StripeCoupon()),
'StripeDiscount': TypeInfo(TypeOf.Class, create:() => StripeDiscount()),
'StripeAddress': TypeInfo(TypeOf.Class, create:() => StripeAddress()),
'StripeShipping': TypeInfo(TypeOf.Class, create:() => StripeShipping()),
'StripeCvcCheck': TypeInfo(TypeOf.Enum, enumValues:StripeCvcCheck.values),
'StripeCard': TypeInfo(TypeOf.Class, create:() => StripeCard()),
'StripeSubscriptionStatus': TypeInfo(TypeOf.Enum, enumValues:StripeSubscriptionStatus.values),
'StripePlanInterval': TypeInfo(TypeOf.Enum, enumValues:StripePlanInterval.values),
'StripePlan': TypeInfo(TypeOf.Class, create:() => StripePlan()),
'StripeSubscription': TypeInfo(TypeOf.Class, create:() => StripeSubscription()),
'StripeCustomer': TypeInfo(TypeOf.Class, create:() => StripeCustomer()),
'StripeCollection<StripeCard>': TypeInfo(TypeOf.Class, create:() => StripeCollection<StripeCard>()),
'StripeCollection<StripeSubscription>': TypeInfo(TypeOf.Class, create:() => StripeCollection<StripeSubscription>()),
'CreateSubscribeCustomer': TypeInfo(TypeOf.Class, create:() => CreateSubscribeCustomer()),
'StripeCollection<T>': TypeInfo(TypeOf.Class, create:() => StripeCollection<T>()),
});
Dart 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>