Class: ApiReference::InvoiceApi
- Defined in:
- lib/api_reference/apis/invoice_api.rb
Overview
InvoiceApi
Constant Summary
Constants inherited from BaseApi
Instance Attribute Summary
Attributes inherited from BaseApi
Instance Method Summary collapse
-
#create_invoice(body) ⇒ ApiResponse
This endpoint is used to create a one-off invoice for a customer.
-
#create_invoice_line_item(body) ⇒ ApiResponse
This creates a one-off fixed fee invoice line item on an Invoice.
-
#delete_invoice_line_item(invoice_id, line_item_id) ⇒ ApiResponse
This endpoint deletes an invoice line item from a draft invoice.
-
#fetch_invoice(invoice_id) ⇒ ApiResponse
This endpoint is used to fetch an
Invoicegiven an identifier. -
#fetch_upcoming_invoice(subscription_id) ⇒ ApiResponse
This endpoint can be used to fetch the upcoming invoice for the current billing period given a subscription.
-
#issue_invoice(invoice_id, body: nil) ⇒ ApiResponse
This endpoint allows an eligible invoice to be issued manually.
-
#issue_invoice_summary(invoice_id, body: nil) ⇒ ApiResponse
This endpoint allows an eligible invoice to be issued manually.
-
#list_invoices(customer_id: nil, external_customer_id: nil, subscription_id: nil, status: nil, due_date_window: nil, date_type: DateType::INVOICE_DATE, due_date: nil, due_date_gt: nil, due_date_lt: nil, amount: nil, amount_gt: nil, amount_lt: nil, is_recurring: nil, limit: 20, cursor: nil, invoice_date_gte: nil, invoice_date_gt: nil, invoice_date_lt: nil, invoice_date_lte: nil) ⇒ ApiResponse
This endpoint returns a list of all
Invoices for an account in a list format. -
#list_invoices_summary(customer_id: nil, external_customer_id: nil, subscription_id: nil, status: nil, due_date_window: nil, date_type: DateType::INVOICE_DATE, due_date: nil, due_date_gt: nil, due_date_lt: nil, amount: nil, amount_gt: nil, amount_lt: nil, is_recurring: nil, limit: 20, cursor: nil, invoice_date_gte: nil, invoice_date_gt: nil, invoice_date_lt: nil, invoice_date_lte: nil) ⇒ ApiResponse
This is a lighter-weight endpoint that returns a list of all
Invoicesummaries for an account in a list format. -
#mark_invoice_as_paid(invoice_id, body) ⇒ ApiResponse
This endpoint allows an invoice's status to be set to the
paidstatus. -
#pay_invoice(invoice_id, body: nil) ⇒ ApiResponse
This endpoint collects payment for an invoice.
-
#regenerate_invoice_pdf(invoice_id) ⇒ ApiResponse
This endpoint triggers a regeneration of the PDF for a finalized invoice.
-
#regenerate_receipt_pdf(invoice_id) ⇒ ApiResponse
This endpoint triggers a regeneration of the receipt PDF for a paid invoice.
-
#update_invoice(invoice_id, body) ⇒ ApiResponse
This endpoint allows you to update the
metadata,net_terms,due_date,invoice_date, andauto_collectionproperties on an invoice. -
#void_invoice(invoice_id) ⇒ ApiResponse
This endpoint allows an invoice's status to be set to the
voidstatus.
Methods inherited from BaseApi
#initialize, #new_parameter, #new_request_builder, #new_response_handler, user_agent, user_agent_parameters
Constructor Details
This class inherits a constructor from ApiReference::BaseApi
Instance Method Details
#create_invoice(body) ⇒ ApiResponse
This endpoint is used to create a one-off invoice for a customer. description here
192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 |
# File 'lib/api_reference/apis/invoice_api.rb', line 192 def create_invoice(body) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/invoices', Server::DEFAULT) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body) .is_required(true)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('APIKeyAuth'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(Invoice.method(:from_hash)) .is_api_response(true) .local_error('400', 'Bad Request', APIException) .local_error('401', 'Unauthorized', AuthorizationErrorException) .local_error('404', 'Not Found', APIException) .local_error('409', 'Conflict', IdempotencyRequestMismatchException) .local_error('413', 'Content Too Large', APIException) .local_error('429', 'Too Many Requests', TooManyRequestsException) .local_error('500', 'Internal Server Error', ServerErrorException)) .execute end |
#create_invoice_line_item(body) ⇒ ApiResponse
This creates a one-off fixed fee invoice line item on an Invoice.
This can only be done for invoices that are in a draft status.
The behavior depends on which parameters are provided:
- If
item_idis provided withoutname: The item is looked up by ID, and the item's name is used for the line item. - If
nameis provided withoutitem_id: An item with the given name is searched for in the account. If found, that item is used. If not found, a new item is created with that name. The new item's name is used for the line item. - If both
item_idandnameare provided: The item is looked up by ID for association, but the providednameis used for the line item (not the item's name). description here
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/api_reference/apis/invoice_api.rb', line 26 def create_invoice_line_item(body) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/invoice_line_items', Server::DEFAULT) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body) .is_required(true)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('APIKeyAuth'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(InvoiceLineItem.method(:from_hash)) .is_api_response(true) .local_error('400', 'Bad Request', APIException) .local_error('401', 'Unauthorized', AuthorizationErrorException) .local_error('404', 'Not Found', APIException) .local_error('409', 'Conflict', IdempotencyRequestMismatchException) .local_error('413', 'Content Too Large', APIException) .local_error('429', 'Too Many Requests', TooManyRequestsException) .local_error('500', 'Internal Server Error', ServerErrorException)) .execute end |
#delete_invoice_line_item(invoice_id, line_item_id) ⇒ ApiResponse
This endpoint deletes an invoice line item from a draft invoice. This endpoint only allows deletion of one-off line items (not subscription-based line items). The invoice must be in a draft status for this operation to succeed. here here
561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 |
# File 'lib/api_reference/apis/invoice_api.rb', line 561 def delete_invoice_line_item(invoice_id, line_item_id) @api_call .request(new_request_builder(HttpMethodEnum::DELETE, '/invoices/{invoice_id}/invoice_line_items/{line_item_id}', Server::DEFAULT) .template_param(new_parameter(invoice_id, key: 'invoice_id') .is_required(true) .should_encode(true)) .template_param(new_parameter(line_item_id, key: 'line_item_id') .is_required(true) .should_encode(true)) .auth(Single.new('APIKeyAuth'))) .response(new_response_handler .is_response_void(true) .is_api_response(true) .local_error('400', 'Bad Request', APIException) .local_error('401', 'Unauthorized', AuthorizationErrorException) .local_error('404', 'Not Found', APIException) .local_error('409', 'Conflict', IdempotencyRequestMismatchException) .local_error('413', 'Content Too Large', APIException) .local_error('429', 'Too Many Requests', TooManyRequestsException) .local_error('500', 'Internal Server Error', ServerErrorException)) .execute end |
#fetch_invoice(invoice_id) ⇒ ApiResponse
This endpoint is used to fetch an Invoice
given an identifier.
here
458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 |
# File 'lib/api_reference/apis/invoice_api.rb', line 458 def fetch_invoice(invoice_id) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/invoices/{invoice_id}', Server::DEFAULT) .template_param(new_parameter(invoice_id, key: 'invoice_id') .is_required(true) .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('APIKeyAuth'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(Invoice.method(:from_hash)) .is_api_response(true) .local_error('400', 'Bad Request', APIException) .local_error('401', 'Unauthorized', AuthorizationErrorException) .local_error('404', 'Not Found', APIException) .local_error('409', 'Conflict', IdempotencyRequestMismatchException) .local_error('413', 'Content Too Large', APIException) .local_error('429', 'Too Many Requests', TooManyRequestsException) .local_error('500', 'Internal Server Error', ServerErrorException)) .execute end |
#fetch_upcoming_invoice(subscription_id) ⇒ ApiResponse
This endpoint can be used to fetch the upcoming invoice for the current billing period given a subscription. here
416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 |
# File 'lib/api_reference/apis/invoice_api.rb', line 416 def fetch_upcoming_invoice(subscription_id) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/invoices/upcoming', Server::DEFAULT) .query_param(new_parameter(subscription_id, key: 'subscription_id') .is_required(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('APIKeyAuth'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(UpcomingInvoice.method(:from_hash)) .is_api_response(true) .local_error('400', 'Bad Request', APIException) .local_error('401', 'Unauthorized', AuthorizationErrorException) .local_error('404', 'Not Found', APIException) .local_error('409', 'Conflict', IdempotencyRequestMismatchException) .local_error('413', 'Content Too Large', APIException) .local_error('429', 'Too Many Requests', TooManyRequestsException) .local_error('500', 'Internal Server Error', ServerErrorException)) .execute end |
#issue_invoice(invoice_id, body: nil) ⇒ ApiResponse
This endpoint allows an eligible invoice to be issued manually. This is
only possible with invoices where status is draft,
will_auto_issue is false, and an eligible_to_issue_at is a time in the
past. Issuing an invoice could possibly trigger
side effects, some of which could be customer-visible (e.g. sending
emails, auto-collecting payment,
syncing the invoice to external providers, etc).
here
description here
613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 |
# File 'lib/api_reference/apis/invoice_api.rb', line 613 def issue_invoice(invoice_id, body: nil) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/invoices/{invoice_id}/issue', Server::DEFAULT) .template_param(new_parameter(invoice_id, key: 'invoice_id') .is_required(true) .should_encode(true)) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('APIKeyAuth'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(Invoice.method(:from_hash)) .is_api_response(true) .local_error('400', 'Bad Request', APIException) .local_error('401', 'Unauthorized', AuthorizationErrorException) .local_error('404', 'Not Found', APIException) .local_error('409', 'Conflict', IdempotencyRequestMismatchException) .local_error('413', 'Content Too Large', APIException) .local_error('429', 'Too Many Requests', TooManyRequestsException) .local_error('500', 'Internal Server Error', ServerErrorException)) .execute end |
#issue_invoice_summary(invoice_id, body: nil) ⇒ ApiResponse
This endpoint allows an eligible invoice to be issued manually. This is
only possible with invoices where status is draft,
will_auto_issue is false, and an eligible_to_issue_at is a time in the
past. Issuing an invoice could possibly trigger
side effects, some of which could be customer-visible (e.g. sending
emails, auto-collecting payment,
syncing the invoice to external providers, etc).
This is a lighter-weight alternative to the issue invoice endpoint,
returning an invoice summary without any line item details.
here
description here
368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 |
# File 'lib/api_reference/apis/invoice_api.rb', line 368 def issue_invoice_summary(invoice_id, body: nil) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/invoices/summary/{invoice_id}/issue', Server::DEFAULT) .template_param(new_parameter(invoice_id, key: 'invoice_id') .is_required(true) .should_encode(true)) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('APIKeyAuth'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(InvoiceSummary.method(:from_hash)) .is_api_response(true) .local_error('400', 'Bad Request', APIException) .local_error('401', 'Unauthorized', AuthorizationErrorException) .local_error('404', 'Not Found', APIException) .local_error('409', 'Conflict', IdempotencyRequestMismatchException) .local_error('413', 'Content Too Large', APIException) .local_error('429', 'Too Many Requests', TooManyRequestsException) .local_error('500', 'Internal Server Error', ServerErrorException)) .execute end |
#list_invoices(customer_id: nil, external_customer_id: nil, subscription_id: nil, status: nil, due_date_window: nil, date_type: DateType::INVOICE_DATE, due_date: nil, due_date_gt: nil, due_date_lt: nil, amount: nil, amount_gt: nil, amount_lt: nil, is_recurring: nil, limit: 20, cursor: nil, invoice_date_gte: nil, invoice_date_gt: nil, invoice_date_lt: nil, invoice_date_lte: nil) ⇒ ApiResponse
This endpoint returns a list of all Invoices
for an account in a list format.
The list of invoices is ordered starting from the most recently issued
invoice date. The response also includes
pagination_metadata, which lets the caller
retrieve the next page of results if they
exist.
By default, this only returns invoices that are issued, paid, or
synced.
When fetching any draft invoices, this returns the last-computed invoice
values for each draft invoice, which may
not always be up-to-date since Orb regularly refreshes invoices
asynchronously.
If you don't need line item details, minimums, maximums, or discounts,
prefer the
list invoices summary
endpoint for better performance.
here
description here
here
here
here
here
here
here
here
type description here
description here
description here
description here
description here
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 |
# File 'lib/api_reference/apis/invoice_api.rb', line 116 def list_invoices(customer_id: nil, external_customer_id: nil, subscription_id: nil, status: nil, due_date_window: nil, date_type: DateType::INVOICE_DATE, due_date: nil, due_date_gt: nil, due_date_lt: nil, amount: nil, amount_gt: nil, amount_lt: nil, is_recurring: nil, limit: 20, cursor: nil, invoice_date_gte: nil, invoice_date_gt: nil, invoice_date_lt: nil, invoice_date_lte: nil) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/invoices', Server::DEFAULT) .query_param(new_parameter(customer_id, key: 'customer_id')) .query_param(new_parameter(external_customer_id, key: 'external_customer_id')) .query_param(new_parameter(subscription_id, key: 'subscription_id')) .query_param(new_parameter(status, key: 'status[]')) .query_param(new_parameter(due_date_window, key: 'due_date_window')) .query_param(new_parameter(date_type, key: 'date_type')) .query_param(new_parameter(due_date, key: 'due_date')) .query_param(new_parameter(due_date_gt, key: 'due_date[gt]')) .query_param(new_parameter(due_date_lt, key: 'due_date[lt]')) .query_param(new_parameter(amount, key: 'amount')) .query_param(new_parameter(amount_gt, key: 'amount[gt]')) .query_param(new_parameter(amount_lt, key: 'amount[lt]')) .query_param(new_parameter(is_recurring, key: 'is_recurring')) .query_param(new_parameter(limit, key: 'limit')) .query_param(new_parameter(cursor, key: 'cursor')) .query_param(new_parameter(invoice_date_gte, key: 'invoice_date[gte]')) .query_param(new_parameter(invoice_date_gt, key: 'invoice_date[gt]')) .query_param(new_parameter(invoice_date_lt, key: 'invoice_date[lt]')) .query_param(new_parameter(invoice_date_lte, key: 'invoice_date[lte]')) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('APIKeyAuth'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(Invoices.method(:from_hash)) .is_api_response(true) .local_error('400', 'Bad Request', APIException) .local_error('401', 'Unauthorized', AuthorizationErrorException) .local_error('404', 'Not Found', APIException) .local_error('409', 'Conflict', IdempotencyRequestMismatchException) .local_error('413', 'Content Too Large', APIException) .local_error('429', 'Too Many Requests', TooManyRequestsException) .local_error('500', 'Internal Server Error', ServerErrorException)) .execute end |
#list_invoices_summary(customer_id: nil, external_customer_id: nil, subscription_id: nil, status: nil, due_date_window: nil, date_type: DateType::INVOICE_DATE, due_date: nil, due_date_gt: nil, due_date_lt: nil, amount: nil, amount_gt: nil, amount_lt: nil, is_recurring: nil, limit: 20, cursor: nil, invoice_date_gte: nil, invoice_date_gt: nil, invoice_date_lt: nil, invoice_date_lte: nil) ⇒ ApiResponse
This is a lighter-weight endpoint that returns a list of all
Invoice summaries for an account in a
list format.
These invoice summaries do not include line item details, minimums,
maximums, and discounts, making this endpoint more
efficient.
The list of invoices is ordered starting from the most recently issued
invoice date. The response also includes
pagination_metadata, which lets the caller
retrieve the next page of results if they
exist.
By default, this only returns invoices that are issued, paid, or
synced.
When fetching any draft invoices, this returns the last-computed invoice
values for each draft invoice, which may
not always be up-to-date since Orb regularly refreshes invoices
asynchronously.
here
description here
here
here
here
here
here
here
here
type description here
description here
description here
description here
description here
282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 |
# File 'lib/api_reference/apis/invoice_api.rb', line 282 def list_invoices_summary(customer_id: nil, external_customer_id: nil, subscription_id: nil, status: nil, due_date_window: nil, date_type: DateType::INVOICE_DATE, due_date: nil, due_date_gt: nil, due_date_lt: nil, amount: nil, amount_gt: nil, amount_lt: nil, is_recurring: nil, limit: 20, cursor: nil, invoice_date_gte: nil, invoice_date_gt: nil, invoice_date_lt: nil, invoice_date_lte: nil) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/invoices/summary', Server::DEFAULT) .query_param(new_parameter(customer_id, key: 'customer_id')) .query_param(new_parameter(external_customer_id, key: 'external_customer_id')) .query_param(new_parameter(subscription_id, key: 'subscription_id')) .query_param(new_parameter(status, key: 'status[]')) .query_param(new_parameter(due_date_window, key: 'due_date_window')) .query_param(new_parameter(date_type, key: 'date_type')) .query_param(new_parameter(due_date, key: 'due_date')) .query_param(new_parameter(due_date_gt, key: 'due_date[gt]')) .query_param(new_parameter(due_date_lt, key: 'due_date[lt]')) .query_param(new_parameter(amount, key: 'amount')) .query_param(new_parameter(amount_gt, key: 'amount[gt]')) .query_param(new_parameter(amount_lt, key: 'amount[lt]')) .query_param(new_parameter(is_recurring, key: 'is_recurring')) .query_param(new_parameter(limit, key: 'limit')) .query_param(new_parameter(cursor, key: 'cursor')) .query_param(new_parameter(invoice_date_gte, key: 'invoice_date[gte]')) .query_param(new_parameter(invoice_date_gt, key: 'invoice_date[gt]')) .query_param(new_parameter(invoice_date_lt, key: 'invoice_date[lt]')) .query_param(new_parameter(invoice_date_lte, key: 'invoice_date[lte]')) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('APIKeyAuth'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(InvoiceSummarys.method(:from_hash)) .is_api_response(true) .local_error('400', 'Bad Request', APIException) .local_error('401', 'Unauthorized', AuthorizationErrorException) .local_error('404', 'Not Found', APIException) .local_error('409', 'Conflict', IdempotencyRequestMismatchException) .local_error('413', 'Content Too Large', APIException) .local_error('429', 'Too Many Requests', TooManyRequestsException) .local_error('500', 'Internal Server Error', ServerErrorException)) .execute end |
#mark_invoice_as_paid(invoice_id, body) ⇒ ApiResponse
This endpoint allows an invoice's status to be set to the paid status.
This can only be done to invoices that are in
the issued or synced status.
here
description here
663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 |
# File 'lib/api_reference/apis/invoice_api.rb', line 663 def mark_invoice_as_paid(invoice_id, body) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/invoices/{invoice_id}/mark_paid', Server::DEFAULT) .template_param(new_parameter(invoice_id, key: 'invoice_id') .is_required(true) .should_encode(true)) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body) .is_required(true)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('APIKeyAuth'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(Invoice.method(:from_hash)) .is_api_response(true) .local_error('400', 'Bad Request', APIException) .local_error('401', 'Unauthorized', AuthorizationErrorException) .local_error('404', 'Not Found', APIException) .local_error('409', 'Conflict', IdempotencyRequestMismatchException) .local_error('413', 'Content Too Large', APIException) .local_error('429', 'Too Many Requests', TooManyRequestsException) .local_error('500', 'Internal Server Error', ServerErrorException)) .execute end |
#pay_invoice(invoice_id, body: nil) ⇒ ApiResponse
This endpoint collects payment for an invoice. By default, it uses the customer's default payment method. Optionally, a shared payment token (SPT) can be provided to pay using agent-granted credentials instead. This action can only be taken on invoices with status "issued". here here
716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 |
# File 'lib/api_reference/apis/invoice_api.rb', line 716 def pay_invoice(invoice_id, body: nil) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/invoices/{invoice_id}/pay', Server::DEFAULT) .template_param(new_parameter(invoice_id, key: 'invoice_id') .is_required(true) .should_encode(true)) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('APIKeyAuth'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(Invoice.method(:from_hash)) .is_api_response(true) .local_error('400', 'Bad Request', APIException) .local_error('401', 'Unauthorized', AuthorizationErrorException) .local_error('404', 'Not Found', APIException) .local_error('409', 'Conflict', IdempotencyRequestMismatchException) .local_error('413', 'Content Too Large', APIException) .local_error('429', 'Too Many Requests', TooManyRequestsException) .local_error('500', 'Internal Server Error', ServerErrorException)) .execute end |
#regenerate_invoice_pdf(invoice_id) ⇒ ApiResponse
This endpoint triggers a regeneration of the PDF for a finalized invoice.
The invoice must be finalized (issued, paid, synced, or void) and
must already have an
existing PDF. The original PDF is archived (not permanently deleted) to
maintain an audit trail.
Important Legal Considerations:
Regenerating invoice PDFs may not be permitted in all jurisdictions. Many
tax authorities require
that issued invoices remain unmodified. Before using this endpoint, ensure
that:
- Your local tax regulations permit modification of issued billing documents
- You have a legitimate business reason (e.g., fixing template errors, updating branding)
- You maintain proper records of the original PDF (archived automatically by Orb) Recommended use cases:
- Correcting template rendering issues
- Applying updated company branding
- Updating customer data that was incorrect at issuance here
781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 |
# File 'lib/api_reference/apis/invoice_api.rb', line 781 def regenerate_invoice_pdf(invoice_id) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/invoices/{invoice_id}/regenerate_invoice_pdf', Server::DEFAULT) .template_param(new_parameter(invoice_id, key: 'invoice_id') .is_required(true) .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('APIKeyAuth'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(Invoice.method(:from_hash)) .is_api_response(true) .local_error('400', 'Bad Request', APIException) .local_error('401', 'Unauthorized', AuthorizationErrorException) .local_error('404', 'Not Found', APIException) .local_error('409', 'Conflict', IdempotencyRequestMismatchException) .local_error('413', 'Content Too Large', APIException) .local_error('429', 'Too Many Requests', TooManyRequestsException) .local_error('500', 'Internal Server Error', ServerErrorException)) .execute end |
#regenerate_receipt_pdf(invoice_id) ⇒ ApiResponse
This endpoint triggers a regeneration of the receipt PDF for a paid
invoice.
The invoice must be in paid status and must already have an existing
receipt PDF.
The original PDF is archived (not permanently deleted) to maintain an
audit trail.
Important Legal Considerations:
Regenerating receipt PDFs may not be permitted in all jurisdictions. Many
tax authorities require
that issued receipts remain unmodified. Before using this endpoint, ensure
that:
- Your local tax regulations permit modification of issued billing documents
- You have a legitimate business reason (e.g., fixing template errors, updating branding)
- You maintain proper records of the original PDF (archived automatically by Orb) Recommended use cases:
- Correcting template rendering issues
- Applying updated company branding
- Updating customer data that was incorrect at issuance here
843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 |
# File 'lib/api_reference/apis/invoice_api.rb', line 843 def regenerate_receipt_pdf(invoice_id) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/invoices/{invoice_id}/regenerate_receipt_pdf', Server::DEFAULT) .template_param(new_parameter(invoice_id, key: 'invoice_id') .is_required(true) .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('APIKeyAuth'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(Invoice.method(:from_hash)) .is_api_response(true) .local_error('400', 'Bad Request', APIException) .local_error('401', 'Unauthorized', AuthorizationErrorException) .local_error('404', 'Not Found', APIException) .local_error('409', 'Conflict', IdempotencyRequestMismatchException) .local_error('413', 'Content Too Large', APIException) .local_error('429', 'Too Many Requests', TooManyRequestsException) .local_error('500', 'Internal Server Error', ServerErrorException)) .execute end |
#update_invoice(invoice_id, body) ⇒ ApiResponse
This endpoint allows you to update the metadata, net_terms,
due_date, invoice_date, and auto_collection
properties on an invoice. If you pass null for the metadata value, it will
clear any existing metadata for that invoice.
metadata can be modified regardless of invoice state.
net_terms, due_date, invoice_date, and auto_collection can only be
modified if the invoice is in a draft state.
invoice_date can only be modified for non-subscription invoices.
here
description here
509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 |
# File 'lib/api_reference/apis/invoice_api.rb', line 509 def update_invoice(invoice_id, body) @api_call .request(new_request_builder(HttpMethodEnum::PUT, '/invoices/{invoice_id}', Server::DEFAULT) .template_param(new_parameter(invoice_id, key: 'invoice_id') .is_required(true) .should_encode(true)) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body) .is_required(true)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('APIKeyAuth'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(Invoice.method(:from_hash)) .is_api_response(true) .local_error('400', 'Bad Request', APIException) .local_error('401', 'Unauthorized', AuthorizationErrorException) .local_error('404', 'Not Found', APIException) .local_error('409', 'Conflict', IdempotencyRequestMismatchException) .local_error('413', 'Content Too Large', APIException) .local_error('429', 'Too Many Requests', TooManyRequestsException) .local_error('500', 'Internal Server Error', ServerErrorException)) .execute end |
#void_invoice(invoice_id) ⇒ ApiResponse
This endpoint allows an invoice's status to be set to the void status.
This can only be done to invoices that are in
the issued status.
If the associated invoice has used the customer balance to change the
amount due, the customer balance operation
will be reverted. For example, if the invoice used $10 of customer
balance, that amount will be added back to the
customer balance upon voiding.
If the invoice was used to purchase a credit block, but the invoice is not
yet paid, the credit block will be voided. If the
invoice was created due to a top-up, the top-up will be disabled.
here
895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 |
# File 'lib/api_reference/apis/invoice_api.rb', line 895 def void_invoice(invoice_id) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/invoices/{invoice_id}/void', Server::DEFAULT) .template_param(new_parameter(invoice_id, key: 'invoice_id') .is_required(true) .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('APIKeyAuth'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(Invoice.method(:from_hash)) .is_api_response(true) .local_error('400', 'Bad Request', APIException) .local_error('401', 'Unauthorized', AuthorizationErrorException) .local_error('404', 'Not Found', APIException) .local_error('409', 'Conflict', IdempotencyRequestMismatchException) .local_error('413', 'Content Too Large', APIException) .local_error('429', 'Too Many Requests', TooManyRequestsException) .local_error('500', 'Internal Server Error', ServerErrorException)) .execute end |