Skip to content

Latest commit

 

History

History
107 lines (67 loc) · 3.77 KB

README.md

File metadata and controls

107 lines (67 loc) · 3.77 KB

Checkouts

(checkouts)

Overview

Available Operations

  • create - Create Checkout ⚠️ Deprecated Use create instead.
  • get - Get Checkout ⚠️ Deprecated

create

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.. Use create instead.

Example Usage

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
}

Parameters

Parameter Type Required Description
$request Components\CheckoutLegacyCreate ✔️ The request object to use for the request.

Response

?Operations\CheckoutsCreateResponse

Errors

Error Type Status Code Content Type
Errors\HTTPValidationError 422 application/json
Errors\APIException 4XX, 5XX */*

get

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..

Example Usage

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
}

Parameters

Parameter Type Required Description
id string ✔️ N/A

Response

?Operations\CheckoutsGetResponse

Errors

Error Type Status Code Content Type
Errors\HTTPValidationError 422 application/json
Errors\APIException 4XX, 5XX */*