Create a product 

Creates a new product object.

Parameters

  • namestringRequired

    The product’s name, meant to be displayable to the customer.

  • activeboolean

    Whether the product is currently available for purchase. Defaults to true.

  • descriptionstring

    The product’s description, meant to be displayable to the customer. Use this field to optionally store a long form explanation of the product being sold for your own rendering purposes.

  • idstring

    An identifier will be randomly generated by Stripe. You can optionally override this ID, but the ID must be unique across all products in your Stripe account.

  • metadataMap

    Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to metadata.

  • tax_codestringRecommended if calculating taxes

    A tax code ID.

More parameters

  • default_price_dataMap

  • imagesarray of strings

  • marketing_featuresarray of Maps

  • package_dimensionsMap

  • shippableboolean

  • statement_descriptorstring

  • unit_labelstring

  • urlstring

Returns

Returns a product object if the call succeeded.

POST /v1/products
Stripe.apiKey = "sk_test_BQokikJ...2HlWgH4olfQ2sk_test_BQokikJOvBiI2HlWgH4olfQ2";
ProductCreateParams params =
ProductCreateParams.builder().setName("Gold Plan").build();
Product product = Product.create(params);
Response
{
"id": "prod_NWjs8kKbJWmuuc",
"object": "product",
"active": true,
"created": 1678833149,
"default_price": null,
"description": null,
"images": [],
"marketing_features": [],
"livemode": false,
"metadata": {},
"name": "Gold Plan",
"package_dimensions": null,
"shippable": null,
"statement_descriptor": null,
"tax_code": null,
"unit_label": null,
"updated": 1678833149,
"url": null
}

Update a product 

Updates the specific product by setting the values of the parameters passed. Any parameters not provided will be left unchanged.

Parameters

  • activeboolean

    Whether the product is available for purchase.

  • default_pricestring

    The ID of the Price object that is the default price for this product.

  • descriptionstring

    The product’s description, meant to be displayable to the customer. Use this field to optionally store a long form explanation of the product being sold for your own rendering purposes.

  • metadataMap

    Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to metadata.

  • namestring

    The product’s name, meant to be displayable to the customer.

  • tax_codestringRecommended if calculating taxes

    A tax code ID.

More parameters

  • imagesarray of strings

  • marketing_featuresarray of Maps

  • package_dimensionsMap

  • shippableboolean

  • statement_descriptorstring

  • unit_labelstring

  • urlstring

Returns

Returns the product object if the update succeeded.

POST /v1/products/:id
Stripe.apiKey = "sk_test_BQokikJ...2HlWgH4olfQ2sk_test_BQokikJOvBiI2HlWgH4olfQ2";
Product resource = Product.retrieve("prod_NWjs8kKbJWmuuc");
ProductUpdateParams params =
ProductUpdateParams.builder().putMetadata("order_id", "6735").build();
Product product = resource.update(params);
Response
{
"id": "prod_NWjs8kKbJWmuuc",
"object": "product",
"active": true,
"created": 1678833149,
"default_price": null,
"description": null,
"images": [],
"marketing_features": [],
"livemode": false,
"metadata": {
"order_id": "6735"
},
"name": "Gold Plan",
"package_dimensions": null,
"shippable": null,
"statement_descriptor": null,
"tax_code": null,
"unit_label": null,
"updated": 1678833149,
"url": null
}

Retrieve a product 

Retrieves the details of an existing product. Supply the unique product ID from either a product creation request or the product list, and Stripe will return the corresponding product information.

Parameters

No parameters.

Returns

Returns a product object if a valid identifier was provided.

GET /v1/products/:id
Stripe.apiKey = "sk_test_BQokikJ...2HlWgH4olfQ2sk_test_BQokikJOvBiI2HlWgH4olfQ2";
Product product = Product.retrieve("prod_NWjs8kKbJWmuuc");
Response
{
"id": "prod_NWjs8kKbJWmuuc",
"object": "product",
"active": true,
"created": 1678833149,
"default_price": null,
"description": null,
"images": [],
"marketing_features": [],
"livemode": false,
"metadata": {},
"name": "Gold Plan",
"package_dimensions": null,
"shippable": null,
"statement_descriptor": null,
"tax_code": null,
"unit_label": null,
"updated": 1678833149,
"url": null
}

List all products 

Returns a list of your products. The products are returned sorted by creation date, with the most recently created products appearing first.

Parameters

  • activeboolean

    Only return products that are active or inactive (e.g., pass false to list all inactive products).

More parameters

  • createdMap

  • ending_beforestring

  • idsarray of strings

  • limitinteger

  • shippableboolean

  • starting_afterstring

  • urlstring

Returns

A Map with a data property that contains an array of up to limit products, starting after product starting_after. Each entry in the array is a separate product object. If no more products are available, the resulting array will be empty.

GET /v1/products
Stripe.apiKey = "sk_test_BQokikJ...2HlWgH4olfQ2sk_test_BQokikJOvBiI2HlWgH4olfQ2";
ProductListParams params = ProductListParams.builder().setLimit(3L).build();
ProductCollection products = Product.list(params);
Response
{
"object": "list",
"url": "/v1/products",
"has_more": false,
"data": [
{
"id": "prod_NWjs8kKbJWmuuc",
"object": "product",
"active": true,
"created": 1678833149,
"default_price": null,
"description": null,
"images": [],
"marketing_features": [],
"livemode": false,
"metadata": {},
"name": "Gold Plan",
"package_dimensions": null,
"shippable": null,
"statement_descriptor": null,
"tax_code": null,
"unit_label": null,
"updated": 1678833149,
"url": null
}
]
}

Delete a product 

Delete a product. Deleting a product is only possible if it has no prices associated with it. Additionally, deleting a product with type=good is only possible if it has no SKUs associated with it.

Parameters

No parameters.

Returns

Returns a deleted object on success. Otherwise, this call throws an error.

DELETE /v1/products/:id
Stripe.apiKey = "sk_test_BQokikJ...2HlWgH4olfQ2sk_test_BQokikJOvBiI2HlWgH4olfQ2";
Product resource = Product.retrieve("prod_NWjs8kKbJWmuuc");
Product product = resource.delete();
Response
{
"id": "prod_NWjs8kKbJWmuuc",
"object": "product",
"deleted": true
}