ApiOperations
1 year ago
Apps
1 year ago
Billing
1 year ago
BillingPortal
1 year ago
Checkout
1 year ago
Climate
1 year ago
Entitlements
1 year ago
EventData
1 year ago
Events
1 year ago
Exception
1 year ago
FinancialConnections
1 year ago
Forwarding
1 year ago
HttpClient
1 year ago
Identity
1 year ago
Issuing
1 year ago
Radar
1 year ago
Reporting
1 year ago
Service
1 year ago
Sigma
1 year ago
Tax
1 year ago
Terminal
1 year ago
TestHelpers
1 year ago
Treasury
1 year ago
Util
1 year ago
V2
1 year ago
Account.php
1 year ago
AccountLink.php
1 year ago
AccountSession.php
1 year ago
ApiRequestor.php
1 year ago
ApiResource.php
2 years ago
ApiResponse.php
2 years ago
ApplePayDomain.php
1 year ago
Application.php
2 years ago
ApplicationFee.php
1 year ago
ApplicationFeeRefund.php
2 years ago
Balance.php
1 year ago
BalanceTransaction.php
1 year ago
BankAccount.php
1 year ago
BaseStripeClient.php
1 year ago
BaseStripeClientInterface.php
1 year ago
Capability.php
1 year ago
Card.php
1 year ago
CashBalance.php
2 years ago
Charge.php
1 year ago
Collection.php
1 year ago
ConfirmationToken.php
1 year ago
ConnectCollectionTransfer.php
2 years ago
CountrySpec.php
1 year ago
Coupon.php
1 year ago
CreditNote.php
1 year ago
CreditNoteLineItem.php
1 year ago
Customer.php
1 year ago
CustomerBalanceTransaction.php
2 years ago
CustomerCashBalanceTransaction.php
2 years ago
CustomerSession.php
1 year ago
Discount.php
1 year ago
Dispute.php
1 year ago
EphemeralKey.php
1 year ago
ErrorObject.php
1 year ago
Event.php
1 year ago
ExchangeRate.php
1 year ago
File.php
1 year ago
FileLink.php
1 year ago
FundingInstructions.php
2 years ago
Invoice.php
1 year ago
InvoiceItem.php
1 year ago
InvoiceLineItem.php
1 year ago
InvoiceRenderingTemplate.php
1 year ago
LineItem.php
1 year ago
LoginLink.php
1 year ago
Mandate.php
1 year ago
OAuth.php
2 years ago
OAuthErrorObject.php
1 year ago
PaymentIntent.php
1 year ago
PaymentLink.php
1 year ago
PaymentMethod.php
1 year ago
PaymentMethodConfiguration.php
1 year ago
PaymentMethodDomain.php
1 year ago
Payout.php
1 year ago
Person.php
1 year ago
Plan.php
1 year ago
Price.php
1 year ago
Product.php
1 year ago
ProductFeature.php
1 year ago
PromotionCode.php
1 year ago
Quote.php
1 year ago
Reason.php
1 year ago
RecipientTransfer.php
2 years ago
Refund.php
1 year ago
RelatedObject.php
1 year ago
RequestTelemetry.php
2 years ago
ReserveTransaction.php
2 years ago
Review.php
1 year ago
SearchResult.php
1 year ago
SetupAttempt.php
1 year ago
SetupIntent.php
1 year ago
ShippingRate.php
1 year ago
SingletonApiResource.php
2 years ago
Source.php
1 year ago
SourceMandateNotification.php
2 years ago
SourceTransaction.php
2 years ago
Stripe.php
1 year ago
StripeClient.php
1 year ago
StripeClientInterface.php
2 years ago
StripeObject.php
1 year ago
StripeStreamingClientInterface.php
2 years ago
Subscription.php
1 year ago
SubscriptionItem.php
1 year ago
SubscriptionSchedule.php
1 year ago
TaxCode.php
1 year ago
TaxDeductedAtSource.php
2 years ago
TaxId.php
1 year ago
TaxRate.php
1 year ago
ThinEvent.php
1 year ago
Token.php
1 year ago
Topup.php
1 year ago
Transfer.php
1 year ago
TransferReversal.php
1 year ago
UsageRecord.php
1 year ago
UsageRecordSummary.php
1 year ago
Webhook.php
1 year ago
WebhookEndpoint.php
1 year ago
WebhookSignature.php
2 years ago
CustomerBalanceTransaction.php
81 lines
| 1 | <?php |
| 2 | |
| 3 | // File generated from our OpenAPI spec |
| 4 | namespace WPForms\Vendor\Stripe; |
| 5 | |
| 6 | /** |
| 7 | * Each customer has a <a href="https://stripe.com/docs/api/customers/object#customer_object-balance">Balance</a> value, |
| 8 | * which denotes a debit or credit that's automatically applied to their next invoice upon finalization. |
| 9 | * You may modify the value directly by using the <a href="https://stripe.com/docs/api/customers/update">update customer API</a>, |
| 10 | * or by creating a Customer Balance Transaction, which increments or decrements the customer's <code>balance</code> by the specified <code>amount</code>. |
| 11 | * |
| 12 | * Related guide: <a href="https://stripe.com/docs/billing/customer/balance">Customer balance</a> |
| 13 | * |
| 14 | * @property string $id Unique identifier for the object. |
| 15 | * @property string $object String representing the object's type. Objects of the same type share the same value. |
| 16 | * @property int $amount The amount of the transaction. A negative value is a credit for the customer's balance, and a positive value is a debit to the customer's <code>balance</code>. |
| 17 | * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. |
| 18 | * @property null|string|\Stripe\CreditNote $credit_note The ID of the credit note (if any) related to the transaction. |
| 19 | * @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>. |
| 20 | * @property string|\Stripe\Customer $customer The ID of the customer the transaction belongs to. |
| 21 | * @property null|string $description An arbitrary string attached to the object. Often useful for displaying to users. |
| 22 | * @property int $ending_balance The customer's <code>balance</code> after the transaction was applied. A negative value decreases the amount due on the customer's next invoice. A positive value increases the amount due on the customer's next invoice. |
| 23 | * @property null|string|\Stripe\Invoice $invoice The ID of the invoice (if any) related to the transaction. |
| 24 | * @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. |
| 25 | * @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. |
| 26 | * @property string $type Transaction type: <code>adjustment</code>, <code>applied_to_invoice</code>, <code>credit_note</code>, <code>initial</code>, <code>invoice_overpaid</code>, <code>invoice_too_large</code>, <code>invoice_too_small</code>, <code>unspent_receiver_credit</code>, or <code>unapplied_from_invoice</code>. See the <a href="https://stripe.com/docs/billing/customer/balance#types">Customer Balance page</a> to learn more about transaction types. |
| 27 | */ |
| 28 | class CustomerBalanceTransaction extends ApiResource |
| 29 | { |
| 30 | const OBJECT_NAME = 'customer_balance_transaction'; |
| 31 | const TYPE_ADJUSTMENT = 'adjustment'; |
| 32 | const TYPE_APPLIED_TO_INVOICE = 'applied_to_invoice'; |
| 33 | const TYPE_CREDIT_NOTE = 'credit_note'; |
| 34 | const TYPE_INITIAL = 'initial'; |
| 35 | const TYPE_INVOICE_OVERPAID = 'invoice_overpaid'; |
| 36 | const TYPE_INVOICE_TOO_LARGE = 'invoice_too_large'; |
| 37 | const TYPE_INVOICE_TOO_SMALL = 'invoice_too_small'; |
| 38 | const TYPE_UNSPENT_RECEIVER_CREDIT = 'unspent_receiver_credit'; |
| 39 | const TYPE_ADJUSTEMENT = 'adjustment'; |
| 40 | /** |
| 41 | * @return string the API URL for this balance transaction |
| 42 | */ |
| 43 | public function instanceUrl() |
| 44 | { |
| 45 | $id = $this['id']; |
| 46 | $customer = $this['customer']; |
| 47 | if (!$id) { |
| 48 | throw new Exception\UnexpectedValueException("Could not determine which URL to request: class instance has invalid ID: {$id}", null); |
| 49 | } |
| 50 | $id = Util\Util::utf8($id); |
| 51 | $customer = Util\Util::utf8($customer); |
| 52 | $base = Customer::classUrl(); |
| 53 | $customerExtn = \urlencode($customer); |
| 54 | $extn = \urlencode($id); |
| 55 | return "{$base}/{$customerExtn}/balance_transactions/{$extn}"; |
| 56 | } |
| 57 | /** |
| 58 | * @param array|string $_id |
| 59 | * @param null|array|string $_opts |
| 60 | * |
| 61 | * @throws \Stripe\Exception\BadMethodCallException |
| 62 | */ |
| 63 | public static function retrieve($_id, $_opts = null) |
| 64 | { |
| 65 | $msg = 'Customer Balance Transactions cannot be retrieved without a ' . 'customer ID. Retrieve a Customer Balance Transaction using ' . "`Customer::retrieveBalanceTransaction('customer_id', " . "'balance_transaction_id')`."; |
| 66 | throw new Exception\BadMethodCallException($msg); |
| 67 | } |
| 68 | /** |
| 69 | * @param string $_id |
| 70 | * @param null|array $_params |
| 71 | * @param null|array|string $_options |
| 72 | * |
| 73 | * @throws \Stripe\Exception\BadMethodCallException |
| 74 | */ |
| 75 | public static function update($_id, $_params = null, $_options = null) |
| 76 | { |
| 77 | $msg = 'Customer Balance Transactions cannot be updated without a ' . 'customer ID. Update a Customer Balance Transaction using ' . "`Customer::updateBalanceTransaction('customer_id', " . "'balance_transaction_id', \$updateParams)`."; |
| 78 | throw new Exception\BadMethodCallException($msg); |
| 79 | } |
| 80 | } |
| 81 |