Skip to content

Latest commit

 

History

History
355 lines (226 loc) · 14.8 KB

README.md

File metadata and controls

355 lines (226 loc) · 14.8 KB

Custom

(checkouts->custom)

Overview

Available Operations

  • clientConfirm - Confirm Checkout Session from Client
  • clientGet - Get Checkout Session from Client
  • clientUpdate - Update Checkout Session from Client
  • create - Create Checkout Session
  • get - Get Checkout Session
  • list - List Checkout Sessions
  • update - Update Checkout Session

clientConfirm

Confirm a checkout session by client secret.

Orders and subscriptions will be processed.

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();

$checkoutConfirmStripe = new Components\CheckoutConfirmStripe();

$response = $sdk->checkouts->custom->clientConfirm(
    clientSecret: '<value>',
    checkoutConfirmStripe: $checkoutConfirmStripe

);

if ($response->checkoutPublicConfirmed !== null) {
    // handle response
}

Parameters

Parameter Type Required Description
clientSecret string ✔️ The checkout session client secret.
checkoutConfirmStripe Components\CheckoutConfirmStripe ✔️ N/A

Response

?Operations\CheckoutsCustomClientConfirmResponse

Errors

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

clientGet

Get a checkout session by client secret.

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->custom->clientGet(
    clientSecret: '<value>'
);

if ($response->checkoutPublic !== null) {
    // handle response
}

Parameters

Parameter Type Required Description
clientSecret string ✔️ The checkout session client secret.

Response

?Operations\CheckoutsCustomClientGetResponse

Errors

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

clientUpdate

Update a checkout session by client secret.

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();

$checkoutUpdatePublic = new Components\CheckoutUpdatePublic();

$response = $sdk->checkouts->custom->clientUpdate(
    clientSecret: '<value>',
    checkoutUpdatePublic: $checkoutUpdatePublic

);

if ($response->checkoutPublic !== null) {
    // handle response
}

Parameters

Parameter Type Required Description
clientSecret string ✔️ The checkout session client secret.
checkoutUpdatePublic Components\CheckoutUpdatePublic ✔️ N/A

Response

?Operations\CheckoutsCustomClientUpdateResponse

Errors

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

create

Create a checkout session.

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\CheckoutProductCreate(
    productId: '<value>',
);

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

if ($response->checkout !== null) {
    // handle response
}

Parameters

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

Response

?Operations\CheckoutsCustomCreateResponse

Errors

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

get

Get a checkout session by ID.

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->custom->get(
    id: '<value>'
);

if ($response->checkout !== null) {
    // handle response
}

Parameters

Parameter Type Required Description
id string ✔️ The checkout session ID.

Response

?Operations\CheckoutsCustomGetResponse

Errors

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

list

List checkout sessions.

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use Polar;
use Polar\Models\Operations;

$security = '<YOUR_BEARER_TOKEN_HERE>';

$sdk = Polar\Polar::builder()->setSecurity($security)->build();

$request = new Operations\CheckoutsCustomListRequest();

$responses = $sdk->checkouts->custom->list(
    request: $request
);


foreach ($responses as $response) {
    if ($response->statusCode === 200) {
        // handle response
    }
}

Parameters

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

Response

?Operations\CheckoutsCustomListResponse

Errors

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

update

Update a checkout session.

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();

$checkoutUpdate = new Components\CheckoutUpdate();

$response = $sdk->checkouts->custom->update(
    id: '<value>',
    checkoutUpdate: $checkoutUpdate

);

if ($response->checkout !== null) {
    // handle response
}

Parameters

Parameter Type Required Description
id string ✔️ The checkout session ID.
checkoutUpdate Components\CheckoutUpdate ✔️ N/A

Response

?Operations\CheckoutsCustomUpdateResponse

Errors

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