sfgboxapi

<back to all web services

CreateSubscribeCustomer

Requires Authentication
The following routes are available for this service:
POST/create-customer
<?php namespace dtos;

use DateTime;
use Exception;
use DateInterval;
use JsonSerializable;
use ServiceStack\{IReturn,IReturnVoid,IGet,IPost,IPut,IDelete,IPatch,IMeta,IHasSessionId,IHasBearerToken,IHasVersion};
use ServiceStack\{ICrud,ICreateDb,IUpdateDb,IPatchDb,IDeleteDb,ISaveDb,AuditBase,QueryDb,QueryDb2,QueryData,QueryData2,QueryResponse};
use ServiceStack\{ResponseStatus,ResponseError,EmptyResponse,IdResponse,ArrayList,KeyValuePair2,StringResponse,StringsResponse,Tuple2,Tuple3,ByteArray};
use ServiceStack\{JsonConverters,Returns,TypeContext};


enum StripeType : string
{
    case unknown = 'unknown';
    case account = 'account';
    case card = 'card';
    case charge = 'charge';
    case coupon = 'coupon';
    case customer = 'customer';
    case discount = 'discount';
    case dispute = 'dispute';
    case event = 'event';
    case invoiceitem = 'invoiceitem';
    case invoice = 'invoice';
    case line_item = 'line_item';
    case plan = 'plan';
    case subscription = 'subscription';
    case token = 'token';
    case transfer = 'transfer';
    case list = 'list';
    case product = 'product';
}

class StripeObject implements JsonSerializable
{
    public function __construct(
        /** @var StripeType|null */
        public ?StripeType $object=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['object'])) $this->object = JsonConverters::from('StripeType', $o['object']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->object)) $o['object'] = JsonConverters::to('StripeType', $this->object);
        return empty($o) ? new class(){} : $o;
    }
}

class StripeId extends StripeObject implements JsonSerializable
{
    /**
     * @param StripeType|null $object
     */
    public function __construct(
        ?StripeType $object=null,
        /** @var string|null */
        public ?string $id=null
    ) {
        parent::__construct($object);
    }

    /** @throws Exception */
    public function fromMap($o): void {
        parent::fromMap($o);
        if (isset($o['id'])) $this->id = $o['id'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = parent::jsonSerialize();
        if (isset($this->id)) $o['id'] = $this->id;
        return empty($o) ? new class(){} : $o;
    }
}

enum StripeCouponDuration : string
{
    case forever = 'forever';
    case once = 'once';
    case repeating = 'repeating';
}

class StripeCoupon extends StripeId implements JsonSerializable
{
    /**
     * @param StripeType|null $object
     * @param string|null $id
     */
    public function __construct(
        ?StripeType $object=null,
        ?string $id=null,
        /** @var int|null */
        public ?int $amountOff=null,
        /** @var DateTime|null */
        public ?DateTime $created=null,
        /** @var string|null */
        public ?string $currency=null,
        /** @var StripeCouponDuration|null */
        public ?StripeCouponDuration $duration=null,
        /** @var int|null */
        public ?int $durationInMonths=null,
        /** @var bool|null */
        public ?bool $livemode=null,
        /** @var int|null */
        public ?int $maxRedemptions=null,
        /** @var array<string,string>|null */
        public ?array $metadata=null,
        /** @var int|null */
        public ?int $percentOff=null,
        /** @var DateTime|null */
        public ?DateTime $redeemBy=null,
        /** @var int */
        public int $timesRedeemed=0,
        /** @var bool|null */
        public ?bool $valid=null
    ) {
        parent::__construct($object,$id);
    }

    /** @throws Exception */
    public function fromMap($o): void {
        parent::fromMap($o);
        if (isset($o['amountOff'])) $this->amountOff = $o['amountOff'];
        if (isset($o['created'])) $this->created = JsonConverters::from('DateTime', $o['created']);
        if (isset($o['currency'])) $this->currency = $o['currency'];
        if (isset($o['duration'])) $this->duration = JsonConverters::from('StripeCouponDuration', $o['duration']);
        if (isset($o['durationInMonths'])) $this->durationInMonths = $o['durationInMonths'];
        if (isset($o['livemode'])) $this->livemode = $o['livemode'];
        if (isset($o['maxRedemptions'])) $this->maxRedemptions = $o['maxRedemptions'];
        if (isset($o['metadata'])) $this->metadata = JsonConverters::from(JsonConverters::context('Dictionary',genericArgs:['string','string']), $o['metadata']);
        if (isset($o['percentOff'])) $this->percentOff = $o['percentOff'];
        if (isset($o['redeemBy'])) $this->redeemBy = JsonConverters::from('DateTime', $o['redeemBy']);
        if (isset($o['timesRedeemed'])) $this->timesRedeemed = $o['timesRedeemed'];
        if (isset($o['valid'])) $this->valid = $o['valid'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = parent::jsonSerialize();
        if (isset($this->amountOff)) $o['amountOff'] = $this->amountOff;
        if (isset($this->created)) $o['created'] = JsonConverters::to('DateTime', $this->created);
        if (isset($this->currency)) $o['currency'] = $this->currency;
        if (isset($this->duration)) $o['duration'] = JsonConverters::to('StripeCouponDuration', $this->duration);
        if (isset($this->durationInMonths)) $o['durationInMonths'] = $this->durationInMonths;
        if (isset($this->livemode)) $o['livemode'] = $this->livemode;
        if (isset($this->maxRedemptions)) $o['maxRedemptions'] = $this->maxRedemptions;
        if (isset($this->metadata)) $o['metadata'] = JsonConverters::to(JsonConverters::context('Dictionary',genericArgs:['string','string']), $this->metadata);
        if (isset($this->percentOff)) $o['percentOff'] = $this->percentOff;
        if (isset($this->redeemBy)) $o['redeemBy'] = JsonConverters::to('DateTime', $this->redeemBy);
        if (isset($this->timesRedeemed)) $o['timesRedeemed'] = $this->timesRedeemed;
        if (isset($this->valid)) $o['valid'] = $this->valid;
        return empty($o) ? new class(){} : $o;
    }
}

class StripeDiscount extends StripeId implements JsonSerializable
{
    /**
     * @param StripeType|null $object
     * @param string|null $id
     */
    public function __construct(
        ?StripeType $object=null,
        ?string $id=null,
        /** @var string|null */
        public ?string $customer=null,
        /** @var StripeCoupon|null */
        public ?StripeCoupon $coupon=null,
        /** @var DateTime|null */
        public ?DateTime $start=null,
        /** @var DateTime|null */
        public ?DateTime $end=null
    ) {
        parent::__construct($object,$id);
    }

    /** @throws Exception */
    public function fromMap($o): void {
        parent::fromMap($o);
        if (isset($o['customer'])) $this->customer = $o['customer'];
        if (isset($o['coupon'])) $this->coupon = JsonConverters::from('StripeCoupon', $o['coupon']);
        if (isset($o['start'])) $this->start = JsonConverters::from('DateTime', $o['start']);
        if (isset($o['end'])) $this->end = JsonConverters::from('DateTime', $o['end']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = parent::jsonSerialize();
        if (isset($this->customer)) $o['customer'] = $this->customer;
        if (isset($this->coupon)) $o['coupon'] = JsonConverters::to('StripeCoupon', $this->coupon);
        if (isset($this->start)) $o['start'] = JsonConverters::to('DateTime', $this->start);
        if (isset($this->end)) $o['end'] = JsonConverters::to('DateTime', $this->end);
        return empty($o) ? new class(){} : $o;
    }
}

class StripeAddress implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $city=null,
        /** @var string|null */
        public ?string $country=null,
        /** @var string|null */
        public ?string $line1=null,
        /** @var string|null */
        public ?string $line2=null,
        /** @var string|null */
        public ?string $postalCode=null,
        /** @var string|null */
        public ?string $state=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['city'])) $this->city = $o['city'];
        if (isset($o['country'])) $this->country = $o['country'];
        if (isset($o['line1'])) $this->line1 = $o['line1'];
        if (isset($o['line2'])) $this->line2 = $o['line2'];
        if (isset($o['postalCode'])) $this->postalCode = $o['postalCode'];
        if (isset($o['state'])) $this->state = $o['state'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->city)) $o['city'] = $this->city;
        if (isset($this->country)) $o['country'] = $this->country;
        if (isset($this->line1)) $o['line1'] = $this->line1;
        if (isset($this->line2)) $o['line2'] = $this->line2;
        if (isset($this->postalCode)) $o['postalCode'] = $this->postalCode;
        if (isset($this->state)) $o['state'] = $this->state;
        return empty($o) ? new class(){} : $o;
    }
}

class StripeShipping implements JsonSerializable
{
    public function __construct(
        /** @var StripeAddress|null */
        public ?StripeAddress $address=null,
        /** @var string|null */
        public ?string $name=null,
        /** @var string|null */
        public ?string $phone=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['address'])) $this->address = JsonConverters::from('StripeAddress', $o['address']);
        if (isset($o['name'])) $this->name = $o['name'];
        if (isset($o['phone'])) $this->phone = $o['phone'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->address)) $o['address'] = JsonConverters::to('StripeAddress', $this->address);
        if (isset($this->name)) $o['name'] = $this->name;
        if (isset($this->phone)) $o['phone'] = $this->phone;
        return empty($o) ? new class(){} : $o;
    }
}

enum StripeCvcCheck : string
{
    case Unknown = 'Unknown';
    case Pass = 'Pass';
    case Fail = 'Fail';
    case Unchecked = 'Unchecked';
}

class StripeCard extends StripeId implements JsonSerializable
{
    /**
     * @param StripeType|null $object
     * @param string|null $id
     */
    public function __construct(
        ?StripeType $object=null,
        ?string $id=null,
        /** @var string|null */
        public ?string $brand=null,
        /** @var string|null */
        public ?string $number=null,
        /** @var string|null */
        public ?string $last4=null,
        /** @var string|null */
        public ?string $dynamicLast4=null,
        /** @var int */
        public int $expMonth=0,
        /** @var int */
        public int $expYear=0,
        /** @var string|null */
        public ?string $cvc=null,
        /** @var string|null */
        public ?string $name=null,
        /** @var string|null */
        public ?string $addressCity=null,
        /** @var string|null */
        public ?string $addressCountry=null,
        /** @var string|null */
        public ?string $addressLine1=null,
        /** @var string|null */
        public ?string $addressLine2=null,
        /** @var string|null */
        public ?string $addressState=null,
        /** @var string|null */
        public ?string $addressZip=null,
        /** @var StripeCvcCheck|null */
        public ?StripeCvcCheck $cvcCheck=null,
        /** @var string|null */
        public ?string $addressLine1Check=null,
        /** @var string|null */
        public ?string $addressZipCheck=null,
        /** @var string|null */
        public ?string $funding=null,
        /** @var string|null */
        public ?string $fingerprint=null,
        /** @var string|null */
        public ?string $customer=null,
        /** @var string|null */
        public ?string $country=null
    ) {
        parent::__construct($object,$id);
    }

    /** @throws Exception */
    public function fromMap($o): void {
        parent::fromMap($o);
        if (isset($o['brand'])) $this->brand = $o['brand'];
        if (isset($o['number'])) $this->number = $o['number'];
        if (isset($o['last4'])) $this->last4 = $o['last4'];
        if (isset($o['dynamicLast4'])) $this->dynamicLast4 = $o['dynamicLast4'];
        if (isset($o['expMonth'])) $this->expMonth = $o['expMonth'];
        if (isset($o['expYear'])) $this->expYear = $o['expYear'];
        if (isset($o['cvc'])) $this->cvc = $o['cvc'];
        if (isset($o['name'])) $this->name = $o['name'];
        if (isset($o['addressCity'])) $this->addressCity = $o['addressCity'];
        if (isset($o['addressCountry'])) $this->addressCountry = $o['addressCountry'];
        if (isset($o['addressLine1'])) $this->addressLine1 = $o['addressLine1'];
        if (isset($o['addressLine2'])) $this->addressLine2 = $o['addressLine2'];
        if (isset($o['addressState'])) $this->addressState = $o['addressState'];
        if (isset($o['addressZip'])) $this->addressZip = $o['addressZip'];
        if (isset($o['cvcCheck'])) $this->cvcCheck = JsonConverters::from('StripeCvcCheck', $o['cvcCheck']);
        if (isset($o['addressLine1Check'])) $this->addressLine1Check = $o['addressLine1Check'];
        if (isset($o['addressZipCheck'])) $this->addressZipCheck = $o['addressZipCheck'];
        if (isset($o['funding'])) $this->funding = $o['funding'];
        if (isset($o['fingerprint'])) $this->fingerprint = $o['fingerprint'];
        if (isset($o['customer'])) $this->customer = $o['customer'];
        if (isset($o['country'])) $this->country = $o['country'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = parent::jsonSerialize();
        if (isset($this->brand)) $o['brand'] = $this->brand;
        if (isset($this->number)) $o['number'] = $this->number;
        if (isset($this->last4)) $o['last4'] = $this->last4;
        if (isset($this->dynamicLast4)) $o['dynamicLast4'] = $this->dynamicLast4;
        if (isset($this->expMonth)) $o['expMonth'] = $this->expMonth;
        if (isset($this->expYear)) $o['expYear'] = $this->expYear;
        if (isset($this->cvc)) $o['cvc'] = $this->cvc;
        if (isset($this->name)) $o['name'] = $this->name;
        if (isset($this->addressCity)) $o['addressCity'] = $this->addressCity;
        if (isset($this->addressCountry)) $o['addressCountry'] = $this->addressCountry;
        if (isset($this->addressLine1)) $o['addressLine1'] = $this->addressLine1;
        if (isset($this->addressLine2)) $o['addressLine2'] = $this->addressLine2;
        if (isset($this->addressState)) $o['addressState'] = $this->addressState;
        if (isset($this->addressZip)) $o['addressZip'] = $this->addressZip;
        if (isset($this->cvcCheck)) $o['cvcCheck'] = JsonConverters::to('StripeCvcCheck', $this->cvcCheck);
        if (isset($this->addressLine1Check)) $o['addressLine1Check'] = $this->addressLine1Check;
        if (isset($this->addressZipCheck)) $o['addressZipCheck'] = $this->addressZipCheck;
        if (isset($this->funding)) $o['funding'] = $this->funding;
        if (isset($this->fingerprint)) $o['fingerprint'] = $this->fingerprint;
        if (isset($this->customer)) $o['customer'] = $this->customer;
        if (isset($this->country)) $o['country'] = $this->country;
        return empty($o) ? new class(){} : $o;
    }
}

enum StripeSubscriptionStatus : string
{
    case Unknown = 'Unknown';
    case Trialing = 'Trialing';
    case Active = 'Active';
    case PastDue = 'PastDue';
    case Canceled = 'Canceled';
    case Unpaid = 'Unpaid';
}

enum StripePlanInterval : string
{
    case month = 'month';
    case year = 'year';
}

class StripePlan extends StripeId implements JsonSerializable
{
    /**
     * @param StripeType|null $object
     * @param string|null $id
     */
    public function __construct(
        ?StripeType $object=null,
        ?string $id=null,
        /** @var int */
        public int $amount=0,
        /** @var DateTime|null */
        public ?DateTime $created=null,
        /** @var string|null */
        public ?string $currency=null,
        /** @var StripePlanInterval|null */
        public ?StripePlanInterval $interval=null,
        /** @var int|null */
        public ?int $intervalCount=null,
        /** @var bool|null */
        public ?bool $livemode=null,
        /** @var array<string,string>|null */
        public ?array $metadata=null,
        /** @var string|null */
        public ?string $nickname=null,
        /** @var string|null */
        public ?string $product=null,
        /** @var int|null */
        public ?int $trialPeriodDays=null
    ) {
        parent::__construct($object,$id);
    }

    /** @throws Exception */
    public function fromMap($o): void {
        parent::fromMap($o);
        if (isset($o['amount'])) $this->amount = $o['amount'];
        if (isset($o['created'])) $this->created = JsonConverters::from('DateTime', $o['created']);
        if (isset($o['currency'])) $this->currency = $o['currency'];
        if (isset($o['interval'])) $this->interval = JsonConverters::from('StripePlanInterval', $o['interval']);
        if (isset($o['intervalCount'])) $this->intervalCount = $o['intervalCount'];
        if (isset($o['livemode'])) $this->livemode = $o['livemode'];
        if (isset($o['metadata'])) $this->metadata = JsonConverters::from(JsonConverters::context('Dictionary',genericArgs:['string','string']), $o['metadata']);
        if (isset($o['nickname'])) $this->nickname = $o['nickname'];
        if (isset($o['product'])) $this->product = $o['product'];
        if (isset($o['trialPeriodDays'])) $this->trialPeriodDays = $o['trialPeriodDays'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = parent::jsonSerialize();
        if (isset($this->amount)) $o['amount'] = $this->amount;
        if (isset($this->created)) $o['created'] = JsonConverters::to('DateTime', $this->created);
        if (isset($this->currency)) $o['currency'] = $this->currency;
        if (isset($this->interval)) $o['interval'] = JsonConverters::to('StripePlanInterval', $this->interval);
        if (isset($this->intervalCount)) $o['intervalCount'] = $this->intervalCount;
        if (isset($this->livemode)) $o['livemode'] = $this->livemode;
        if (isset($this->metadata)) $o['metadata'] = JsonConverters::to(JsonConverters::context('Dictionary',genericArgs:['string','string']), $this->metadata);
        if (isset($this->nickname)) $o['nickname'] = $this->nickname;
        if (isset($this->product)) $o['product'] = $this->product;
        if (isset($this->trialPeriodDays)) $o['trialPeriodDays'] = $this->trialPeriodDays;
        return empty($o) ? new class(){} : $o;
    }
}

class StripeSubscription extends StripeId implements JsonSerializable
{
    /**
     * @param StripeType|null $object
     * @param string|null $id
     */
    public function __construct(
        ?StripeType $object=null,
        ?string $id=null,
        /** @var DateTime|null */
        public ?DateTime $currentPeriodEnd=null,
        /** @var StripeSubscriptionStatus|null */
        public ?StripeSubscriptionStatus $status=null,
        /** @var StripePlan|null */
        public ?StripePlan $plan=null,
        /** @var DateTime|null */
        public ?DateTime $currentPeriodStart=null,
        /** @var DateTime|null */
        public ?DateTime $start=null,
        /** @var DateTime|null */
        public ?DateTime $trialStart=null,
        /** @var bool|null */
        public ?bool $cancelAtPeriodEnd=null,
        /** @var DateTime|null */
        public ?DateTime $trialEnd=null,
        /** @var DateTime|null */
        public ?DateTime $canceledAt=null,
        /** @var DateTime|null */
        public ?DateTime $endedAt=null,
        /** @var string|null */
        public ?string $customer=null,
        /** @var int */
        public int $quantity=0
    ) {
        parent::__construct($object,$id);
    }

    /** @throws Exception */
    public function fromMap($o): void {
        parent::fromMap($o);
        if (isset($o['currentPeriodEnd'])) $this->currentPeriodEnd = JsonConverters::from('DateTime', $o['currentPeriodEnd']);
        if (isset($o['status'])) $this->status = JsonConverters::from('StripeSubscriptionStatus', $o['status']);
        if (isset($o['plan'])) $this->plan = JsonConverters::from('StripePlan', $o['plan']);
        if (isset($o['currentPeriodStart'])) $this->currentPeriodStart = JsonConverters::from('DateTime', $o['currentPeriodStart']);
        if (isset($o['start'])) $this->start = JsonConverters::from('DateTime', $o['start']);
        if (isset($o['trialStart'])) $this->trialStart = JsonConverters::from('DateTime', $o['trialStart']);
        if (isset($o['cancelAtPeriodEnd'])) $this->cancelAtPeriodEnd = $o['cancelAtPeriodEnd'];
        if (isset($o['trialEnd'])) $this->trialEnd = JsonConverters::from('DateTime', $o['trialEnd']);
        if (isset($o['canceledAt'])) $this->canceledAt = JsonConverters::from('DateTime', $o['canceledAt']);
        if (isset($o['endedAt'])) $this->endedAt = JsonConverters::from('DateTime', $o['endedAt']);
        if (isset($o['customer'])) $this->customer = $o['customer'];
        if (isset($o['quantity'])) $this->quantity = $o['quantity'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = parent::jsonSerialize();
        if (isset($this->currentPeriodEnd)) $o['currentPeriodEnd'] = JsonConverters::to('DateTime', $this->currentPeriodEnd);
        if (isset($this->status)) $o['status'] = JsonConverters::to('StripeSubscriptionStatus', $this->status);
        if (isset($this->plan)) $o['plan'] = JsonConverters::to('StripePlan', $this->plan);
        if (isset($this->currentPeriodStart)) $o['currentPeriodStart'] = JsonConverters::to('DateTime', $this->currentPeriodStart);
        if (isset($this->start)) $o['start'] = JsonConverters::to('DateTime', $this->start);
        if (isset($this->trialStart)) $o['trialStart'] = JsonConverters::to('DateTime', $this->trialStart);
        if (isset($this->cancelAtPeriodEnd)) $o['cancelAtPeriodEnd'] = $this->cancelAtPeriodEnd;
        if (isset($this->trialEnd)) $o['trialEnd'] = JsonConverters::to('DateTime', $this->trialEnd);
        if (isset($this->canceledAt)) $o['canceledAt'] = JsonConverters::to('DateTime', $this->canceledAt);
        if (isset($this->endedAt)) $o['endedAt'] = JsonConverters::to('DateTime', $this->endedAt);
        if (isset($this->customer)) $o['customer'] = $this->customer;
        if (isset($this->quantity)) $o['quantity'] = $this->quantity;
        return empty($o) ? new class(){} : $o;
    }
}

class StripeCustomer extends StripeId implements JsonSerializable
{
    /**
     * @param StripeType|null $object
     * @param string|null $id
     */
    public function __construct(
        ?StripeType $object=null,
        ?string $id=null,
        /** @var int */
        public int $accountBalance=0,
        /** @var string|null */
        public ?string $businessVatId=null,
        /** @var DateTime|null */
        public ?DateTime $created=null,
        /** @var string|null */
        public ?string $defaultSource=null,
        /** @var bool|null */
        public ?bool $delinquent=null,
        /** @var string|null */
        public ?string $description=null,
        /** @var StripeDiscount|null */
        public ?StripeDiscount $discount=null,
        /** @var string|null */
        public ?string $email=null,
        /** @var string|null */
        public ?string $invoicePrefix=null,
        /** @var bool|null */
        public ?bool $livemode=null,
        /** @var array<string,string>|null */
        public ?array $metadata=null,
        /** @var StripeShipping|null */
        public ?StripeShipping $shipping=null,
        /** @var StripeCollection<StripeCard>|null */
        public ?StripeCollection $sources=null,
        /** @var StripeCollection<StripeSubscription>|null */
        public ?StripeCollection $subscriptions=null,
        /** @var bool|null */
        public ?bool $deleted=null,
        /** @var string|null */
        public ?string $currency=null
    ) {
        parent::__construct($object,$id);
    }

    /** @throws Exception */
    public function fromMap($o): void {
        parent::fromMap($o);
        if (isset($o['accountBalance'])) $this->accountBalance = $o['accountBalance'];
        if (isset($o['businessVatId'])) $this->businessVatId = $o['businessVatId'];
        if (isset($o['created'])) $this->created = JsonConverters::from('DateTime', $o['created']);
        if (isset($o['defaultSource'])) $this->defaultSource = $o['defaultSource'];
        if (isset($o['delinquent'])) $this->delinquent = $o['delinquent'];
        if (isset($o['description'])) $this->description = $o['description'];
        if (isset($o['discount'])) $this->discount = JsonConverters::from('StripeDiscount', $o['discount']);
        if (isset($o['email'])) $this->email = $o['email'];
        if (isset($o['invoicePrefix'])) $this->invoicePrefix = $o['invoicePrefix'];
        if (isset($o['livemode'])) $this->livemode = $o['livemode'];
        if (isset($o['metadata'])) $this->metadata = JsonConverters::from(JsonConverters::context('Dictionary',genericArgs:['string','string']), $o['metadata']);
        if (isset($o['shipping'])) $this->shipping = JsonConverters::from('StripeShipping', $o['shipping']);
        if (isset($o['sources'])) $this->sources = JsonConverters::from(JsonConverters::context('StripeCollection',genericArgs:['StripeCard']), $o['sources']);
        if (isset($o['subscriptions'])) $this->subscriptions = JsonConverters::from(JsonConverters::context('StripeCollection',genericArgs:['StripeSubscription']), $o['subscriptions']);
        if (isset($o['deleted'])) $this->deleted = $o['deleted'];
        if (isset($o['currency'])) $this->currency = $o['currency'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = parent::jsonSerialize();
        if (isset($this->accountBalance)) $o['accountBalance'] = $this->accountBalance;
        if (isset($this->businessVatId)) $o['businessVatId'] = $this->businessVatId;
        if (isset($this->created)) $o['created'] = JsonConverters::to('DateTime', $this->created);
        if (isset($this->defaultSource)) $o['defaultSource'] = $this->defaultSource;
        if (isset($this->delinquent)) $o['delinquent'] = $this->delinquent;
        if (isset($this->description)) $o['description'] = $this->description;
        if (isset($this->discount)) $o['discount'] = JsonConverters::to('StripeDiscount', $this->discount);
        if (isset($this->email)) $o['email'] = $this->email;
        if (isset($this->invoicePrefix)) $o['invoicePrefix'] = $this->invoicePrefix;
        if (isset($this->livemode)) $o['livemode'] = $this->livemode;
        if (isset($this->metadata)) $o['metadata'] = JsonConverters::to(JsonConverters::context('Dictionary',genericArgs:['string','string']), $this->metadata);
        if (isset($this->shipping)) $o['shipping'] = JsonConverters::to('StripeShipping', $this->shipping);
        if (isset($this->sources)) $o['sources'] = JsonConverters::to(JsonConverters::context('StripeCollection',genericArgs:['StripeCard']), $this->sources);
        if (isset($this->subscriptions)) $o['subscriptions'] = JsonConverters::to(JsonConverters::context('StripeCollection',genericArgs:['StripeSubscription']), $this->subscriptions);
        if (isset($this->deleted)) $o['deleted'] = $this->deleted;
        if (isset($this->currency)) $o['currency'] = $this->currency;
        return empty($o) ? new class(){} : $o;
    }
}

class CreateSubscribeCustomer implements IPost, JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $email=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['email'])) $this->email = $o['email'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->email)) $o['email'] = $this->email;
        return empty($o) ? new class(){} : $o;
    }
}

/**
 * @template T
 */
class StripeCollection extends StripeId implements JsonSerializable
{
    public array $genericArgs = [];
    public static function create(array $genericArgs=[]): StripeCollection {
        $to = new StripeCollection();
        $to->genericArgs = $genericArgs;
        return $to;
    }

    /**
     * @param StripeType|null $object
     * @param string|null $id
     */
    public function __construct(
        mixed $object=null,
        mixed $id=null,
        /** @var string|null */
        public mixed $url=null,
        /** @var int */
        public mixed $totalCount=0,
        /** @var bool|null */
        public mixed $hasMore=null,
        /** @var array<T>|null */
        public mixed $data=null
    ) {
        parent::__construct($object,$id);
    }

    /** @throws Exception */
    public function fromMap($o): void {
        parent::fromMap($o);
        if (isset($o['url'])) $this->url = $o['url'];
        if (isset($o['totalCount'])) $this->totalCount = $o['totalCount'];
        if (isset($o['hasMore'])) $this->hasMore = JsonConverters::from('bool', $o['hasMore']);
        if (isset($o['data'])) $this->data = JsonConverters::fromArray($this->genericArgs[0], $o['data']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = parent::jsonSerialize();
        if (isset($this->url)) $o['url'] = $this->url;
        if (isset($this->totalCount)) $o['totalCount'] = $this->totalCount;
        if (isset($this->hasMore)) $o['hasMore'] = JsonConverters::to('bool', $this->hasMore);
        if (isset($this->data)) $o['data'] = JsonConverters::toArray($this->genericArgs[0], $this->data);
        return empty($o) ? new class(){} : $o;
    }
}

PHP CreateSubscribeCustomer DTOs

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

HTTP + 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: sfgboxapi.dev.scadsoftware.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>