Skip to content

Latest commit

 

History

History
251 lines (159 loc) · 9.55 KB

README.md

File metadata and controls

251 lines (159 loc) · 9.55 KB

CheckoutLinks

(checkoutLinks)

Overview

Available Operations

  • create - Create Checkout Link
  • delete - Delete Checkout Link
  • get - Get Checkout Link
  • list - List Checkout Links
  • update - Update Checkout Link

create

Create a checkout link.

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

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

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

Parameters

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

Response

?Operations\CheckoutLinksCreateResponse

Errors

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

delete

Delete a checkout link.

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->checkoutLinks->delete(
    id: '<value>'
);

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

Parameters

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

Response

?Operations\CheckoutLinksDeleteResponse

Errors

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

get

Get a checkout link 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->checkoutLinks->get(
    id: '<value>'
);

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

Parameters

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

Response

?Operations\CheckoutLinksGetResponse

Errors

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

list

List checkout links.

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

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


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

Parameters

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

Response

?Operations\CheckoutLinksListResponse

Errors

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

update

Update a checkout link.

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

$checkoutLinkUpdate = new Components\CheckoutLinkUpdate();

$response = $sdk->checkoutLinks->update(
    id: '<value>',
    checkoutLinkUpdate: $checkoutLinkUpdate

);

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

Parameters

Parameter Type Required Description
id string ✔️ The checkout link ID.
checkoutLinkUpdate Components\CheckoutLinkUpdate ✔️ N/A

Response

?Operations\CheckoutLinksUpdateResponse

Errors

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