Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API Updates for beta branch #1349

Merged
merged 9 commits into from
Aug 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## 9.1.0 - 2022-08-11
* [#1348](https://github.com/stripe/stripe-php/pull/1348) API Updates
* Add support for `payment_method_collection` on `Checkout.Session` and `PaymentLink`

* [#1346](https://github.com/stripe/stripe-php/pull/1346) API Updates
* Add support for `expires_at` on `Apps.Secret`

## 9.1.0-beta.1 - 2022-08-03
* [#1345](https://github.com/stripe/stripe-php/pull/1345) API Updates for beta branch
- Updated stable APIs to the latest version
Expand Down
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v175
v178
1 change: 1 addition & 0 deletions lib/Apps/Secret.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
* @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.
* @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
* @property null|int $expires_at The Unix timestamp for the expiry time of the secret, after which the secret deletes.
* @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
* @property string $name A name for the secret that's unique within the scope.
* @property null|string $payload The plaintext secret value to be stored.
Expand Down
4 changes: 4 additions & 0 deletions lib/Checkout/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
* @property string $mode The mode of the Checkout Session.
* @property null|string|\Stripe\PaymentIntent $payment_intent The ID of the PaymentIntent for Checkout Sessions in <code>payment</code> mode.
* @property null|string|\Stripe\PaymentLink $payment_link The ID of the Payment Link that created this Session.
* @property null|string $payment_method_collection Configure whether a Checkout Session should collect a payment method.
* @property null|\Stripe\StripeObject $payment_method_options Payment-method-specific configuration for the PaymentIntent or SetupIntent of this CheckoutSession.
* @property string[] $payment_method_types A list of the types of payment methods (e.g. card) this Checkout Session is allowed to accept.
* @property string $payment_status The payment status of the Checkout Session, one of <code>paid</code>, <code>unpaid</code>, or <code>no_payment_required</code>. You can use this value to decide when to fulfill your customer's order.
Expand Down Expand Up @@ -84,6 +85,9 @@ class Session extends \Stripe\ApiResource
const MODE_SETUP = 'setup';
const MODE_SUBSCRIPTION = 'subscription';

const PAYMENT_METHOD_COLLECTION_ALWAYS = 'always';
const PAYMENT_METHOD_COLLECTION_IF_REQUIRED = 'if_required';

const PAYMENT_STATUS_NO_PAYMENT_REQUIRED = 'no_payment_required';
const PAYMENT_STATUS_PAID = 'paid';
const PAYMENT_STATUS_UNPAID = 'unpaid';
Expand Down
4 changes: 4 additions & 0 deletions lib/PaymentLink.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
* @property \Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
* @property null|string|\Stripe\Account $on_behalf_of The account on behalf of which to charge. See the <a href="https://support.stripe.com/questions/sending-invoices-on-behalf-of-connected-accounts">Connect documentation</a> for details.
* @property null|\Stripe\StripeObject $payment_intent_data Indicates the parameters to be passed to PaymentIntent creation during checkout.
* @property string $payment_method_collection Configuration for collecting a payment method during checkout.
* @property null|string[] $payment_method_types The list of payment method types that customers can use. When <code>null</code>, Stripe will dynamically show relevant payment methods you've enabled in your <a href="https://dashboard.stripe.com/settings/payment_methods">payment method settings</a>.
* @property \Stripe\StripeObject $phone_number_collection
* @property null|\Stripe\StripeObject $shipping_address_collection Configuration for collecting the customer's shipping address.
Expand All @@ -58,6 +59,9 @@ class PaymentLink extends ApiResource
const CUSTOMER_CREATION_ALWAYS = 'always';
const CUSTOMER_CREATION_IF_REQUIRED = 'if_required';

const PAYMENT_METHOD_COLLECTION_ALWAYS = 'always';
const PAYMENT_METHOD_COLLECTION_IF_REQUIRED = 'if_required';

const SUBMIT_TYPE_AUTO = 'auto';
const SUBMIT_TYPE_BOOK = 'book';
const SUBMIT_TYPE_DONATE = 'donate';
Expand Down
16 changes: 16 additions & 0 deletions lib/Service/Terminal/ReaderService.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,22 @@ public function processSetupIntent($id, $params = null, $opts = null)
return $this->request('post', $this->buildPath('/v1/terminal/readers/%s/process_setup_intent', $id), $params, $opts);
}

/**
* Initiates a refund on a Reader.
*
* @param string $id
* @param null|array $params
* @param null|array|\Stripe\Util\RequestOptions $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Terminal\Reader
*/
public function refundPayment($id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/terminal/readers/%s/refund_payment', $id), $params, $opts);
}

/**
* Retrieves a <code>Reader</code> object.
*
Expand Down
2 changes: 1 addition & 1 deletion lib/SubscriptionItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* @property int $quantity The <a href="https://stripe.com/docs/subscriptions/quantities">quantity</a> of the plan to which the customer should be subscribed.
* @property string $subscription The <code>subscription</code> this <code>subscription_item</code> belongs to.
* @property null|\Stripe\TaxRate[] $tax_rates The tax rates which apply to this <code>subscription_item</code>. When set, the <code>default_tax_rates</code> on the subscription do not apply to this <code>subscription_item</code>.
* @property null|\Stripe\StripeObject $trial Current trial configuration on this item.
* @property null|\Stripe\StripeObject $trial Options that configure the trial on the subscription item.
*/
class SubscriptionItem extends ApiResource
{
Expand Down
17 changes: 17 additions & 0 deletions lib/Terminal/Reader.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,23 @@ public function processSetupIntent($params = null, $opts = null)
return $this;
}

/**
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Terminal\Reader the refunded reader
*/
public function refundPayment($params = null, $opts = null)
{
$url = $this->instanceUrl() . '/refund_payment';
list($response, $opts) = $this->_request('post', $url, $params, $opts);
$this->refreshFrom($response, $opts);

return $this;
}

/**
* @param null|array $params
* @param null|array|string $opts
Expand Down
2 changes: 1 addition & 1 deletion lib/Util/ApiVersion.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@

class ApiVersion
{
const CURRENT = '2022-08-01; server_side_confirmation_beta=v1; orders_beta=v4';
const CURRENT = '2022-08-01; server_side_confirmation_beta=v1; orders_beta=v4; terminal_interac_refunds_beta=v1';
}