diff --git a/.travis.yml b/.travis.yml
index 212ba663d2..ee591f100f 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -37,7 +37,7 @@ matrix:
env:
global:
- - STRIPE_MOCK_VERSION=0.89.0
+ - STRIPE_MOCK_VERSION=0.90.0
cache:
directories:
- $HOME/.composer/cache/files
diff --git a/init.php b/init.php
index ea352f37a9..b61c4205d1 100644
--- a/init.php
+++ b/init.php
@@ -102,6 +102,7 @@
require __DIR__ . '/lib/Issuing/Cardholder.php';
require __DIR__ . '/lib/Issuing/Dispute.php';
require __DIR__ . '/lib/Issuing/Transaction.php';
+require __DIR__ . '/lib/LineItem.php';
require __DIR__ . '/lib/LoginLink.php';
require __DIR__ . '/lib/Mandate.php';
require __DIR__ . '/lib/Order.php';
diff --git a/lib/BillingPortal/Session.php b/lib/BillingPortal/Session.php
index 2f0ab540f1..78d8ab64db 100644
--- a/lib/BillingPortal/Session.php
+++ b/lib/BillingPortal/Session.php
@@ -5,13 +5,13 @@
/**
* A Session describes the instantiation of the self-serve portal for a particular
* customer. By visiting the self-serve portal's URL, the customer can manage their
- * subscriptions and view their invoice payment history. For security reasons,
- * Sessions are short-lived and will expire if the customer does not visit the URL.
- * Create Sessions on-demand.
+ * subscriptions and billing details. For security reasons, Sessions are
+ * short-lived and will expire if the customer does not visit the URL. Create
+ * Sessions on-demand.
*
- * Related guide: self-serve
- * Portal.
+ * Integration guide: Billing
+ * self-serve portal.
*
* @property string $id Unique identifier for the object.
* @property string $object String representing the object's type. Objects of the same type share the same value.
diff --git a/lib/Checkout/Session.php b/lib/Checkout/Session.php
index af5f1b5651..afcac55041 100644
--- a/lib/Checkout/Session.php
+++ b/lib/Checkout/Session.php
@@ -28,6 +28,7 @@
* @property null|string|\Stripe\Customer $customer The ID of the customer for this session. For Checkout Sessions in payment
or subscription
mode, Checkout will create a new customer object based on information provided during the session unless an existing customer was provided when the session was created.
* @property null|string $customer_email If provided, this value will be used when the Customer object is created. If not provided, customers will be asked to enter their email address. Use this parameter to prefill customer data if you already have an email on file. To access information about the customer once a session is complete, use the customer
field.
* @property \Stripe\StripeObject[] $display_items The line items, plans, or SKUs purchased by the customer.
+ * @property null|\Stripe\Collection $line_items The line items purchased by the customer. Expand this field to include it in the response.
* @property bool $livemode Has the value true
if the object exists in live mode or the value false
if the object exists in test mode.
* @property null|string $locale The IETF language tag of the locale Checkout is displayed in. If blank or auto
, the browser's locale is used.
* @property null|\Stripe\StripeObject $metadata 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.
@@ -47,10 +48,27 @@ class Session extends \Stripe\ApiResource
use \Stripe\ApiOperations\All;
use \Stripe\ApiOperations\Create;
+ use \Stripe\ApiOperations\NestedResource;
use \Stripe\ApiOperations\Retrieve;
const SUBMIT_TYPE_AUTO = 'auto';
const SUBMIT_TYPE_BOOK = 'book';
const SUBMIT_TYPE_DONATE = 'donate';
const SUBMIT_TYPE_PAY = 'pay';
+
+ const PATH_LINE_ITEMS = '/line_items';
+
+ /**
+ * @param string $id the ID of the session on which to retrieve the items
+ * @param null|array $params
+ * @param null|array|string $opts
+ *
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
+ *
+ * @return \Stripe\Collection the list of items
+ */
+ public static function allLineItems($id, $params = null, $opts = null)
+ {
+ return self::_allNestedResources($id, static::PATH_LINE_ITEMS, $params, $opts);
+ }
}
diff --git a/lib/Customer.php b/lib/Customer.php
index 4407860326..2355e623ee 100644
--- a/lib/Customer.php
+++ b/lib/Customer.php
@@ -8,8 +8,9 @@
* allows you to create, delete, and update your customers. You can retrieve
* individual customers as well as a list of all your customers.
*
- * Related guide: Saving Cards with
- * Customers.
+ * Related guide: Save a card during
+ * payment.
*
* @property string $id Unique identifier for the object.
* @property string $object String representing the object's type. Objects of the same type share the same value.
diff --git a/lib/LineItem.php b/lib/LineItem.php
new file mode 100644
index 0000000000..c4f57fa810
--- /dev/null
+++ b/lib/LineItem.php
@@ -0,0 +1,23 @@
+ISO currency code, in lowercase. Must be a supported currency.
+ * @property string $description An arbitrary string attached to the object. Often useful for displaying to users. Defaults to product name.
+ * @property \Stripe\Price $price
Prices define the unit cost, currency, and (optional) billing cycle for both recurring and one-time purchases of products. Products help you track inventory or provisioning, and prices help you track payment terms. Different physical goods or levels of service should be represented by products, and pricing options should be represented by prices. This approach lets you change prices without having to change your provisioning scheme.
For example, you might have a single "gold" product that has prices for $10/month, $100/year, and €9 once.
Related guides: Set up a subscription, create an invoice, and more about products and prices.
+ * @property null|int $quantity The quantity of products being purchased. + * @property null|\Stripe\StripeObject[] $taxes The taxes applied to the line item. + */ +class LineItem extends ApiResource +{ + const OBJECT_NAME = 'item'; + + use ApiOperations\All; +} diff --git a/lib/Plan.php b/lib/Plan.php index 161a10da36..f82dfee584 100644 --- a/lib/Plan.php +++ b/lib/Plan.php @@ -23,8 +23,8 @@ * @property string $object String representing the object's type. Objects of the same type share the same value. * @property bool $active Whether the plan can be used for new purchases. * @property null|string $aggregate_usage Specifies a usage aggregation strategy for plans ofusage_type=metered
. Allowed values are sum
for summing up all usage during a period, last_during_period
for using the last usage record reported within a period, last_ever
for using the last usage record ever (across period bounds) or max
which uses the usage record with the maximum reported usage during a period. Defaults to sum
.
- * @property null|int $amount The amount in %s to be charged on the interval specified.
- * @property null|string $amount_decimal Same as amount
, but contains a decimal value with at most 12 decimal places.
+ * @property null|int $amount The unit amount in %s to be charged, represented as a whole integer if possible.
+ * @property null|string $amount_decimal The unit amount in %s to be charged, represented as a decimal string with at most 12 decimal places.
* @property string $billing_scheme Describes how to compute the price per period. Either per_unit
or tiered
. per_unit
indicates that the fixed amount (specified in amount
) will be charged per unit in quantity
(for plans with usage_type=licensed
), or per unit of total usage (for plans with usage_type=metered
). tiered
indicates that the unit pricing will be computed using a tiering strategy as defined using the tiers
and tiers_mode
attributes.
* @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
* @property string $currency Three-letter ISO currency code, in lowercase. Must be a supported currency.
diff --git a/lib/Price.php b/lib/Price.php
index 5b15b147ff..29190a11b3 100644
--- a/lib/Price.php
+++ b/lib/Price.php
@@ -36,8 +36,8 @@
* @property null|string $tiers_mode Defines if the tiering price should be graduated
or volume
based. In volume
-based tiering, the maximum quantity within a period determines the per unit price. In graduated
tiering, pricing can change as the quantity grows.
* @property null|\Stripe\StripeObject $transform_quantity Apply a transformation to the reported usage or set quantity before computing the amount billed. Cannot be combined with tiers
.
* @property string $type One of one_time
or recurring
depending on whether the price is for a one-time purchase or a recurring (subscription) purchase.
- * @property null|int $unit_amount The unit amount in %s to be charged.
- * @property null|string $unit_amount_decimal Same as amount
, but contains a decimal value with at most 12 decimal places.
+ * @property null|int $unit_amount The unit amount in %s to be charged, represented as a whole integer if possible.
+ * @property null|string $unit_amount_decimal The unit amount in %s to be charged, represented as a decimal string with at most 12 decimal places.
*/
class Price extends ApiResource
{
diff --git a/lib/Product.php b/lib/Product.php
index 6fa7f79585..1fd07f9cbd 100644
--- a/lib/Product.php
+++ b/lib/Product.php
@@ -6,7 +6,7 @@
* Products describe the specific goods or services you offer to your customers.
* For example, you might offer a Standard and Premium version of your goods or
* service; each version would be a separate Product. They can be used in
- * conjuction with SKUs and SKUs and Plans to configure pricing in
* Checkout and Subscriptions.
*
diff --git a/lib/Util/ObjectTypes.php b/lib/Util/ObjectTypes.php
index f83e1a39a3..09796934c0 100644
--- a/lib/Util/ObjectTypes.php
+++ b/lib/Util/ObjectTypes.php
@@ -48,6 +48,7 @@ class ObjectTypes
\Stripe\Issuing\Cardholder::OBJECT_NAME => \Stripe\Issuing\Cardholder::class,
\Stripe\Issuing\Dispute::OBJECT_NAME => \Stripe\Issuing\Dispute::class,
\Stripe\Issuing\Transaction::OBJECT_NAME => \Stripe\Issuing\Transaction::class,
+ \Stripe\LineItem::OBJECT_NAME => \Stripe\LineItem::class,
\Stripe\LoginLink::OBJECT_NAME => \Stripe\LoginLink::class,
\Stripe\Mandate::OBJECT_NAME => \Stripe\Mandate::class,
\Stripe\Order::OBJECT_NAME => \Stripe\Order::class,
diff --git a/tests/Stripe/Checkout/SessionTest.php b/tests/Stripe/Checkout/SessionTest.php
index 61257fa05d..5c41696fce 100644
--- a/tests/Stripe/Checkout/SessionTest.php
+++ b/tests/Stripe/Checkout/SessionTest.php
@@ -51,4 +51,15 @@ public function testIsRetrievable()
$resource = Session::retrieve(self::TEST_RESOURCE_ID);
static::assertInstanceOf(\Stripe\Checkout\Session::class, $resource);
}
+
+ public function testCanListLineItems()
+ {
+ $this->expectsRequest(
+ 'get',
+ '/v1/checkout/sessions/' . self::TEST_RESOURCE_ID . '/line_items'
+ );
+ $resources = Session::allLineItems(self::TEST_RESOURCE_ID);
+ static::assertInternalType('array', $resources->data);
+ static::assertInstanceOf(\Stripe\LineItem::class, $resources->data[0]);
+ }
}
diff --git a/tests/bootstrap.php b/tests/bootstrap.php
index ad7cc1e505..034bac1972 100644
--- a/tests/bootstrap.php
+++ b/tests/bootstrap.php
@@ -2,7 +2,7 @@
require_once __DIR__ . '/StripeMock.php';
-\define('MOCK_MINIMUM_VERSION', '0.89.0');
+\define('MOCK_MINIMUM_VERSION', '0.90.0');
if (\Stripe\StripeMock::start()) {
\register_shutdown_function('\Stripe\StripeMock::stop');