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
Topup.php
129 lines
| 1 | <?php |
| 2 | |
| 3 | // File generated from our OpenAPI spec |
| 4 | namespace WPForms\Vendor\Stripe; |
| 5 | |
| 6 | /** |
| 7 | * To top up your Stripe balance, you create a top-up object. You can retrieve |
| 8 | * individual top-ups, as well as list all top-ups. Top-ups are identified by a |
| 9 | * unique, random ID. |
| 10 | * |
| 11 | * Related guide: <a href="https://stripe.com/docs/connect/top-ups">Topping up your platform account</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 int $amount Amount transferred. |
| 16 | * @property null|string|\Stripe\BalanceTransaction $balance_transaction ID of the balance transaction that describes the impact of this top-up on your account balance. May not be specified depending on status of top-up. |
| 17 | * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. |
| 18 | * @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>. |
| 19 | * @property null|string $description An arbitrary string attached to the object. Often useful for displaying to users. |
| 20 | * @property null|int $expected_availability_date Date the funds are expected to arrive in your Stripe account for payouts. This factors in delays like weekends or bank holidays. May not be specified depending on status of top-up. |
| 21 | * @property null|string $failure_code Error code explaining reason for top-up failure if available (see <a href="https://stripe.com/docs/api#errors">the errors section</a> for a list of codes). |
| 22 | * @property null|string $failure_message Message to user further explaining reason for top-up failure if available. |
| 23 | * @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. |
| 24 | * @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. |
| 25 | * @property null|\Stripe\Source $source The source field is deprecated. It might not always be present in the API response. |
| 26 | * @property null|string $statement_descriptor Extra information about a top-up. This will appear on your source's bank statement. It must contain at least one letter. |
| 27 | * @property string $status The status of the top-up is either <code>canceled</code>, <code>failed</code>, <code>pending</code>, <code>reversed</code>, or <code>succeeded</code>. |
| 28 | * @property null|string $transfer_group A string that identifies this top-up as part of a group. |
| 29 | */ |
| 30 | class Topup extends ApiResource |
| 31 | { |
| 32 | const OBJECT_NAME = 'topup'; |
| 33 | use ApiOperations\Update; |
| 34 | const STATUS_CANCELED = 'canceled'; |
| 35 | const STATUS_FAILED = 'failed'; |
| 36 | const STATUS_PENDING = 'pending'; |
| 37 | const STATUS_REVERSED = 'reversed'; |
| 38 | const STATUS_SUCCEEDED = 'succeeded'; |
| 39 | /** |
| 40 | * Top up the balance of an account. |
| 41 | * |
| 42 | * @param null|array $params |
| 43 | * @param null|array|string $options |
| 44 | * |
| 45 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 46 | * |
| 47 | * @return \Stripe\Topup the created resource |
| 48 | */ |
| 49 | public static function create($params = null, $options = null) |
| 50 | { |
| 51 | self::_validateParams($params); |
| 52 | $url = static::classUrl(); |
| 53 | list($response, $opts) = static::_staticRequest('post', $url, $params, $options); |
| 54 | $obj = \WPForms\Vendor\Stripe\Util\Util::convertToStripeObject($response->json, $opts); |
| 55 | $obj->setLastResponse($response); |
| 56 | return $obj; |
| 57 | } |
| 58 | /** |
| 59 | * Returns a list of top-ups. |
| 60 | * |
| 61 | * @param null|array $params |
| 62 | * @param null|array|string $opts |
| 63 | * |
| 64 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 65 | * |
| 66 | * @return \Stripe\Collection<\Stripe\Topup> of ApiResources |
| 67 | */ |
| 68 | public static function all($params = null, $opts = null) |
| 69 | { |
| 70 | $url = static::classUrl(); |
| 71 | return static::_requestPage($url, \WPForms\Vendor\Stripe\Collection::class, $params, $opts); |
| 72 | } |
| 73 | /** |
| 74 | * Retrieves the details of a top-up that has previously been created. Supply the |
| 75 | * unique top-up ID that was returned from your previous request, and Stripe will |
| 76 | * return the corresponding top-up information. |
| 77 | * |
| 78 | * @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key |
| 79 | * @param null|array|string $opts |
| 80 | * |
| 81 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 82 | * |
| 83 | * @return \Stripe\Topup |
| 84 | */ |
| 85 | public static function retrieve($id, $opts = null) |
| 86 | { |
| 87 | $opts = \WPForms\Vendor\Stripe\Util\RequestOptions::parse($opts); |
| 88 | $instance = new static($id, $opts); |
| 89 | $instance->refresh(); |
| 90 | return $instance; |
| 91 | } |
| 92 | /** |
| 93 | * Updates the metadata of a top-up. Other top-up details are not editable by |
| 94 | * design. |
| 95 | * |
| 96 | * @param string $id the ID of the resource to update |
| 97 | * @param null|array $params |
| 98 | * @param null|array|string $opts |
| 99 | * |
| 100 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 101 | * |
| 102 | * @return \Stripe\Topup the updated resource |
| 103 | */ |
| 104 | public static function update($id, $params = null, $opts = null) |
| 105 | { |
| 106 | self::_validateParams($params); |
| 107 | $url = static::resourceUrl($id); |
| 108 | list($response, $opts) = static::_staticRequest('post', $url, $params, $opts); |
| 109 | $obj = \WPForms\Vendor\Stripe\Util\Util::convertToStripeObject($response->json, $opts); |
| 110 | $obj->setLastResponse($response); |
| 111 | return $obj; |
| 112 | } |
| 113 | /** |
| 114 | * @param null|array $params |
| 115 | * @param null|array|string $opts |
| 116 | * |
| 117 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 118 | * |
| 119 | * @return \Stripe\Topup the canceled topup |
| 120 | */ |
| 121 | public function cancel($params = null, $opts = null) |
| 122 | { |
| 123 | $url = $this->instanceUrl() . '/cancel'; |
| 124 | list($response, $opts) = $this->_request('post', $url, $params, $opts); |
| 125 | $this->refreshFrom($response, $opts); |
| 126 | return $this; |
| 127 | } |
| 128 | } |
| 129 |