Skip to content

Latest commit

 

History

History
276 lines (181 loc) · 4.92 KB

Products.md

File metadata and controls

276 lines (181 loc) · 4.92 KB

Products

A list of all methods in the Products service. Click on the method name to view detailed information about that method.

Methods Description
list_products
create_product
get_product_handler
patch_product
delete_product
update_product_image
undelete_product

list_products

  • HTTP Method: GET
  • Endpoint: /products

Parameters

Name Type Required Description
$pageSize int Page size default is 10 max is 100
$pageNumber int Page number default is 0
$archived bool List archived products

Return Type

Models\GetProductsListResponse

Example Usage Code Snippet

<?php

use Dodopayments\Client;

$sdk = new Client(accessToken: 'YOUR_TOKEN');

$response = $sdk->products->listProducts(
  pageSize: 5,
  pageNumber: 8,
  archived: true
);

print_r($response);

create_product

  • HTTP Method: POST
  • Endpoint: /products

Parameters

Name Type Required Description
input Models\CreateProductRequest

Return Type

Models\GetProductResponse

Example Usage Code Snippet

<?php

use Dodopayments\Client;
use Dodopayments\Models\LicenseKeyDuration;
use Dodopayments\Models\Price;
use Dodopayments\Models\TaxCategory;
use Dodopayments\Models\CreateProductRequest;

$sdk = new Client(accessToken: 'YOUR_TOKEN');

COMPLEX_MODEL_NOT_IMPLEMENTED

$taxCategory = Models\TaxCategory::DigitalProducts;

$input = new Models\CreateProductRequest(
  description: "description",
  licenseKeyActivationMessage: "license_key_activation_message",
  licenseKeyActivationsLimit: 10,
  licenseKeyDuration: $licenseKeyDuration,
  licenseKeyEnabled: true,
  name: "name",
  price: $price,
  taxCategory: $taxCategory
);

$response = $sdk->products->createProduct(
  input: $input
);

print_r($response);

get_product_handler

  • HTTP Method: GET
  • Endpoint: /products/{id}

Parameters

Name Type Required Description
$id string Product Id

Return Type

Models\GetProductResponse

Example Usage Code Snippet

<?php

use Dodopayments\Client;

$sdk = new Client(accessToken: 'YOUR_TOKEN');

$response = $sdk->products->getProductHandler(
  id: "id"
);

print_r($response);

patch_product

  • HTTP Method: PATCH
  • Endpoint: /products/{id}

Parameters

Name Type Required Description
input Models\PatchProductRequest
$id string

Return Type

mixed

Example Usage Code Snippet

<?php

use Dodopayments\Client;
use Dodopayments\Models\LicenseKeyDuration;
use Dodopayments\Models\Price;
use Dodopayments\Models\TaxCategory;
use Dodopayments\Models\PatchProductRequest;

$sdk = new Client(accessToken: 'YOUR_TOKEN');


$input = new Models\PatchProductRequest(
  description: "description",
  licenseKeyActivationMessage: "license_key_activation_message",
  licenseKeyActivationsLimit: 1,
  licenseKeyDuration: $licenseKeyDuration,
  licenseKeyEnabled: true,
  name: "name",
  price: $price,
  taxCategory: $taxCategory
);

$response = $sdk->products->patchProduct(
  input: $input,
  id: "id"
);

print_r($response);

delete_product

  • HTTP Method: DELETE
  • Endpoint: /products/{id}

Parameters

Name Type Required Description
$id string

Return Type

mixed

Example Usage Code Snippet

<?php

use Dodopayments\Client;

$sdk = new Client(accessToken: 'YOUR_TOKEN');

$response = $sdk->products->deleteProduct(
  id: "id"
);

print_r($response);

update_product_image

  • HTTP Method: PUT
  • Endpoint: /products/{id}/images

Parameters

Name Type Required Description
$id string Product Id

Return Type

Models\UpdateProductImageResponse

Example Usage Code Snippet

<?php

use Dodopayments\Client;

$sdk = new Client(accessToken: 'YOUR_TOKEN');

$response = $sdk->products->updateProductImage(
  id: "id"
);

print_r($response);

undelete_product

  • HTTP Method: POST
  • Endpoint: /products/{id}/unarchive

Parameters

Name Type Required Description
$id string

Return Type

mixed

Example Usage Code Snippet

<?php

use Dodopayments\Client;

$sdk = new Client(accessToken: 'YOUR_TOKEN');

$response = $sdk->products->undeleteProduct(
  id: "id"
);

print_r($response);