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 #1261

Merged
merged 1 commit into from
Apr 8, 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
2 changes: 1 addition & 1 deletion lib/Checkout/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
* @property string $success_url The URL the customer will be directed to after the payment or subscription creation is successful.
* @property \Stripe\StripeObject $tax_id_collection
* @property null|\Stripe\StripeObject $total_details Tax and discount details for the computed total amount.
* @property null|string $url The URL to the Checkout Session.
* @property null|string $url The URL to the Checkout Session. Redirect customers to this URL to take them to Checkout. If you’re using <a href="https://stripe.com/docs/payments/checkout/custom-domains">Custom Domains</a>, the URL will use your subdomain. Otherwise, it’ll use <code>checkout.stripe.com.</code>
*/
class Session extends \Stripe\ApiResource
{
Expand Down
1 change: 1 addition & 0 deletions lib/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ class Event extends ApiResource
const BILLING_PORTAL_CONFIGURATION_CREATED = 'billing_portal.configuration.created';
const BILLING_PORTAL_CONFIGURATION_UPDATED = 'billing_portal.configuration.updated';
const CAPABILITY_UPDATED = 'capability.updated';
const CASH_BALANCE_FUNDS_AVAILABLE = 'cash_balance.funds_available';
const CHARGE_CAPTURED = 'charge.captured';
const CHARGE_EXPIRED = 'charge.expired';
const CHARGE_FAILED = 'charge.failed';
Expand Down
17 changes: 17 additions & 0 deletions lib/PaymentIntent.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,23 @@ class PaymentIntent extends ApiResource
const STATUS_REQUIRES_PAYMENT_METHOD = 'requires_payment_method';
const STATUS_SUCCEEDED = 'succeeded';

/**
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\PaymentIntent the applied payment intent
*/
public function applyCustomerBalance($params = null, $opts = null)
{
$url = $this->instanceUrl() . '/apply_customer_balance';
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
20 changes: 20 additions & 0 deletions lib/Service/PaymentIntentService.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,26 @@ public function all($params = null, $opts = null)
return $this->requestCollection('get', '/v1/payment_intents', $params, $opts);
}

/**
* Manually reconcile the remaining amount for a customer_balance PaymentIntent.
*
* This can be used when the cash balance for <a
* href="docs/payments/customer-balance/reconciliation#cash-manual-reconciliation">a
* customer in manual reconciliation mode</a> received funds.
*
* @param string $id
* @param null|array $params
* @param null|array|\Stripe\Util\RequestOptions $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\PaymentIntent
*/
public function applyCustomerBalance($id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/payment_intents/%s/apply_customer_balance', $id), $params, $opts);
}

/**
* A PaymentIntent object can be canceled when it is in one of these statuses:
* <code>requires_payment_method</code>, <code>requires_capture</code>,
Expand Down
2 changes: 1 addition & 1 deletion lib/Service/Terminal/ReaderService.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public function retrieve($id, $params = null, $opts = null)
}

/**
* Sets reader display.
* Sets reader display to show cart details.
*
* @param string $id
* @param null|array $params
Expand Down