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
WebhookEndpoint.php
132 lines
| 1 | <?php |
| 2 | |
| 3 | // File generated from our OpenAPI spec |
| 4 | namespace AmeliaVendor\Stripe; |
| 5 | |
| 6 | /** |
| 7 | * You can configure <a href="https://docs.stripe.com/webhooks/">webhook endpoints</a> via the API to be |
| 8 | * notified about events that happen in your Stripe account or connected |
| 9 | * accounts. |
| 10 | * |
| 11 | * Most users configure webhooks from <a href="https://dashboard.stripe.com/webhooks">the dashboard</a>, which provides a user interface for registering and testing your webhook endpoints. |
| 12 | * |
| 13 | * Related guide: <a href="https://docs.stripe.com/webhooks/configure">Setting up webhooks</a> |
| 14 | * |
| 15 | * @property string $id Unique identifier for the object. |
| 16 | * @property string $object String representing the object's type. Objects of the same type share the same value. |
| 17 | * @property null|string $api_version The API version events are rendered as for this webhook endpoint. |
| 18 | * @property null|string $application The ID of the associated Connect application. |
| 19 | * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. |
| 20 | * @property null|string $description An optional description of what the webhook is used for. |
| 21 | * @property string[] $enabled_events The list of events to enable for this endpoint. <code>['*']</code> indicates that all events are enabled, except those that require explicit selection. |
| 22 | * @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. |
| 23 | * @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. |
| 24 | * @property null|string $secret The endpoint's secret, used to generate <a href="https://docs.stripe.com/webhooks/signatures">webhook signatures</a>. Only returned at creation. |
| 25 | * @property string $status The status of the webhook. It can be <code>enabled</code> or <code>disabled</code>. |
| 26 | * @property string $url The URL of the webhook endpoint. |
| 27 | */ |
| 28 | class WebhookEndpoint extends ApiResource |
| 29 | { |
| 30 | const OBJECT_NAME = 'webhook_endpoint'; |
| 31 | use \AmeliaVendor\Stripe\ApiOperations\Update; |
| 32 | /** |
| 33 | * A webhook endpoint must have a <code>url</code> and a list of |
| 34 | * <code>enabled_events</code>. You may optionally specify the Boolean |
| 35 | * <code>connect</code> parameter. If set to true, then a Connect webhook endpoint |
| 36 | * that notifies the specified <code>url</code> about events from all connected |
| 37 | * accounts is created; otherwise an account webhook endpoint that notifies the |
| 38 | * specified <code>url</code> only about events from your account is created. You |
| 39 | * can also create webhook endpoints in the <a |
| 40 | * href="https://dashboard.stripe.com/account/webhooks">webhooks settings</a> |
| 41 | * section of the Dashboard. |
| 42 | * |
| 43 | * @param null|array{api_version?: string, connect?: bool, description?: null|string, enabled_events: string[], expand?: string[], metadata?: null|array<string, string>, url: string} $params |
| 44 | * @param null|array|string $options |
| 45 | * |
| 46 | * @return WebhookEndpoint the created resource |
| 47 | * |
| 48 | * @throws Exception\ApiErrorException if the request fails |
| 49 | */ |
| 50 | public static function create($params = null, $options = null) |
| 51 | { |
| 52 | self::_validateParams($params); |
| 53 | $url = static::classUrl(); |
| 54 | list($response, $opts) = static::_staticRequest('post', $url, $params, $options); |
| 55 | $obj = \AmeliaVendor\Stripe\Util\Util::convertToStripeObject($response->json, $opts); |
| 56 | $obj->setLastResponse($response); |
| 57 | return $obj; |
| 58 | } |
| 59 | /** |
| 60 | * You can also delete webhook endpoints via the <a |
| 61 | * href="https://dashboard.stripe.com/account/webhooks">webhook endpoint |
| 62 | * management</a> page of the Stripe dashboard. |
| 63 | * |
| 64 | * @param null|array $params |
| 65 | * @param null|array|string $opts |
| 66 | * |
| 67 | * @return WebhookEndpoint the deleted resource |
| 68 | * |
| 69 | * @throws Exception\ApiErrorException if the request fails |
| 70 | */ |
| 71 | public function delete($params = null, $opts = null) |
| 72 | { |
| 73 | self::_validateParams($params); |
| 74 | $url = $this->instanceUrl(); |
| 75 | list($response, $opts) = $this->_request('delete', $url, $params, $opts); |
| 76 | $this->refreshFrom($response, $opts); |
| 77 | return $this; |
| 78 | } |
| 79 | /** |
| 80 | * Returns a list of your webhook endpoints. |
| 81 | * |
| 82 | * @param null|array{ending_before?: string, expand?: string[], limit?: int, starting_after?: string} $params |
| 83 | * @param null|array|string $opts |
| 84 | * |
| 85 | * @return Collection<WebhookEndpoint> of ApiResources |
| 86 | * |
| 87 | * @throws Exception\ApiErrorException if the request fails |
| 88 | */ |
| 89 | public static function all($params = null, $opts = null) |
| 90 | { |
| 91 | $url = static::classUrl(); |
| 92 | return static::_requestPage($url, Collection::class, $params, $opts); |
| 93 | } |
| 94 | /** |
| 95 | * Retrieves the webhook endpoint with the given ID. |
| 96 | * |
| 97 | * @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key |
| 98 | * @param null|array|string $opts |
| 99 | * |
| 100 | * @return WebhookEndpoint |
| 101 | * |
| 102 | * @throws Exception\ApiErrorException if the request fails |
| 103 | */ |
| 104 | public static function retrieve($id, $opts = null) |
| 105 | { |
| 106 | $opts = \AmeliaVendor\Stripe\Util\RequestOptions::parse($opts); |
| 107 | $instance = new static($id, $opts); |
| 108 | $instance->refresh(); |
| 109 | return $instance; |
| 110 | } |
| 111 | /** |
| 112 | * Updates the webhook endpoint. You may edit the <code>url</code>, the list of |
| 113 | * <code>enabled_events</code>, and the status of your endpoint. |
| 114 | * |
| 115 | * @param string $id the ID of the resource to update |
| 116 | * @param null|array{description?: null|string, disabled?: bool, enabled_events?: string[], expand?: string[], metadata?: null|array<string, string>, url?: string} $params |
| 117 | * @param null|array|string $opts |
| 118 | * |
| 119 | * @return WebhookEndpoint the updated resource |
| 120 | * |
| 121 | * @throws Exception\ApiErrorException if the request fails |
| 122 | */ |
| 123 | public static function update($id, $params = null, $opts = null) |
| 124 | { |
| 125 | self::_validateParams($params); |
| 126 | $url = static::resourceUrl($id); |
| 127 | list($response, $opts) = static::_staticRequest('post', $url, $params, $opts); |
| 128 | $obj = \AmeliaVendor\Stripe\Util\Util::convertToStripeObject($response->json, $opts); |
| 129 | $obj->setLastResponse($response); |
| 130 | return $obj; |
| 131 | } |
| 132 | } |