| Required role: | Business |
| GET | /subscription/get_plans |
|---|
<?php namespace BusinessApi;
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};
class PlanDetailsFreeUntil implements JsonSerializable
{
public function __construct(
/** @var DateTime */
public DateTime $stopAt=new DateTime()
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['stopAt'])) $this->stopAt = JsonConverters::from('DateTime', $o['stopAt']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->stopAt)) $o['stopAt'] = JsonConverters::to('DateTime', $this->stopAt);
return empty($o) ? new class(){} : $o;
}
}
enum Period : string
{
case Monthly = 'Monthly';
case Yearly = 'Yearly';
}
class PlanDetailsInvoice implements JsonSerializable
{
public function __construct(
/** @var Period|null */
public ?Period $period=null,
/** @var float */
public float $amount=0.0,
/** @var string|null */
public ?string $currency=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['period'])) $this->period = JsonConverters::from('Period', $o['period']);
if (isset($o['amount'])) $this->amount = $o['amount'];
if (isset($o['currency'])) $this->currency = $o['currency'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->period)) $o['period'] = JsonConverters::to('Period', $this->period);
if (isset($this->amount)) $o['amount'] = $this->amount;
if (isset($this->currency)) $o['currency'] = $this->currency;
return empty($o) ? new class(){} : $o;
}
}
class PlanDetailsMonthlyStripe implements JsonSerializable
{
public function __construct(
/** @var float */
public float $amount=0.0,
/** @var string|null */
public ?string $currency=null,
/** @var int|null */
public ?int $freeStartUpMonths=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['amount'])) $this->amount = $o['amount'];
if (isset($o['currency'])) $this->currency = $o['currency'];
if (isset($o['freeStartUpMonths'])) $this->freeStartUpMonths = $o['freeStartUpMonths'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->amount)) $o['amount'] = $this->amount;
if (isset($this->currency)) $o['currency'] = $this->currency;
if (isset($this->freeStartUpMonths)) $o['freeStartUpMonths'] = $this->freeStartUpMonths;
return empty($o) ? new class(){} : $o;
}
}
class PlanDetailsFreeOnClaim implements JsonSerializable
{
public function __construct(
/** @var int */
public int $months=0
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['months'])) $this->months = $o['months'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->months)) $o['months'] = $this->months;
return empty($o) ? new class(){} : $o;
}
}
class SubscriptionPlanDetailsUnion implements JsonSerializable
{
public function __construct(
/** @var PlanDetailsFreeUntil|null */
public ?PlanDetailsFreeUntil $freeUntil=null,
/** @var PlanDetailsInvoice|null */
public ?PlanDetailsInvoice $invoice=null,
/** @var PlanDetailsMonthlyStripe|null */
public ?PlanDetailsMonthlyStripe $monthlyStripe=null,
/** @var PlanDetailsFreeOnClaim|null */
public ?PlanDetailsFreeOnClaim $freeOnClaim=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['freeUntil'])) $this->freeUntil = JsonConverters::from('PlanDetailsFreeUntil', $o['freeUntil']);
if (isset($o['invoice'])) $this->invoice = JsonConverters::from('PlanDetailsInvoice', $o['invoice']);
if (isset($o['monthlyStripe'])) $this->monthlyStripe = JsonConverters::from('PlanDetailsMonthlyStripe', $o['monthlyStripe']);
if (isset($o['freeOnClaim'])) $this->freeOnClaim = JsonConverters::from('PlanDetailsFreeOnClaim', $o['freeOnClaim']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->freeUntil)) $o['freeUntil'] = JsonConverters::to('PlanDetailsFreeUntil', $this->freeUntil);
if (isset($this->invoice)) $o['invoice'] = JsonConverters::to('PlanDetailsInvoice', $this->invoice);
if (isset($this->monthlyStripe)) $o['monthlyStripe'] = JsonConverters::to('PlanDetailsMonthlyStripe', $this->monthlyStripe);
if (isset($this->freeOnClaim)) $o['freeOnClaim'] = JsonConverters::to('PlanDetailsFreeOnClaim', $this->freeOnClaim);
return empty($o) ? new class(){} : $o;
}
}
PHP GetSubscriptionPlansRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
GET /subscription/get_plans HTTP/1.1 Host: business-api.brovs.com Accept: text/csv
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length
{"subscriptionPlan":[{"id":0,"canBeSelectedByClient":false,"slug":"String","subscriptionPlanDetails":{"freeUntil":{"stopAt":"0001-01-01T00:00:00.0000000Z"},"invoice":{"period":"Monthly","amount":0,"currency":"String"},"monthlyStripe":{"amount":0,"currency":"String","freeStartUpMonths":0},"freeOnClaim":{"months":0}}}]}