BillingPortal
2 years ago
Checkout
2 years ago
FinancialConnections
2 years ago
Identity
2 years ago
Issuing
2 years ago
Radar
2 years ago
Reporting
2 years ago
Sigma
2 years ago
Terminal
2 years ago
TestHelpers
2 years ago
AbstractService.php
2 years ago
AbstractServiceFactory.php
4 years ago
AccountLinkService.php
4 years ago
AccountService.php
2 years ago
ApplePayDomainService.php
2 years ago
ApplicationFeeService.php
2 years ago
BalanceService.php
4 years ago
BalanceTransactionService.php
2 years ago
ChargeService.php
2 years ago
CoreServiceFactory.php
2 years ago
CountrySpecService.php
2 years ago
CouponService.php
2 years ago
CreditNoteService.php
2 years ago
CustomerService.php
2 years ago
DisputeService.php
2 years ago
EphemeralKeyService.php
4 years ago
EventService.php
2 years ago
ExchangeRateService.php
2 years ago
FileLinkService.php
2 years ago
FileService.php
2 years ago
InvoiceItemService.php
2 years ago
InvoiceService.php
2 years ago
MandateService.php
4 years ago
OAuthService.php
4 years ago
OrderReturnService.php
2 years ago
OrderService.php
2 years ago
PaymentIntentService.php
2 years ago
PaymentLinkService.php
2 years ago
PaymentMethodService.php
2 years ago
PayoutService.php
2 years ago
PlanService.php
2 years ago
PriceService.php
2 years ago
ProductService.php
2 years ago
PromotionCodeService.php
2 years ago
QuoteService.php
2 years ago
RefundService.php
2 years ago
ReviewService.php
2 years ago
SetupAttemptService.php
2 years ago
SetupIntentService.php
2 years ago
ShippingRateService.php
2 years ago
SkuService.php
2 years ago
SourceService.php
4 years ago
SubscriptionItemService.php
2 years ago
SubscriptionScheduleService.php
2 years ago
SubscriptionService.php
2 years ago
TaxCodeService.php
2 years ago
TaxRateService.php
2 years ago
TokenService.php
4 years ago
TopupService.php
2 years ago
TransferService.php
2 years ago
WebhookEndpointService.php
2 years ago
PaymentIntentService.php
284 lines
| 1 | <?php |
| 2 | |
| 3 | // File generated from our OpenAPI spec |
| 4 | |
| 5 | namespace Stripe\Service; |
| 6 | |
| 7 | class PaymentIntentService extends \Stripe\Service\AbstractService |
| 8 | { |
| 9 | /** |
| 10 | * Returns a list of PaymentIntents. |
| 11 | * |
| 12 | * @param null|array $params |
| 13 | * @param null|array|\Stripe\Util\RequestOptions $opts |
| 14 | * |
| 15 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 16 | * |
| 17 | * @return \Stripe\Collection<\Stripe\PaymentIntent> |
| 18 | */ |
| 19 | public function all($params = null, $opts = null) |
| 20 | { |
| 21 | return $this->requestCollection('get', '/v1/payment_intents', $params, $opts); |
| 22 | } |
| 23 | |
| 24 | /** |
| 25 | * Manually reconcile the remaining amount for a customer_balance PaymentIntent. |
| 26 | * |
| 27 | * This can be used when the cash balance for <a |
| 28 | * href="docs/payments/customer-balance/reconciliation#cash-manual-reconciliation">a |
| 29 | * customer in manual reconciliation mode</a> received funds. |
| 30 | * |
| 31 | * @param string $id |
| 32 | * @param null|array $params |
| 33 | * @param null|array|\Stripe\Util\RequestOptions $opts |
| 34 | * |
| 35 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 36 | * |
| 37 | * @return \Stripe\PaymentIntent |
| 38 | */ |
| 39 | public function applyCustomerBalance($id, $params = null, $opts = null) |
| 40 | { |
| 41 | return $this->request('post', $this->buildPath('/v1/payment_intents/%s/apply_customer_balance', $id), $params, $opts); |
| 42 | } |
| 43 | |
| 44 | /** |
| 45 | * A PaymentIntent object can be canceled when it is in one of these statuses: |
| 46 | * <code>requires_payment_method</code>, <code>requires_capture</code>, |
| 47 | * <code>requires_confirmation</code>, <code>requires_action</code>, or |
| 48 | * <code>processing</code>. |
| 49 | * |
| 50 | * Once canceled, no additional charges will be made by the PaymentIntent and any |
| 51 | * operations on the PaymentIntent will fail with an error. For PaymentIntents with |
| 52 | * <code>status=’requires_capture’</code>, the remaining |
| 53 | * <code>amount_capturable</code> will automatically be refunded. |
| 54 | * |
| 55 | * You cannot cancel the PaymentIntent for a Checkout Session. <a |
| 56 | * href="/docs/api/checkout/sessions/expire">Expire the Checkout Session</a> |
| 57 | * instead |
| 58 | * |
| 59 | * @param string $id |
| 60 | * @param null|array $params |
| 61 | * @param null|array|\Stripe\Util\RequestOptions $opts |
| 62 | * |
| 63 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 64 | * |
| 65 | * @return \Stripe\PaymentIntent |
| 66 | */ |
| 67 | public function cancel($id, $params = null, $opts = null) |
| 68 | { |
| 69 | return $this->request('post', $this->buildPath('/v1/payment_intents/%s/cancel', $id), $params, $opts); |
| 70 | } |
| 71 | |
| 72 | /** |
| 73 | * Capture the funds of an existing uncaptured PaymentIntent when its status is |
| 74 | * <code>requires_capture</code>. |
| 75 | * |
| 76 | * Uncaptured PaymentIntents will be canceled a set number of days after they are |
| 77 | * created (7 by default). |
| 78 | * |
| 79 | * Learn more about <a href="/docs/payments/capture-later">separate authorization |
| 80 | * and capture</a>. |
| 81 | * |
| 82 | * @param string $id |
| 83 | * @param null|array $params |
| 84 | * @param null|array|\Stripe\Util\RequestOptions $opts |
| 85 | * |
| 86 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 87 | * |
| 88 | * @return \Stripe\PaymentIntent |
| 89 | */ |
| 90 | public function capture($id, $params = null, $opts = null) |
| 91 | { |
| 92 | return $this->request('post', $this->buildPath('/v1/payment_intents/%s/capture', $id), $params, $opts); |
| 93 | } |
| 94 | |
| 95 | /** |
| 96 | * Confirm that your customer intends to pay with current or provided payment |
| 97 | * method. Upon confirmation, the PaymentIntent will attempt to initiate a payment. |
| 98 | * |
| 99 | * If the selected payment method requires additional authentication steps, the |
| 100 | * PaymentIntent will transition to the <code>requires_action</code> status and |
| 101 | * suggest additional actions via <code>next_action</code>. If payment fails, the |
| 102 | * PaymentIntent will transition to the <code>requires_payment_method</code> |
| 103 | * status. If payment succeeds, the PaymentIntent will transition to the |
| 104 | * <code>succeeded</code> status (or <code>requires_capture</code>, if |
| 105 | * <code>capture_method</code> is set to <code>manual</code>). |
| 106 | * |
| 107 | * If the <code>confirmation_method</code> is <code>automatic</code>, payment may |
| 108 | * be attempted using our <a |
| 109 | * href="/docs/stripe-js/reference#stripe-handle-card-payment">client SDKs</a> and |
| 110 | * the PaymentIntent’s <a |
| 111 | * href="#payment_intent_object-client_secret">client_secret</a>. After |
| 112 | * <code>next_action</code>s are handled by the client, no additional confirmation |
| 113 | * is required to complete the payment. |
| 114 | * |
| 115 | * If the <code>confirmation_method</code> is <code>manual</code>, all payment |
| 116 | * attempts must be initiated using a secret key. If any actions are required for |
| 117 | * the payment, the PaymentIntent will return to the |
| 118 | * <code>requires_confirmation</code> state after those actions are completed. Your |
| 119 | * server needs to then explicitly re-confirm the PaymentIntent to initiate the |
| 120 | * next payment attempt. Read the <a |
| 121 | * href="/docs/payments/payment-intents/web-manual">expanded documentation</a> to |
| 122 | * learn more about manual confirmation. |
| 123 | * |
| 124 | * @param string $id |
| 125 | * @param null|array $params |
| 126 | * @param null|array|\Stripe\Util\RequestOptions $opts |
| 127 | * |
| 128 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 129 | * |
| 130 | * @return \Stripe\PaymentIntent |
| 131 | */ |
| 132 | public function confirm($id, $params = null, $opts = null) |
| 133 | { |
| 134 | return $this->request('post', $this->buildPath('/v1/payment_intents/%s/confirm', $id), $params, $opts); |
| 135 | } |
| 136 | |
| 137 | /** |
| 138 | * Creates a PaymentIntent object. |
| 139 | * |
| 140 | * After the PaymentIntent is created, attach a payment method and <a |
| 141 | * href="/docs/api/payment_intents/confirm">confirm</a> to continue the payment. |
| 142 | * You can read more about the different payment flows available via the Payment |
| 143 | * Intents API <a href="/docs/payments/payment-intents">here</a>. |
| 144 | * |
| 145 | * When <code>confirm=true</code> is used during creation, it is equivalent to |
| 146 | * creating and confirming the PaymentIntent in the same call. You may use any |
| 147 | * parameters available in the <a href="/docs/api/payment_intents/confirm">confirm |
| 148 | * API</a> when <code>confirm=true</code> is supplied. |
| 149 | * |
| 150 | * @param null|array $params |
| 151 | * @param null|array|\Stripe\Util\RequestOptions $opts |
| 152 | * |
| 153 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 154 | * |
| 155 | * @return \Stripe\PaymentIntent |
| 156 | */ |
| 157 | public function create($params = null, $opts = null) |
| 158 | { |
| 159 | return $this->request('post', '/v1/payment_intents', $params, $opts); |
| 160 | } |
| 161 | |
| 162 | /** |
| 163 | * Perform an incremental authorization on an eligible <a |
| 164 | * href="/docs/api/payment_intents/object">PaymentIntent</a>. To be eligible, the |
| 165 | * PaymentIntent’s status must be <code>requires_capture</code> and <a |
| 166 | * href="/docs/api/charges/object#charge_object-payment_method_details-card_present-incremental_authorization_supported">incremental_authorization_supported</a> |
| 167 | * must be <code>true</code>. |
| 168 | * |
| 169 | * Incremental authorizations attempt to increase the authorized amount on your |
| 170 | * customer’s card to the new, higher <code>amount</code> provided. As with the |
| 171 | * initial authorization, incremental authorizations may be declined. A single |
| 172 | * PaymentIntent can call this endpoint multiple times to further increase the |
| 173 | * authorized amount. |
| 174 | * |
| 175 | * If the incremental authorization succeeds, the PaymentIntent object is returned |
| 176 | * with the updated <a |
| 177 | * href="/docs/api/payment_intents/object#payment_intent_object-amount">amount</a>. |
| 178 | * If the incremental authorization fails, a <a |
| 179 | * href="/docs/error-codes#card-declined">card_declined</a> error is returned, and |
| 180 | * no fields on the PaymentIntent or Charge are updated. The PaymentIntent object |
| 181 | * remains capturable for the previously authorized amount. |
| 182 | * |
| 183 | * Each PaymentIntent can have a maximum of 10 incremental authorization attempts, |
| 184 | * including declines. Once captured, a PaymentIntent can no longer be incremented. |
| 185 | * |
| 186 | * Learn more about <a |
| 187 | * href="/docs/terminal/features/incremental-authorizations">incremental |
| 188 | * authorizations</a>. |
| 189 | * |
| 190 | * @param string $id |
| 191 | * @param null|array $params |
| 192 | * @param null|array|\Stripe\Util\RequestOptions $opts |
| 193 | * |
| 194 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 195 | * |
| 196 | * @return \Stripe\PaymentIntent |
| 197 | */ |
| 198 | public function incrementAuthorization($id, $params = null, $opts = null) |
| 199 | { |
| 200 | return $this->request('post', $this->buildPath('/v1/payment_intents/%s/increment_authorization', $id), $params, $opts); |
| 201 | } |
| 202 | |
| 203 | /** |
| 204 | * Retrieves the details of a PaymentIntent that has previously been created. |
| 205 | * |
| 206 | * Client-side retrieval using a publishable key is allowed when the |
| 207 | * <code>client_secret</code> is provided in the query string. |
| 208 | * |
| 209 | * When retrieved with a publishable key, only a subset of properties will be |
| 210 | * returned. Please refer to the <a href="#payment_intent_object">payment |
| 211 | * intent</a> object reference for more details. |
| 212 | * |
| 213 | * @param string $id |
| 214 | * @param null|array $params |
| 215 | * @param null|array|\Stripe\Util\RequestOptions $opts |
| 216 | * |
| 217 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 218 | * |
| 219 | * @return \Stripe\PaymentIntent |
| 220 | */ |
| 221 | public function retrieve($id, $params = null, $opts = null) |
| 222 | { |
| 223 | return $this->request('get', $this->buildPath('/v1/payment_intents/%s', $id), $params, $opts); |
| 224 | } |
| 225 | |
| 226 | /** |
| 227 | * Search for PaymentIntents you’ve previously created using Stripe’s <a |
| 228 | * href="/docs/search#search-query-language">Search Query Language</a>. Don’t use |
| 229 | * search in read-after-write flows where strict consistency is necessary. Under |
| 230 | * normal operating conditions, data is searchable in less than a minute. |
| 231 | * Occasionally, propagation of new or updated data can be up to an hour behind |
| 232 | * during outages. Search functionality is not available to merchants in India. |
| 233 | * |
| 234 | * @param null|array $params |
| 235 | * @param null|array|\Stripe\Util\RequestOptions $opts |
| 236 | * |
| 237 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 238 | * |
| 239 | * @return \Stripe\SearchResult<\Stripe\PaymentIntent> |
| 240 | */ |
| 241 | public function search($params = null, $opts = null) |
| 242 | { |
| 243 | return $this->requestSearchResult('get', '/v1/payment_intents/search', $params, $opts); |
| 244 | } |
| 245 | |
| 246 | /** |
| 247 | * Updates properties on a PaymentIntent object without confirming. |
| 248 | * |
| 249 | * Depending on which properties you update, you may need to confirm the |
| 250 | * PaymentIntent again. For example, updating the <code>payment_method</code> will |
| 251 | * always require you to confirm the PaymentIntent again. If you prefer to update |
| 252 | * and confirm at the same time, we recommend updating properties via the <a |
| 253 | * href="/docs/api/payment_intents/confirm">confirm API</a> instead. |
| 254 | * |
| 255 | * @param string $id |
| 256 | * @param null|array $params |
| 257 | * @param null|array|\Stripe\Util\RequestOptions $opts |
| 258 | * |
| 259 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 260 | * |
| 261 | * @return \Stripe\PaymentIntent |
| 262 | */ |
| 263 | public function update($id, $params = null, $opts = null) |
| 264 | { |
| 265 | return $this->request('post', $this->buildPath('/v1/payment_intents/%s', $id), $params, $opts); |
| 266 | } |
| 267 | |
| 268 | /** |
| 269 | * Verifies microdeposits on a PaymentIntent object. |
| 270 | * |
| 271 | * @param string $id |
| 272 | * @param null|array $params |
| 273 | * @param null|array|\Stripe\Util\RequestOptions $opts |
| 274 | * |
| 275 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 276 | * |
| 277 | * @return \Stripe\PaymentIntent |
| 278 | */ |
| 279 | public function verifyMicrodeposits($id, $params = null, $opts = null) |
| 280 | { |
| 281 | return $this->request('post', $this->buildPath('/v1/payment_intents/%s/verify_microdeposits', $id), $params, $opts); |
| 282 | } |
| 283 | } |
| 284 |