ApiOperations
6 months ago
Apps
6 months ago
Billing
6 months ago
BillingPortal
6 months ago
Checkout
6 months ago
Climate
6 months ago
Entitlements
6 months ago
EventData
6 months ago
Events
6 months ago
Exception
6 months ago
FinancialConnections
6 months ago
Forwarding
6 months ago
HttpClient
6 months ago
Identity
6 months ago
Issuing
6 months ago
Radar
6 months ago
Reporting
6 months ago
Service
6 months ago
Sigma
6 months ago
Tax
6 months ago
Terminal
6 months ago
TestHelpers
6 months ago
Treasury
6 months ago
Util
6 months ago
V2
6 months ago
Account.php
6 months ago
AccountLink.php
6 months ago
AccountSession.php
6 months ago
ApiRequestor.php
6 months ago
ApiResource.php
6 months ago
ApiResponse.php
6 months ago
ApplePayDomain.php
6 months ago
Application.php
6 months ago
ApplicationFee.php
6 months ago
ApplicationFeeRefund.php
6 months ago
Balance.php
6 months ago
BalanceTransaction.php
6 months ago
BankAccount.php
6 months ago
BaseStripeClient.php
6 months ago
BaseStripeClientInterface.php
6 months ago
Capability.php
6 months ago
Card.php
6 months ago
CashBalance.php
6 months ago
Charge.php
6 months ago
Collection.php
6 months ago
ConfirmationToken.php
6 months ago
ConnectCollectionTransfer.php
6 months ago
CountrySpec.php
6 months ago
Coupon.php
6 months ago
CreditNote.php
6 months ago
CreditNoteLineItem.php
6 months ago
Customer.php
6 months ago
CustomerBalanceTransaction.php
6 months ago
CustomerCashBalanceTransaction.php
6 months ago
CustomerSession.php
6 months ago
Discount.php
6 months ago
Dispute.php
6 months ago
EphemeralKey.php
6 months ago
ErrorObject.php
6 months ago
Event.php
6 months ago
ExchangeRate.php
6 months ago
File.php
6 months ago
FileLink.php
6 months ago
FundingInstructions.php
6 months ago
Invoice.php
6 months ago
InvoiceItem.php
6 months ago
InvoiceLineItem.php
6 months ago
InvoicePayment.php
6 months ago
InvoiceRenderingTemplate.php
6 months ago
LineItem.php
6 months ago
LoginLink.php
6 months ago
Mandate.php
6 months ago
OAuth.php
6 months ago
OAuthErrorObject.php
6 months ago
PaymentIntent.php
6 months ago
PaymentLink.php
6 months ago
PaymentMethod.php
6 months ago
PaymentMethodConfiguration.php
6 months ago
PaymentMethodDomain.php
6 months ago
Payout.php
6 months ago
Person.php
6 months ago
Plan.php
6 months ago
Price.php
6 months ago
Product.php
6 months ago
ProductFeature.php
6 months ago
PromotionCode.php
6 months ago
Quote.php
6 months ago
Reason.php
6 months ago
RecipientTransfer.php
6 months ago
Refund.php
6 months ago
RelatedObject.php
6 months ago
RequestTelemetry.php
6 months ago
ReserveTransaction.php
6 months ago
Review.php
6 months ago
SearchResult.php
6 months ago
SetupAttempt.php
6 months ago
SetupIntent.php
6 months ago
ShippingRate.php
6 months ago
SingletonApiResource.php
6 months ago
Source.php
6 months ago
SourceMandateNotification.php
6 months ago
SourceTransaction.php
6 months ago
Stripe.php
6 months ago
StripeClient.php
6 months ago
StripeClientInterface.php
6 months ago
StripeObject.php
6 months ago
StripeStreamingClientInterface.php
6 months ago
Subscription.php
6 months ago
SubscriptionItem.php
6 months ago
SubscriptionSchedule.php
6 months ago
TaxCode.php
6 months ago
TaxDeductedAtSource.php
6 months ago
TaxId.php
6 months ago
TaxRate.php
6 months ago
ThinEvent.php
6 months ago
Token.php
6 months ago
Topup.php
6 months ago
Transfer.php
6 months ago
TransferReversal.php
6 months ago
Webhook.php
6 months ago
WebhookEndpoint.php
6 months ago
WebhookSignature.php
6 months ago
ShippingRate.php
102 lines
| 1 | <?php |
| 2 | |
| 3 | // File generated from our OpenAPI spec |
| 4 | namespace AmeliaVendor\Stripe; |
| 5 | |
| 6 | /** |
| 7 | * Shipping rates describe the price of shipping presented to your customers and |
| 8 | * applied to a purchase. For more information, see <a href="https://stripe.com/docs/payments/during-payment/charge-shipping">Charge for shipping</a>. |
| 9 | * |
| 10 | * @property string $id Unique identifier for the object. |
| 11 | * @property string $object String representing the object's type. Objects of the same type share the same value. |
| 12 | * @property bool $active Whether the shipping rate can be used for new purchases. Defaults to <code>true</code>. |
| 13 | * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. |
| 14 | * @property null|(object{maximum: null|(object{unit: string, value: int}&StripeObject), minimum: null|(object{unit: string, value: int}&StripeObject)}&StripeObject) $delivery_estimate The estimated range for how long shipping will take, meant to be displayable to the customer. This will appear on CheckoutSessions. |
| 15 | * @property null|string $display_name The name of the shipping rate, meant to be displayable to the customer. This will appear on CheckoutSessions. |
| 16 | * @property null|(object{amount: int, currency: string, currency_options?: StripeObject}&StripeObject) $fixed_amount |
| 17 | * @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. |
| 18 | * @property \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. |
| 19 | * @property null|string $tax_behavior Specifies whether the rate is considered inclusive of taxes or exclusive of taxes. One of <code>inclusive</code>, <code>exclusive</code>, or <code>unspecified</code>. |
| 20 | * @property null|string|TaxCode $tax_code A <a href="https://stripe.com/docs/tax/tax-categories">tax code</a> ID. The Shipping tax code is <code>txcd_92010001</code>. |
| 21 | * @property string $type The type of calculation to use on the shipping rate. |
| 22 | */ |
| 23 | class ShippingRate extends ApiResource |
| 24 | { |
| 25 | const OBJECT_NAME = 'shipping_rate'; |
| 26 | use \AmeliaVendor\Stripe\ApiOperations\Update; |
| 27 | const TAX_BEHAVIOR_EXCLUSIVE = 'exclusive'; |
| 28 | const TAX_BEHAVIOR_INCLUSIVE = 'inclusive'; |
| 29 | const TAX_BEHAVIOR_UNSPECIFIED = 'unspecified'; |
| 30 | const TYPE_FIXED_AMOUNT = 'fixed_amount'; |
| 31 | /** |
| 32 | * Creates a new shipping rate object. |
| 33 | * |
| 34 | * @param null|array{delivery_estimate?: array{maximum?: array{unit: string, value: int}, minimum?: array{unit: string, value: int}}, display_name: string, expand?: string[], fixed_amount?: array{amount: int, currency: string, currency_options?: array<string, array{amount: int, tax_behavior?: string}>}, metadata?: array<string, string>, tax_behavior?: string, tax_code?: string, type?: string} $params |
| 35 | * @param null|array|string $options |
| 36 | * |
| 37 | * @return ShippingRate the created resource |
| 38 | * |
| 39 | * @throws Exception\ApiErrorException if the request fails |
| 40 | */ |
| 41 | public static function create($params = null, $options = null) |
| 42 | { |
| 43 | self::_validateParams($params); |
| 44 | $url = static::classUrl(); |
| 45 | list($response, $opts) = static::_staticRequest('post', $url, $params, $options); |
| 46 | $obj = \AmeliaVendor\Stripe\Util\Util::convertToStripeObject($response->json, $opts); |
| 47 | $obj->setLastResponse($response); |
| 48 | return $obj; |
| 49 | } |
| 50 | /** |
| 51 | * Returns a list of your shipping rates. |
| 52 | * |
| 53 | * @param null|array{active?: bool, created?: array|int, currency?: string, ending_before?: string, expand?: string[], limit?: int, starting_after?: string} $params |
| 54 | * @param null|array|string $opts |
| 55 | * |
| 56 | * @return Collection<ShippingRate> of ApiResources |
| 57 | * |
| 58 | * @throws Exception\ApiErrorException if the request fails |
| 59 | */ |
| 60 | public static function all($params = null, $opts = null) |
| 61 | { |
| 62 | $url = static::classUrl(); |
| 63 | return static::_requestPage($url, Collection::class, $params, $opts); |
| 64 | } |
| 65 | /** |
| 66 | * Returns the shipping rate object with the given ID. |
| 67 | * |
| 68 | * @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key |
| 69 | * @param null|array|string $opts |
| 70 | * |
| 71 | * @return ShippingRate |
| 72 | * |
| 73 | * @throws Exception\ApiErrorException if the request fails |
| 74 | */ |
| 75 | public static function retrieve($id, $opts = null) |
| 76 | { |
| 77 | $opts = \AmeliaVendor\Stripe\Util\RequestOptions::parse($opts); |
| 78 | $instance = new static($id, $opts); |
| 79 | $instance->refresh(); |
| 80 | return $instance; |
| 81 | } |
| 82 | /** |
| 83 | * Updates an existing shipping rate object. |
| 84 | * |
| 85 | * @param string $id the ID of the resource to update |
| 86 | * @param null|array{active?: bool, expand?: string[], fixed_amount?: array{currency_options?: array<string, array{amount?: int, tax_behavior?: string}>}, metadata?: null|array<string, string>, tax_behavior?: string} $params |
| 87 | * @param null|array|string $opts |
| 88 | * |
| 89 | * @return ShippingRate the updated resource |
| 90 | * |
| 91 | * @throws Exception\ApiErrorException if the request fails |
| 92 | */ |
| 93 | public static function update($id, $params = null, $opts = null) |
| 94 | { |
| 95 | self::_validateParams($params); |
| 96 | $url = static::resourceUrl($id); |
| 97 | list($response, $opts) = static::_staticRequest('post', $url, $params, $opts); |
| 98 | $obj = \AmeliaVendor\Stripe\Util\Util::convertToStripeObject($response->json, $opts); |
| 99 | $obj->setLastResponse($response); |
| 100 | return $obj; |
| 101 | } |
| 102 | } |