Skip to main content
POST
/
v1
/
customer-sessions
PHP (SDK)
declare(strict_types=1);

require 'vendor/autoload.php';

use Polar;
use Polar\Models\Components;

$sdk = Polar\Polar::builder()
    ->setSecurity(
        '<YOUR_BEARER_TOKEN_HERE>'
    )
    ->build();

$request = new Components\CustomerSessionCustomerExternalIDCreate(
    externalCustomerId: '<id>',
);

$response = $sdk->customerSessions->create(
    request: $request
);

if ($response->customerSession !== null) {
    // handle response
}
{
  "created_at": "2023-11-07T05:31:56Z",
  "modified_at": "2023-11-07T05:31:56Z",
  "id": "<string>",
  "token": "<string>",
  "expires_at": "2023-11-07T05:31:56Z",
  "return_url": "<string>",
  "customer_portal_url": "<string>",
  "customer_id": "<string>",
  "customer": {
    "id": "<string>",
    "created_at": "2023-11-07T05:31:56Z",
    "modified_at": "2023-11-07T05:31:56Z",
    "metadata": {},
    "email": "<string>",
    "email_verified": true,
    "name": "John Doe",
    "billing_address": {
      "country": "AD",
      "line1": "<string>",
      "line2": "<string>",
      "postal_code": "<string>",
      "city": "<string>",
      "state": "<string>"
    },
    "tax_id": {
      "[0]": "<string>"
    },
    "organization_id": "<string>",
    "deleted_at": "2023-11-07T05:31:56Z",
    "avatar_url": "<string>",
    "external_id": "usr_1337",
    "type": "individual",
    "locale": "<string>"
  }
}

Authorizations

Authorization
string
header
required

You can generate an Organization Access Token from your organization's settings.

Body

application/json

Schema for creating a customer session using a customer ID.

customer_id
string<uuid4>
required

ID of the customer to create a session for.

member_id
string<uuid4> | null

ID of the member to create a session for. When not provided and the organization has member_model_enabled, the owner member of the customer will be used for individual customers.

external_member_id
string | null

External ID of the member to create a session for. Alternative to member_id.

return_url
string<uri> | null

When set, a back button will be shown in the customer portal to return to this URL.

Required string length: 1 - 2083
Example:

"https://example.com/account"

Response

Customer session created.

A customer session that can be used to authenticate as a customer.

created_at
string<date-time>
required

Creation timestamp of the object.

modified_at
string<date-time> | null
required

Last modification timestamp of the object.

id
string<uuid4>
required

The ID of the object.

token
string
required
expires_at
string<date-time>
required
return_url
string | null
required
customer_portal_url
string
required
customer_id
string<uuid4>
required
customer
Customer · object
required

A customer in an organization.