πŸ‘œProducts & Prices

Overview

In order to use direct subscriptions which are against connected accounts. Your connected account must first have a product and price against it. This may be a fixed product that you create for the connected account, or it may be one you allow them to create themselves (via an endpoint).

Either way, they need a product and price and the below functions allow you to create those against any Stripe Connectable Model.

Note: The Stripe Connectable Model must have been created in stripe before products and prices are added against it. For more information see Connected Accounts.

For this example we will use a store model, and the product will be a monthly warranty support product.

Products

Create a product

Any product data can be included in this function as outlined in the Stripe API Documentation.

Link to stripe product create docs

$store->createConnectedProduct([
    'name' => 'Product Warranty Support'
]);

Editing a product

$store->editConnectedProduct($id, [
    'name' => 'New Product Name'
]);

Getting Products

Single Product

$store->getSingleConnectedProduct($id);

All products for connected account

$store->getAllProductsForAccount();

Prices

Create a price

A product must first exist to create a price against it. Any pricing data can be provided to this function as per the Stripe API Documentation

Link to stripe price create docs

$store->createPriceForConnectedProduct($productID, [
    'unit_amount' => 2000,
    'currency' => 'gbp',
    'recurring' => ['interval' => 'month']
]);

Editing a price

$store->editConnectedPrice($id, [
    'unit_amount' => 4000,
]);

Getting prices

Single Price

$store->getSingleConnectedPrice($priceID);

Get all prices for a product

$store->getPricesForConnectedProduct($productID);

Last updated