(checkouts)
Create a checkout session.
⚠️ DEPRECATED: This API is deprecated. We recommend you to use the new custom checkout API, which is more flexible and powerful. Please refer to the documentation for more information.. Usecreate
instead.
declare(strict_types=1);
require 'vendor/autoload.php';
use Polar;
use Polar\Models\Components;
$security = '<YOUR_BEARER_TOKEN_HERE>';
$sdk = Polar\Polar::builder()->setSecurity($security)->build();
$request = new Components\CheckoutLegacyCreate(
productPriceId: '<value>',
successUrl: 'https://probable-heating.com/',
);
$response = $sdk->checkouts->create(
request: $request
);
if ($response->checkoutLegacy !== null) {
// handle response
}
Parameter | Type | Required | Description |
---|---|---|---|
$request |
Components\CheckoutLegacyCreate | ✔️ | The request object to use for the request. |
?Operations\CheckoutsCreateResponse
Error Type | Status Code | Content Type |
---|---|---|
Errors\HTTPValidationError | 422 | application/json |
Errors\APIException | 4XX, 5XX | */* |
Get an active checkout session by ID.
⚠️ DEPRECATED: This API is deprecated. We recommend you to use the new custom checkout API, which is more flexible and powerful. Please refer to the documentation for more information..
declare(strict_types=1);
require 'vendor/autoload.php';
use Polar;
$security = '<YOUR_BEARER_TOKEN_HERE>';
$sdk = Polar\Polar::builder()->setSecurity($security)->build();
$response = $sdk->checkouts->get(
id: '<id>'
);
if ($response->checkoutLegacy !== null) {
// handle response
}
Parameter | Type | Required | Description |
---|---|---|---|
id |
string | ✔️ | N/A |
?Operations\CheckoutsGetResponse
Error Type | Status Code | Content Type |
---|---|---|
Errors\HTTPValidationError | 422 | application/json |
Errors\APIException | 4XX, 5XX | */* |