Class: WhopSDK::Resources::Invoices
- Inherits:
-
Object
- Object
- WhopSDK::Resources::Invoices
- Defined in:
- lib/whop_sdk/resources/invoices.rb,
sig/whop_sdk/resources/invoices.rbs
Instance Method Summary collapse
- #`void` ⇒ Boolean
-
#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, product_id: 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.
268 269 270 |
# File 'lib/whop_sdk/resources/invoices.rb', line 268 def initialize(client:) @client = client end |
Instance Method Details
#`void` ⇒ Boolean
61 |
# File 'sig/whop_sdk/resources/invoices.rbs', line 61
def `void`: (String id, ?request_options: WhopSDK::request_opts) -> bool
|
#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
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/whop_sdk/resources/invoices.rb', line 22 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
183 184 185 186 187 188 189 190 |
# File 'lib/whop_sdk/resources/invoices.rb', line 183 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
155 156 157 158 159 160 161 162 163 164 165 166 |
# File 'lib/whop_sdk/resources/invoices.rb', line 155 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
207 208 209 210 211 212 213 214 |
# File 'lib/whop_sdk/resources/invoices.rb', line 207 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
231 232 233 234 235 236 237 238 |
# File 'lib/whop_sdk/resources/invoices.rb', line 231 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
48 49 50 51 52 53 54 55 |
# File 'lib/whop_sdk/resources/invoices.rb', line 48 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, product_id: 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
103 104 105 106 107 108 109 110 111 112 |
# File 'lib/whop_sdk/resources/invoices.rb', line 103 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
256 257 258 259 260 261 262 263 |
# File 'lib/whop_sdk/resources/invoices.rb', line 256 def void(id, params = {}) @client.request( method: :post, path: ["invoices/%1$s/void", id], model: WhopSDK::Internal::Type::Boolean, options: params[:request_options] ) end |