ApiOperations
2 months ago
Apps
2 months ago
Billing
2 months ago
BillingPortal
2 months ago
Checkout
2 months ago
Climate
2 months ago
Entitlements
2 months ago
EventData
2 months ago
Events
2 months ago
Exception
2 months ago
FinancialConnections
2 months ago
Forwarding
2 months ago
HttpClient
2 months ago
Identity
2 months ago
Issuing
2 months ago
Radar
2 months ago
Reporting
2 months ago
Service
2 months ago
Sigma
2 months ago
Tax
2 months ago
Terminal
2 months ago
TestHelpers
2 months ago
Treasury
2 months ago
Util
2 months ago
V2
2 months ago
Account.php
2 months ago
AccountLink.php
2 months ago
AccountSession.php
2 months ago
ApiRequestor.php
2 months ago
ApiResource.php
2 months ago
ApiResponse.php
2 months ago
ApplePayDomain.php
2 months ago
Application.php
2 months ago
ApplicationFee.php
2 months ago
ApplicationFeeRefund.php
2 months ago
Balance.php
2 months ago
BalanceTransaction.php
2 months ago
BankAccount.php
2 months ago
BaseStripeClient.php
2 months ago
BaseStripeClientInterface.php
2 months ago
Capability.php
2 months ago
Card.php
2 months ago
CashBalance.php
2 months ago
Charge.php
2 months ago
Collection.php
2 months ago
ConfirmationToken.php
2 months ago
ConnectCollectionTransfer.php
2 months ago
CountrySpec.php
2 months ago
Coupon.php
2 months ago
CreditNote.php
2 months ago
CreditNoteLineItem.php
2 months ago
Customer.php
2 months ago
CustomerBalanceTransaction.php
2 months ago
CustomerCashBalanceTransaction.php
2 months ago
CustomerSession.php
2 months ago
Discount.php
2 months ago
Dispute.php
2 months ago
EphemeralKey.php
2 months ago
ErrorObject.php
2 months ago
Event.php
2 months ago
ExchangeRate.php
2 months ago
File.php
2 months ago
FileLink.php
2 months ago
FundingInstructions.php
2 months ago
Invoice.php
2 months ago
InvoiceItem.php
2 months ago
InvoiceLineItem.php
2 months ago
InvoiceRenderingTemplate.php
2 months ago
LineItem.php
2 months ago
LoginLink.php
2 months ago
Mandate.php
2 months ago
OAuth.php
2 months ago
OAuthErrorObject.php
2 months ago
PaymentIntent.php
2 months ago
PaymentLink.php
2 months ago
PaymentMethod.php
2 months ago
PaymentMethodConfiguration.php
2 months ago
PaymentMethodDomain.php
2 months ago
Payout.php
2 months ago
Person.php
2 months ago
Plan.php
2 months ago
Price.php
2 months ago
Product.php
2 months ago
ProductFeature.php
2 months ago
PromotionCode.php
2 months ago
Quote.php
2 months ago
Reason.php
2 months ago
RecipientTransfer.php
2 months ago
Refund.php
2 months ago
RelatedObject.php
2 months ago
RequestTelemetry.php
2 months ago
ReserveTransaction.php
2 months ago
Review.php
2 months ago
SearchResult.php
2 months ago
SetupAttempt.php
2 months ago
SetupIntent.php
2 months ago
ShippingRate.php
2 months ago
SingletonApiResource.php
2 months ago
Source.php
2 months ago
SourceMandateNotification.php
2 months ago
SourceTransaction.php
2 months ago
Stripe.php
2 months ago
StripeClient.php
2 months ago
StripeClientInterface.php
2 months ago
StripeObject.php
2 months ago
StripeStreamingClientInterface.php
2 months ago
Subscription.php
2 months ago
SubscriptionItem.php
2 months ago
SubscriptionSchedule.php
2 months ago
TaxCode.php
2 months ago
TaxDeductedAtSource.php
2 months ago
TaxId.php
2 months ago
TaxRate.php
2 months ago
ThinEvent.php
2 months ago
Token.php
2 months ago
Topup.php
2 months ago
Transfer.php
2 months ago
TransferReversal.php
2 months ago
UsageRecord.php
2 months ago
UsageRecordSummary.php
2 months ago
Webhook.php
2 months ago
WebhookEndpoint.php
2 months ago
WebhookSignature.php
2 months ago
PaymentMethod.php
240 lines
| 1 | <?php |
| 2 | |
| 3 | // File generated from our OpenAPI spec |
| 4 | namespace ProfilePressVendor\Stripe; |
| 5 | |
| 6 | /** |
| 7 | * PaymentMethod objects represent your customer's payment instruments. |
| 8 | * You can use them with <a href="https://stripe.com/docs/payments/payment-intents">PaymentIntents</a> to collect payments or save them to |
| 9 | * Customer objects to store instrument details for future payments. |
| 10 | * |
| 11 | * Related guides: <a href="https://stripe.com/docs/payments/payment-methods">Payment Methods</a> and <a href="https://stripe.com/docs/payments/more-payment-scenarios">More Payment Scenarios</a>. |
| 12 | * |
| 13 | * @property string $id Unique identifier for the object. |
| 14 | * @property string $object String representing the object's type. Objects of the same type share the same value. |
| 15 | * @property null|\Stripe\StripeObject $acss_debit |
| 16 | * @property null|\Stripe\StripeObject $affirm |
| 17 | * @property null|\Stripe\StripeObject $afterpay_clearpay |
| 18 | * @property null|\Stripe\StripeObject $alipay |
| 19 | * @property null|string $allow_redisplay This field indicates whether this payment method can be shown again to its customer in a checkout flow. Stripe products such as Checkout and Elements use this field to determine whether a payment method can be shown as a saved payment method in a checkout flow. The field defaults to “unspecified”. |
| 20 | * @property null|\Stripe\StripeObject $alma |
| 21 | * @property null|\Stripe\StripeObject $amazon_pay |
| 22 | * @property null|\Stripe\StripeObject $au_becs_debit |
| 23 | * @property null|\Stripe\StripeObject $bacs_debit |
| 24 | * @property null|\Stripe\StripeObject $bancontact |
| 25 | * @property \Stripe\StripeObject $billing_details |
| 26 | * @property null|\Stripe\StripeObject $blik |
| 27 | * @property null|\Stripe\StripeObject $boleto |
| 28 | * @property null|\Stripe\StripeObject $card |
| 29 | * @property null|\Stripe\StripeObject $card_present |
| 30 | * @property null|\Stripe\StripeObject $cashapp |
| 31 | * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. |
| 32 | * @property null|string|\Stripe\Customer $customer The ID of the Customer to which this PaymentMethod is saved. This will not be set when the PaymentMethod has not been saved to a Customer. |
| 33 | * @property null|\Stripe\StripeObject $customer_balance |
| 34 | * @property null|\Stripe\StripeObject $eps |
| 35 | * @property null|\Stripe\StripeObject $fpx |
| 36 | * @property null|\Stripe\StripeObject $giropay |
| 37 | * @property null|\Stripe\StripeObject $grabpay |
| 38 | * @property null|\Stripe\StripeObject $ideal |
| 39 | * @property null|\Stripe\StripeObject $interac_present |
| 40 | * @property null|\Stripe\StripeObject $kakao_pay |
| 41 | * @property null|\Stripe\StripeObject $klarna |
| 42 | * @property null|\Stripe\StripeObject $konbini |
| 43 | * @property null|\Stripe\StripeObject $kr_card |
| 44 | * @property null|\Stripe\StripeObject $link |
| 45 | * @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. |
| 46 | * @property null|\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. |
| 47 | * @property null|\Stripe\StripeObject $mobilepay |
| 48 | * @property null|\Stripe\StripeObject $multibanco |
| 49 | * @property null|\Stripe\StripeObject $naver_pay |
| 50 | * @property null|\Stripe\StripeObject $oxxo |
| 51 | * @property null|\Stripe\StripeObject $p24 |
| 52 | * @property null|\Stripe\StripeObject $pay_by_bank |
| 53 | * @property null|\Stripe\StripeObject $payco |
| 54 | * @property null|\Stripe\StripeObject $paynow |
| 55 | * @property null|\Stripe\StripeObject $paypal |
| 56 | * @property null|\Stripe\StripeObject $pix |
| 57 | * @property null|\Stripe\StripeObject $promptpay |
| 58 | * @property null|\Stripe\StripeObject $radar_options Options to configure Radar. See <a href="https://stripe.com/docs/radar/radar-session">Radar Session</a> for more information. |
| 59 | * @property null|\Stripe\StripeObject $revolut_pay |
| 60 | * @property null|\Stripe\StripeObject $samsung_pay |
| 61 | * @property null|\Stripe\StripeObject $sepa_debit |
| 62 | * @property null|\Stripe\StripeObject $sofort |
| 63 | * @property null|\Stripe\StripeObject $swish |
| 64 | * @property null|\Stripe\StripeObject $twint |
| 65 | * @property string $type The type of the PaymentMethod. An additional hash is included on the PaymentMethod with a name matching this value. It contains additional information specific to the PaymentMethod type. |
| 66 | * @property null|\Stripe\StripeObject $us_bank_account |
| 67 | * @property null|\Stripe\StripeObject $wechat_pay |
| 68 | * @property null|\Stripe\StripeObject $zip |
| 69 | */ |
| 70 | class PaymentMethod extends ApiResource |
| 71 | { |
| 72 | const OBJECT_NAME = 'payment_method'; |
| 73 | use ApiOperations\Update; |
| 74 | const ALLOW_REDISPLAY_ALWAYS = 'always'; |
| 75 | const ALLOW_REDISPLAY_LIMITED = 'limited'; |
| 76 | const ALLOW_REDISPLAY_UNSPECIFIED = 'unspecified'; |
| 77 | const TYPE_ACSS_DEBIT = 'acss_debit'; |
| 78 | const TYPE_AFFIRM = 'affirm'; |
| 79 | const TYPE_AFTERPAY_CLEARPAY = 'afterpay_clearpay'; |
| 80 | const TYPE_ALIPAY = 'alipay'; |
| 81 | const TYPE_ALMA = 'alma'; |
| 82 | const TYPE_AMAZON_PAY = 'amazon_pay'; |
| 83 | const TYPE_AU_BECS_DEBIT = 'au_becs_debit'; |
| 84 | const TYPE_BACS_DEBIT = 'bacs_debit'; |
| 85 | const TYPE_BANCONTACT = 'bancontact'; |
| 86 | const TYPE_BLIK = 'blik'; |
| 87 | const TYPE_BOLETO = 'boleto'; |
| 88 | const TYPE_CARD = 'card'; |
| 89 | const TYPE_CARD_PRESENT = 'card_present'; |
| 90 | const TYPE_CASHAPP = 'cashapp'; |
| 91 | const TYPE_CUSTOMER_BALANCE = 'customer_balance'; |
| 92 | const TYPE_EPS = 'eps'; |
| 93 | const TYPE_FPX = 'fpx'; |
| 94 | const TYPE_GIROPAY = 'giropay'; |
| 95 | const TYPE_GRABPAY = 'grabpay'; |
| 96 | const TYPE_IDEAL = 'ideal'; |
| 97 | const TYPE_INTERAC_PRESENT = 'interac_present'; |
| 98 | const TYPE_KAKAO_PAY = 'kakao_pay'; |
| 99 | const TYPE_KLARNA = 'klarna'; |
| 100 | const TYPE_KONBINI = 'konbini'; |
| 101 | const TYPE_KR_CARD = 'kr_card'; |
| 102 | const TYPE_LINK = 'link'; |
| 103 | const TYPE_MOBILEPAY = 'mobilepay'; |
| 104 | const TYPE_MULTIBANCO = 'multibanco'; |
| 105 | const TYPE_NAVER_PAY = 'naver_pay'; |
| 106 | const TYPE_OXXO = 'oxxo'; |
| 107 | const TYPE_P24 = 'p24'; |
| 108 | const TYPE_PAYCO = 'payco'; |
| 109 | const TYPE_PAYNOW = 'paynow'; |
| 110 | const TYPE_PAYPAL = 'paypal'; |
| 111 | const TYPE_PAY_BY_BANK = 'pay_by_bank'; |
| 112 | const TYPE_PIX = 'pix'; |
| 113 | const TYPE_PROMPTPAY = 'promptpay'; |
| 114 | const TYPE_REVOLUT_PAY = 'revolut_pay'; |
| 115 | const TYPE_SAMSUNG_PAY = 'samsung_pay'; |
| 116 | const TYPE_SEPA_DEBIT = 'sepa_debit'; |
| 117 | const TYPE_SOFORT = 'sofort'; |
| 118 | const TYPE_SWISH = 'swish'; |
| 119 | const TYPE_TWINT = 'twint'; |
| 120 | const TYPE_US_BANK_ACCOUNT = 'us_bank_account'; |
| 121 | const TYPE_WECHAT_PAY = 'wechat_pay'; |
| 122 | const TYPE_ZIP = 'zip'; |
| 123 | /** |
| 124 | * Creates a PaymentMethod object. Read the <a |
| 125 | * href="/docs/stripe-js/reference#stripe-create-payment-method">Stripe.js |
| 126 | * reference</a> to learn how to create PaymentMethods via Stripe.js. |
| 127 | * |
| 128 | * Instead of creating a PaymentMethod directly, we recommend using the <a |
| 129 | * href="/docs/payments/accept-a-payment">PaymentIntents</a> API to accept a |
| 130 | * payment immediately or the <a |
| 131 | * href="/docs/payments/save-and-reuse">SetupIntent</a> API to collect payment |
| 132 | * method details ahead of a future payment. |
| 133 | * |
| 134 | * @param null|array $params |
| 135 | * @param null|array|string $options |
| 136 | * |
| 137 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 138 | * |
| 139 | * @return \Stripe\PaymentMethod the created resource |
| 140 | */ |
| 141 | public static function create($params = null, $options = null) |
| 142 | { |
| 143 | self::_validateParams($params); |
| 144 | $url = static::classUrl(); |
| 145 | list($response, $opts) = static::_staticRequest('post', $url, $params, $options); |
| 146 | $obj = \ProfilePressVendor\Stripe\Util\Util::convertToStripeObject($response->json, $opts); |
| 147 | $obj->setLastResponse($response); |
| 148 | return $obj; |
| 149 | } |
| 150 | /** |
| 151 | * Returns a list of PaymentMethods for Treasury flows. If you want to list the |
| 152 | * PaymentMethods attached to a Customer for payments, you should use the <a |
| 153 | * href="/docs/api/payment_methods/customer_list">List a Customer’s |
| 154 | * PaymentMethods</a> API instead. |
| 155 | * |
| 156 | * @param null|array $params |
| 157 | * @param null|array|string $opts |
| 158 | * |
| 159 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 160 | * |
| 161 | * @return \Stripe\Collection<\Stripe\PaymentMethod> of ApiResources |
| 162 | */ |
| 163 | public static function all($params = null, $opts = null) |
| 164 | { |
| 165 | $url = static::classUrl(); |
| 166 | return static::_requestPage($url, \ProfilePressVendor\Stripe\Collection::class, $params, $opts); |
| 167 | } |
| 168 | /** |
| 169 | * Retrieves a PaymentMethod object attached to the StripeAccount. To retrieve a |
| 170 | * payment method attached to a Customer, you should use <a |
| 171 | * href="/docs/api/payment_methods/customer">Retrieve a Customer’s |
| 172 | * PaymentMethods</a>. |
| 173 | * |
| 174 | * @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key |
| 175 | * @param null|array|string $opts |
| 176 | * |
| 177 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 178 | * |
| 179 | * @return \Stripe\PaymentMethod |
| 180 | */ |
| 181 | public static function retrieve($id, $opts = null) |
| 182 | { |
| 183 | $opts = \ProfilePressVendor\Stripe\Util\RequestOptions::parse($opts); |
| 184 | $instance = new static($id, $opts); |
| 185 | $instance->refresh(); |
| 186 | return $instance; |
| 187 | } |
| 188 | /** |
| 189 | * Updates a PaymentMethod object. A PaymentMethod must be attached a customer to |
| 190 | * be updated. |
| 191 | * |
| 192 | * @param string $id the ID of the resource to update |
| 193 | * @param null|array $params |
| 194 | * @param null|array|string $opts |
| 195 | * |
| 196 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 197 | * |
| 198 | * @return \Stripe\PaymentMethod the updated resource |
| 199 | */ |
| 200 | public static function update($id, $params = null, $opts = null) |
| 201 | { |
| 202 | self::_validateParams($params); |
| 203 | $url = static::resourceUrl($id); |
| 204 | list($response, $opts) = static::_staticRequest('post', $url, $params, $opts); |
| 205 | $obj = \ProfilePressVendor\Stripe\Util\Util::convertToStripeObject($response->json, $opts); |
| 206 | $obj->setLastResponse($response); |
| 207 | return $obj; |
| 208 | } |
| 209 | /** |
| 210 | * @param null|array $params |
| 211 | * @param null|array|string $opts |
| 212 | * |
| 213 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 214 | * |
| 215 | * @return \Stripe\PaymentMethod the attached payment method |
| 216 | */ |
| 217 | public function attach($params = null, $opts = null) |
| 218 | { |
| 219 | $url = $this->instanceUrl() . '/attach'; |
| 220 | list($response, $opts) = $this->_request('post', $url, $params, $opts); |
| 221 | $this->refreshFrom($response, $opts); |
| 222 | return $this; |
| 223 | } |
| 224 | /** |
| 225 | * @param null|array $params |
| 226 | * @param null|array|string $opts |
| 227 | * |
| 228 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 229 | * |
| 230 | * @return \Stripe\PaymentMethod the detached payment method |
| 231 | */ |
| 232 | public function detach($params = null, $opts = null) |
| 233 | { |
| 234 | $url = $this->instanceUrl() . '/detach'; |
| 235 | list($response, $opts) = $this->_request('post', $url, $params, $opts); |
| 236 | $this->refreshFrom($response, $opts); |
| 237 | return $this; |
| 238 | } |
| 239 | } |
| 240 |