Manage catalog products for PayPal Subscriptions.
Products represent the goods or services that you offer to your subscribers. Before creating a billing plan or subscription, you need to create a product.
Official PayPal API Documentation: PayPal Catalog Products API v1
Summary
Functions
Create a product.
List products with optional pagination filters.
Show product details by product ID.
Returns the supported product types
Update a product by ID using JSON Patch operations.
Functions
@spec create(map()) :: {:ok, Paypal.Subscription.Product.Info.t()} | {:error, Paypal.Common.Error.t() | term()}
Create a product.
Official documentation: Create Product
Examples
iex> Paypal.Subscription.Product.create(%{
...> name: "Video Streaming Service",
...> type: :service,
...> description: "Monthly video streaming access",
...> category: "SOFTWARE"
...> })
{:ok, %Paypal.Subscription.Product.Info{id: "PROD-123", ...}}
@spec list(keyword() | map()) :: {:ok, Paypal.Subscription.Product.List.t()} | {:error, Paypal.Common.Error.t() | term()}
List products with optional pagination filters.
Official documentation: List Products
Options
:page_size- Number of items per page (1 to 20, default 10).:page- Page number (default 1).:total_required- Whether total items count is returned (trueorfalse).
@spec show(String.t()) :: {:ok, Paypal.Subscription.Product.Info.t()} | {:error, Paypal.Common.Error.t() | term()}
Show product details by product ID.
Official documentation: Show Product Details
Returns the supported product types:
:physical- Physical goods.:digital- Digital goods.:service- Services or recurring memberships.
@spec update(String.t(), [map()]) :: :ok | {:error, Paypal.Common.Error.t() | term()}
Update a product by ID using JSON Patch operations.
Official documentation: Update Product
Examples
iex> Paypal.Subscription.Product.update("PROD-123", [
...> %{op: "replace", path: "/description", value: "New product description"}
...> ])
:ok