Class: WhopSDK::Resources::Invoices
- Inherits:
-
Object
- Object
- WhopSDK::Resources::Invoices
- Defined in:
- lib/whop_sdk/resources/invoices.rb
Overview
Invoices
Instance Method Summary collapse
-
#create(body:, request_options: {}) ⇒ WhopSDK::Models::Invoice
Create an invoice for a customer.
-
#delete(id, request_options: {}) ⇒ Boolean
Delete a draft invoice.
-
#initialize(client:) ⇒ Invoices
constructor
private
A new instance of Invoices.
-
#list(after: nil, before: nil, collection_methods: nil, company_id: nil, created_after: nil, created_before: nil, direction: nil, first: nil, last: nil, order: nil, product_ids: nil, statuses: nil, request_options: {}) ⇒ WhopSDK::Internal::CursorPage<WhopSDK::Models::InvoiceListItem>
Some parameter documentations has been truncated, see Models::InvoiceListParams for more details.
-
#mark_paid(id, request_options: {}) ⇒ Boolean
Mark an open invoice as paid when payment was collected outside of Whop.
-
#mark_uncollectible(id, request_options: {}) ⇒ Boolean
Mark an open invoice as uncollectible when payment is not expected.
-
#retrieve(id, request_options: {}) ⇒ WhopSDK::Models::Invoice
Retrieves the details of an existing invoice.
-
#update(id, automatically_finalizes_at: nil, billing_address: nil, charge_buyer_fee: nil, collection_method: nil, customer_name: nil, due_date: nil, email_address: nil, line_items: nil, mailing_address_id: nil, member_id: nil, payment_method_id: nil, plan: nil, subscription_billing_anchor_at: nil, request_options: {}) ⇒ WhopSDK::Models::Invoice
Some parameter documentations has been truncated, see Models::InvoiceUpdateParams for more details.
-
#void(id, request_options: {}) ⇒ Boolean
Void an open invoice so it can no longer be paid.
Constructor Details
#initialize(client:) ⇒ Invoices
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Invoices.
267 268 269 |
# File 'lib/whop_sdk/resources/invoices.rb', line 267 def initialize(client:) @client = client end |
Instance Method Details
#create(body:, request_options: {}) ⇒ WhopSDK::Models::Invoice
Create an invoice for a customer. The invoice can be charged automatically using a stored payment method, or sent to the customer for manual payment.
Required permissions:
-
‘invoice:create`
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/whop_sdk/resources/invoices.rb', line 23 def create(params) parsed, = WhopSDK::InvoiceCreateParams.dump_request(params) @client.request( method: :post, path: "invoices", body: parsed[:body], model: WhopSDK::Invoice, options: ) end |
#delete(id, request_options: {}) ⇒ Boolean
Delete a draft invoice.
Required permissions:
-
‘invoice:update`
182 183 184 185 186 187 188 189 |
# File 'lib/whop_sdk/resources/invoices.rb', line 182 def delete(id, params = {}) @client.request( method: :delete, path: ["invoices/%1$s", id], model: WhopSDK::Internal::Type::Boolean, options: params[:request_options] ) end |
#list(after: nil, before: nil, collection_methods: nil, company_id: nil, created_after: nil, created_before: nil, direction: nil, first: nil, last: nil, order: nil, product_ids: nil, statuses: nil, request_options: {}) ⇒ WhopSDK::Internal::CursorPage<WhopSDK::Models::InvoiceListItem>
Some parameter documentations has been truncated, see Models::InvoiceListParams for more details.
Returns a paginated list of invoices for a company, with optional filtering by product, status, collection method, and creation date.
Required permissions:
-
‘invoice:basic:read`
154 155 156 157 158 159 160 161 162 163 164 165 |
# File 'lib/whop_sdk/resources/invoices.rb', line 154 def list(params = {}) parsed, = WhopSDK::InvoiceListParams.dump_request(params) query = WhopSDK::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "invoices", query: query, page: WhopSDK::Internal::CursorPage, model: WhopSDK::InvoiceListItem, options: ) end |
#mark_paid(id, request_options: {}) ⇒ Boolean
Mark an open invoice as paid when payment was collected outside of Whop.
Required permissions:
-
‘invoice:update`
206 207 208 209 210 211 212 213 |
# File 'lib/whop_sdk/resources/invoices.rb', line 206 def mark_paid(id, params = {}) @client.request( method: :post, path: ["invoices/%1$s/mark_paid", id], model: WhopSDK::Internal::Type::Boolean, options: params[:request_options] ) end |
#mark_uncollectible(id, request_options: {}) ⇒ Boolean
Mark an open invoice as uncollectible when payment is not expected.
Required permissions:
-
‘invoice:update`
230 231 232 233 234 235 236 237 |
# File 'lib/whop_sdk/resources/invoices.rb', line 230 def mark_uncollectible(id, params = {}) @client.request( method: :post, path: ["invoices/%1$s/mark_uncollectible", id], model: WhopSDK::Internal::Type::Boolean, options: params[:request_options] ) end |
#retrieve(id, request_options: {}) ⇒ WhopSDK::Models::Invoice
Retrieves the details of an existing invoice.
Required permissions:
-
‘invoice:basic:read`
49 50 51 52 53 54 55 56 |
# File 'lib/whop_sdk/resources/invoices.rb', line 49 def retrieve(id, params = {}) @client.request( method: :get, path: ["invoices/%1$s", id], model: WhopSDK::Invoice, options: params[:request_options] ) end |
#update(id, automatically_finalizes_at: nil, billing_address: nil, charge_buyer_fee: nil, collection_method: nil, customer_name: nil, due_date: nil, email_address: nil, line_items: nil, mailing_address_id: nil, member_id: nil, payment_method_id: nil, plan: nil, subscription_billing_anchor_at: nil, request_options: {}) ⇒ WhopSDK::Models::Invoice
Some parameter documentations has been truncated, see Models::InvoiceUpdateParams for more details.
Update a draft invoice’s details.
Required permissions:
-
‘invoice:update`
102 103 104 105 106 107 108 109 110 111 |
# File 'lib/whop_sdk/resources/invoices.rb', line 102 def update(id, params = {}) parsed, = WhopSDK::InvoiceUpdateParams.dump_request(params) @client.request( method: :patch, path: ["invoices/%1$s", id], body: parsed, model: WhopSDK::Invoice, options: ) end |
#void(id, request_options: {}) ⇒ Boolean
Void an open invoice so it can no longer be paid. Voiding is permanent and cannot be undone.
Required permissions:
-
‘invoice:update`
255 256 257 258 259 260 261 262 |
# File 'lib/whop_sdk/resources/invoices.rb', line 255 def void(id, params = {}) @client.request( method: :post, path: ["invoices/%1$s/void", id], model: WhopSDK::Internal::Type::Boolean, options: params[:request_options] ) end |