Invoice.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <?php
  2. namespace Stripe;
  3. /**
  4. * Class Invoice
  5. *
  6. * @property string $id
  7. * @property string $object
  8. * @property int $amount_due
  9. * @property int $amount_paid
  10. * @property int $amount_remaining
  11. * @property int $application_fee
  12. * @property int $attempt_count
  13. * @property bool $auto_advance
  14. * @property bool $attempted
  15. * @property string $billing
  16. * @property string $billing_reason
  17. * @property string $charge
  18. * @property bool $closed
  19. * @property string $currency
  20. * @property string $customer
  21. * @property int $date
  22. * @property string $description
  23. * @property Discount $discount
  24. * @property int $due_date
  25. * @property int $ending_balance
  26. * @property bool $forgiven
  27. * @property string $hosted_invoice_url
  28. * @property string $invoice_pdf
  29. * @property Collection $lines
  30. * @property bool $livemode
  31. * @property StripeObject $metadata
  32. * @property int $next_payment_attempt
  33. * @property string $number
  34. * @property bool $paid
  35. * @property int $period_end
  36. * @property int $period_start
  37. * @property string $receipt_number
  38. * @property int $starting_balance
  39. * @property string $statement_descriptor
  40. * @property string $subscription
  41. * @property int $subscription_proration_date
  42. * @property int $subtotal
  43. * @property int $tax
  44. * @property float $tax_percent
  45. * @property int $total
  46. * @property int $webhooks_delivered_at
  47. *
  48. * @package Stripe
  49. */
  50. class Invoice extends ApiResource
  51. {
  52. const OBJECT_NAME = "invoice";
  53. use ApiOperations\All;
  54. use ApiOperations\Create;
  55. use ApiOperations\Retrieve;
  56. use ApiOperations\Update;
  57. /**
  58. * @param array|null $params
  59. * @param array|string|null $opts
  60. *
  61. * @return Invoice The upcoming invoice.
  62. */
  63. public static function upcoming($params = null, $opts = null)
  64. {
  65. $url = static::classUrl() . '/upcoming';
  66. list($response, $opts) = static::_staticRequest('get', $url, $params, $opts);
  67. $obj = Util\Util::convertToStripeObject($response->json, $opts);
  68. $obj->setLastResponse($response);
  69. return $obj;
  70. }
  71. /**
  72. * @return Invoice The paid invoice.
  73. */
  74. public function pay($params = null, $opts = null)
  75. {
  76. $url = $this->instanceUrl() . '/pay';
  77. list($response, $opts) = $this->_request('post', $url, $params, $opts);
  78. $this->refreshFrom($response, $opts);
  79. return $this;
  80. }
  81. }