• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

stripe / stripe-php / 6471862601

10 Oct 2023 04:02PM UTC coverage: 69.665% (-0.5%) from 70.141%
6471862601

push

github

web-flow
Merge pull request #1570 from localheinz/feature/coveralls

Enhancement: Use `coverallsapp/github-action` to report code coverage

2393 of 3435 relevant lines covered (69.67%)

3.5 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

83.33
/lib/Service/ProductService.php
1
<?php
2

3
// File generated from our OpenAPI spec
4

5
namespace Stripe\Service;
6

7
class ProductService extends \Stripe\Service\AbstractService
8
{
9
    /**
10
     * Returns a list of your products. The products are returned sorted by creation
11
     * date, with the most recently created products appearing first.
12
     *
13
     * @param null|array $params
14
     * @param null|array|\Stripe\Util\RequestOptions $opts
15
     *
16
     * @throws \Stripe\Exception\ApiErrorException if the request fails
17
     *
18
     * @return \Stripe\Collection<\Stripe\Product>
19
     */
20
    public function all($params = null, $opts = null)
1✔
21
    {
22
        return $this->requestCollection('get', '/v1/products', $params, $opts);
1✔
23
    }
24

25
    /**
26
     * Creates a new product object.
27
     *
28
     * @param null|array $params
29
     * @param null|array|\Stripe\Util\RequestOptions $opts
30
     *
31
     * @throws \Stripe\Exception\ApiErrorException if the request fails
32
     *
33
     * @return \Stripe\Product
34
     */
35
    public function create($params = null, $opts = null)
1✔
36
    {
37
        return $this->request('post', '/v1/products', $params, $opts);
1✔
38
    }
39

40
    /**
41
     * Delete a product. Deleting a product is only possible if it has no prices
42
     * associated with it. Additionally, deleting a product with <code>type=good</code>
43
     * is only possible if it has no SKUs associated with it.
44
     *
45
     * @param string $id
46
     * @param null|array $params
47
     * @param null|array|\Stripe\Util\RequestOptions $opts
48
     *
49
     * @throws \Stripe\Exception\ApiErrorException if the request fails
50
     *
51
     * @return \Stripe\Product
52
     */
53
    public function delete($id, $params = null, $opts = null)
1✔
54
    {
55
        return $this->request('delete', $this->buildPath('/v1/products/%s', $id), $params, $opts);
1✔
56
    }
57

58
    /**
59
     * Retrieves the details of an existing product. Supply the unique product ID from
60
     * either a product creation request or the product list, and Stripe will return
61
     * the corresponding product information.
62
     *
63
     * @param string $id
64
     * @param null|array $params
65
     * @param null|array|\Stripe\Util\RequestOptions $opts
66
     *
67
     * @throws \Stripe\Exception\ApiErrorException if the request fails
68
     *
69
     * @return \Stripe\Product
70
     */
71
    public function retrieve($id, $params = null, $opts = null)
1✔
72
    {
73
        return $this->request('get', $this->buildPath('/v1/products/%s', $id), $params, $opts);
1✔
74
    }
75

76
    /**
77
     * Search for products you’ve previously created using Stripe’s <a
78
     * href="/docs/search#search-query-language">Search Query Language</a>. Don’t use
79
     * search in read-after-write flows where strict consistency is necessary. Under
80
     * normal operating conditions, data is searchable in less than a minute.
81
     * Occasionally, propagation of new or updated data can be up to an hour behind
82
     * during outages. Search functionality is not available to merchants in India.
83
     *
84
     * @param null|array $params
85
     * @param null|array|\Stripe\Util\RequestOptions $opts
86
     *
87
     * @throws \Stripe\Exception\ApiErrorException if the request fails
88
     *
89
     * @return \Stripe\SearchResult<\Stripe\Product>
90
     */
91
    public function search($params = null, $opts = null)
×
92
    {
93
        return $this->requestSearchResult('get', '/v1/products/search', $params, $opts);
×
94
    }
95

96
    /**
97
     * Updates the specific product by setting the values of the parameters passed. Any
98
     * parameters not provided will be left unchanged.
99
     *
100
     * @param string $id
101
     * @param null|array $params
102
     * @param null|array|\Stripe\Util\RequestOptions $opts
103
     *
104
     * @throws \Stripe\Exception\ApiErrorException if the request fails
105
     *
106
     * @return \Stripe\Product
107
     */
108
    public function update($id, $params = null, $opts = null)
1✔
109
    {
110
        return $this->request('post', $this->buildPath('/v1/products/%s', $id), $params, $opts);
1✔
111
    }
112
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc