Order.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. namespace Stripe;
  3. /**
  4. * Class Order
  5. *
  6. * @property string $id
  7. * @property string $object
  8. * @property int $amount
  9. * @property int $amount_returned
  10. * @property string $application
  11. * @property int $application_fee
  12. * @property string $charge
  13. * @property int $created
  14. * @property string $currency
  15. * @property string $customer
  16. * @property string $email
  17. * @property string $external_coupon_code
  18. * @property OrderItem[] $items
  19. * @property bool $livemode
  20. * @property StripeObject $metadata
  21. * @property Collection $returns
  22. * @property string $selected_shipping_method
  23. * @property mixed $shipping
  24. * @property mixed $shipping_methods
  25. * @property string $status
  26. * @property mixed $status_transitions
  27. * @property int $updated
  28. * @property string $upstream_id
  29. *
  30. * @package Stripe
  31. */
  32. class Order extends ApiResource
  33. {
  34. const OBJECT_NAME = "order";
  35. use ApiOperations\All;
  36. use ApiOperations\Create;
  37. use ApiOperations\Retrieve;
  38. use ApiOperations\Update;
  39. /**
  40. * @return Order The paid order.
  41. */
  42. public function pay($params = null, $opts = null)
  43. {
  44. $url = $this->instanceUrl() . '/pay';
  45. list($response, $opts) = $this->_request('post', $url, $params, $opts);
  46. $this->refreshFrom($response, $opts);
  47. return $this;
  48. }
  49. /**
  50. * @return OrderReturn The newly created return.
  51. */
  52. public function returnOrder($params = null, $opts = null)
  53. {
  54. $url = $this->instanceUrl() . '/returns';
  55. list($response, $opts) = $this->_request('post', $url, $params, $opts);
  56. return Util\Util::convertToStripeObject($response, $opts);
  57. }
  58. }