MeterEventAdjustment.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. // File generated from our OpenAPI spec
  3. namespace Stripe\Billing;
  4. /**
  5. * A billing meter event adjustment is a resource that allows you to cancel a meter event. For example, you might create a billing meter event adjustment to cancel a meter event that was created in error or attached to the wrong customer.
  6. *
  7. * @property string $object String representing the object's type. Objects of the same type share the same value.
  8. * @property null|\Stripe\StripeObject $cancel Specifies which event to cancel.
  9. * @property string $event_name The name of the meter event. Corresponds with the <code>event_name</code> field on a meter.
  10. * @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.
  11. * @property string $status The meter event adjustment's status.
  12. * @property string $type Specifies whether to cancel a single event or a range of events for a time period. Time period cancellation is not supported yet.
  13. */
  14. class MeterEventAdjustment extends \Stripe\ApiResource
  15. {
  16. const OBJECT_NAME = 'billing.meter_event_adjustment';
  17. const STATUS_COMPLETE = 'complete';
  18. const STATUS_PENDING = 'pending';
  19. /**
  20. * Creates a billing meter event adjustment.
  21. *
  22. * @param null|array $params
  23. * @param null|array|string $options
  24. *
  25. * @throws \Stripe\Exception\ApiErrorException if the request fails
  26. *
  27. * @return \Stripe\Billing\MeterEventAdjustment the created resource
  28. */
  29. public static function create($params = null, $options = null)
  30. {
  31. self::_validateParams($params);
  32. $url = static::classUrl();
  33. list($response, $opts) = static::_staticRequest('post', $url, $params, $options);
  34. $obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
  35. $obj->setLastResponse($response);
  36. return $obj;
  37. }
  38. }