ServiceStack Home (Live)

<back to all web services

Customer

The following routes are available for this service:
All Verbs/Customer
All Verbs/Customer/{Id}
import java.math.*
import java.util.*
import java.io.InputStream
import net.servicestack.client.*
import com.google.gson.annotations.*
import com.google.gson.reflect.*


open class Customer : IAddress
{
    open var id:Int? = null
    open var email:String? = null
    open var displayName:String? = null
    open var firstName:String? = null
    open var lastName:String? = null
    open var company:String? = null
    open var phoneNumber:String? = null
    override var addressLine1:String? = null
    override var addressLine2:String? = null
    override var addressCity:String? = null
    override var addressZip:String? = null
    override var addressState:String? = null
    override var addressCountry:String? = null
    open var stripeCustomerId:String? = null
    open var stripeCouponId:String? = null
    open var plan:String? = null
    open var createdDate:Date? = null
    open var isReferrer:Boolean? = null
    open var orders:ArrayList<Order>? = null
    open var subscriptions:ArrayList<Subscription>? = null
}

open class Order : IAddress
{
    open var id:Int? = null
    open var customerId:Int? = null
    open var productName:String? = null
    open var firstName:String? = null
    open var lastName:String? = null
    open var email:String? = null
    open var company:String? = null
    open var phoneNumber:String? = null
    override var addressLine1:String? = null
    override var addressLine2:String? = null
    override var addressCity:String? = null
    override var addressZip:String? = null
    override var addressState:String? = null
    override var addressCountry:String? = null
    open var agreeTerms:Boolean? = null
    open var notes:String? = null
    open var last4:String? = null
    open var subTotal:Int? = null
    open var couponId:String? = null
    open var discount:Int? = null
    open var tax:Int? = null
    open var total:Int? = null
    open var itemQuantity:Int? = null
    open var authorizedQuantity:Int? = null
    open var subscriptionId:Int? = null
    open var licenseRef:String? = null
    open var paymentId:Int? = null
    open var emailId:Int? = null
    open var paid:Boolean? = null
    open var createdDate:Date? = null
    open var modifiedDate:Date? = null
    open var modifiedBy:String? = null
    open var cancelledDate:Date? = null
    open var cancelledReason:String? = null
    open var ipAddress:String? = null
    open var orderDetails:ArrayList<OrderDetail>? = null
}

open class OrderDetail
{
    open var id:Int? = null
    open var orderId:Int? = null
    open var skuId:Int? = null
    open var skuType:SkuType? = null
    open var price:Int? = null
    open var description:String? = null
    open var quantity:Int? = null
    open var total:Int? = null
}

enum class SkuType
{
    Product,
    PerDev,
    PerCore,
    Site,
    Support,
    Training,
    Register,
    Payment,
}

open class Subscription
{
    open var id:Int? = null
    open var customerId:Int? = null
    open var email:String? = null
    open var skuId:Int? = null
    open var skuName:String? = null
    open var skuType:SkuType? = null
    open var code:String? = null
    open var quantity:Int? = null
    open var supportQuantity:Int? = null
    open var total:Int? = null
    open var isPlan:Boolean? = null
    open var isRenewal:Boolean? = null
    open var subscriptionDurationDays:Int? = null
    open var renewalDate:Date? = null
    open var licenseRef:String? = null
    open var licenseName:String? = null
    open var licenseAddress:String? = null
    open var licenseType:LicenseType? = null
    open var expiryDate:Date? = null
    open var licenseKey:LicenseKey? = null
    open var licenseKeyText:String? = null
    open var createdDate:Date? = null
    open var modifiedDate:Date? = null
    open var cancelledDate:Date? = null
    open var stripeSubscriptionId:String? = null
    open var emailId:Int? = null
    open var emailRenewalId:Int? = null
    open var emailExpiredId:Int? = null
    open var renewalSubscriptionId:Int? = null
    open var externalRef:String? = null
    open var notes:String? = null
    open var error:String? = null
}

enum class LicenseType
{
    Free,
    FreeIndividual,
    FreeOpenSource,
    Indie,
    Business,
    Enterprise,
    TextIndie,
    TextBusiness,
    OrmLiteIndie,
    OrmLiteBusiness,
    RedisIndie,
    RedisBusiness,
    AwsIndie,
    AwsBusiness,
    Trial,
    Site,
    TextSite,
    RedisSite,
    OrmLiteSite,
}

open class LicenseKey
{
    open var ref:String? = null
    open var name:String? = null
    @SerializedName("type") open var Type:LicenseType? = null
    open var meta:Long? = null
    open var hash:String? = null
    open var halg:String? = null
    open var expiry:Date? = null
}

Kotlin Customer DTOs

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

HTTP + JSV

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

POST /Customer HTTP/1.1 
Host: account.servicestack.net 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	id: 0,
	email: String,
	displayName: String,
	firstName: String,
	lastName: String,
	company: String,
	phoneNumber: String,
	addressLine1: String,
	addressLine2: String,
	addressCity: String,
	addressZip: String,
	addressState: String,
	addressCountry: String,
	stripeCustomerId: String,
	stripeCouponId: String,
	plan: String,
	createdDate: 0001-01-01,
	isReferrer: False,
	orders: 
	[
		{
			id: 0,
			customerId: 0,
			productName: String,
			firstName: String,
			lastName: String,
			email: String,
			company: String,
			phoneNumber: String,
			addressLine1: String,
			addressLine2: String,
			addressCity: String,
			addressZip: String,
			addressState: String,
			addressCountry: String,
			agreeTerms: False,
			notes: String,
			last4: String,
			subTotal: 0,
			couponId: String,
			discount: 0,
			tax: 0,
			total: 0,
			itemQuantity: 0,
			authorizedQuantity: 0,
			subscriptionId: 0,
			licenseRef: String,
			paymentId: 0,
			emailId: 0,
			paid: False,
			createdDate: 0001-01-01,
			modifiedDate: 0001-01-01,
			modifiedBy: String,
			cancelledDate: 0001-01-01,
			cancelledReason: String,
			ipAddress: String,
			orderDetails: 
			[
				{
					id: 0,
					orderId: 0,
					skuId: 0,
					skuType: Product,
					price: 0,
					description: String,
					quantity: 0,
					total: 0
				}
			]
		}
	],
	subscriptions: 
	[
		{
			id: 0,
			customerId: 0,
			email: String,
			skuId: 0,
			skuName: String,
			skuType: Product,
			code: String,
			quantity: 0,
			supportQuantity: 0,
			total: 0,
			isPlan: False,
			isRenewal: False,
			subscriptionDurationDays: 0,
			renewalDate: 0001-01-01,
			licenseRef: String,
			licenseName: String,
			licenseAddress: String,
			licenseType: Free,
			expiryDate: 0001-01-01,
			licenseKey: 
			{
				ref: String,
				name: String,
				type: Free,
				meta: 0,
				hash: String,
				halg: String,
				expiry: 0001-01-01
			},
			licenseKeyText: String,
			createdDate: 0001-01-01,
			modifiedDate: 0001-01-01,
			cancelledDate: 0001-01-01,
			stripeSubscriptionId: String,
			emailId: 0,
			emailRenewalId: 0,
			emailExpiredId: 0,
			renewalSubscriptionId: 0,
			externalRef: String,
			notes: String,
			error: String
		}
	]
}