Customer management
*
* @property string $id Unique identifier for the object.
* @property string $object String representing the object's type. Objects of the same type share the same value.
* @property Configuration|string $configuration The configuration used by this session, describing the features available.
* @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
* @property string $customer The ID of the customer for this session.
* @property null|(object{after_completion: (object{hosted_confirmation: null|(object{custom_message: null|string}&\Stripe\StripeObject), redirect: null|(object{return_url: string}&\Stripe\StripeObject), type: string}&\Stripe\StripeObject), subscription_cancel: null|(object{retention: null|(object{coupon_offer: null|(object{coupon: string}&\Stripe\StripeObject), type: string}&\Stripe\StripeObject), subscription: string}&\Stripe\StripeObject), subscription_update: null|(object{subscription: string}&\Stripe\StripeObject), subscription_update_confirm: null|(object{discounts: null|((object{coupon: null|string, promotion_code: null|string}&\Stripe\StripeObject))[], items: ((object{id: null|string, price: null|string, quantity?: int}&\Stripe\StripeObject))[], subscription: string}&\Stripe\StripeObject), type: string}&\Stripe\StripeObject) $flow Information about a specific flow for the customer to go through. See the docs to learn more about using customer portal deep links and flows.
* @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode.
* @property null|string $locale The IETF language tag of the locale Customer Portal is displayed in. If blank or auto, the customer’s preferred_locales or browser’s locale is used.
* @property null|string $on_behalf_of The account for which the session was created on behalf of. When specified, only subscriptions and invoices with this on_behalf_of account appear in the portal. For more information, see the docs. Use the Accounts API to modify the on_behalf_of account's branding settings, which the portal displays.
* @property null|string $return_url The URL to redirect customers to when they click on the portal's link to return to your website.
* @property string $url The short-lived URL of the session that gives customers access to the customer portal.
*/
class Session extends \Stripe\ApiResource
{
const OBJECT_NAME = 'billing_portal.session';
/**
* Creates a session of the customer portal.
*
* @param null|array{configuration?: string, customer: string, expand?: string[], flow_data?: array{after_completion?: array{hosted_confirmation?: array{custom_message?: string}, redirect?: array{return_url: string}, type: string}, subscription_cancel?: array{retention?: array{coupon_offer: array{coupon: string}, type: string}, subscription: string}, subscription_update?: array{subscription: string}, subscription_update_confirm?: array{discounts?: array{coupon?: string, promotion_code?: string}[], items: array{id: string, price?: string, quantity?: int}[], subscription: string}, type: string}, locale?: string, on_behalf_of?: string, return_url?: string} $params
* @param null|array|string $options
*
* @return Session the created resource
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*/
public static function create($params = null, $options = null)
{
self::_validateParams($params);
$url = static::classUrl();
list($response, $opts) = static::_staticRequest('post', $url, $params, $options);
$obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
$obj->setLastResponse($response);
return $obj;
}
}