Class: Peddler::APIs::FinancesInvoices20260625

Inherits:
Peddler::API
  • Object
show all
Defined in:
lib/peddler/apis/finances_invoices_2026_06_25.rb,
lib/peddler/apis/finances_invoices_2026_06_25/error.rb,
lib/peddler/apis/finances_invoices_2026_06_25/breakdown.rb,
lib/peddler/apis/finances_invoices_2026_06_25/error_list.rb,
lib/peddler/apis/finances_invoices_2026_06_25/invoice_item.rb,
lib/peddler/apis/finances_invoices_2026_06_25/billing_period.rb,
lib/peddler/apis/finances_invoices_2026_06_25/invoice_header.rb,
lib/peddler/apis/finances_invoices_2026_06_25/item_identifier.rb,
lib/peddler/apis/finances_invoices_2026_06_25/variance_reason.rb,
lib/peddler/apis/finances_invoices_2026_06_25/matching_context.rb,
lib/peddler/apis/finances_invoices_2026_06_25/partner_metadata.rb,
lib/peddler/apis/finances_invoices_2026_06_25/line_item_context.rb,
lib/peddler/apis/finances_invoices_2026_06_25/related_identifier.rb,
lib/peddler/apis/finances_invoices_2026_06_25/get_invoice_response.rb,
lib/peddler/apis/finances_invoices_2026_06_25/get_invoices_response.rb,
lib/peddler/apis/finances_invoices_2026_06_25/service_charge_period.rb,
sig/peddler/apis/finances_invoices_2026_06_25.rbs

Overview

The Selling Partner API for Invoices

The Selling Partner API for Invoices enables you to retrieve invoice data and streamline your bookkeeping processes.

Defined Under Namespace

Classes: BillingPeriod, Breakdown, Error, ErrorList, GetInvoiceResponse, GetInvoicesResponse, InvoiceHeader, InvoiceItem, ItemIdentifier, LineItemContext, MatchingContext, PartnerMetadata, RelatedIdentifier, ServiceChargePeriod, VarianceReason

Constant Summary

Constants inherited from Peddler::API

Peddler::API::TRANSIENT_STATUSES

Instance Attribute Summary

Attributes inherited from Peddler::API

#access_token, #base_url, #endpoint, #retries

Instance Method Summary collapse

Methods inherited from Peddler::API

#cannot_sandbox!, #delete, #endpoint_uri, #get, #host_header, #http, #initialize, #must_sandbox!, #parse_base_url, #patch, #percent_encode, #post, #put, #request, #sandbox, #sandbox?, #stringify_array, #timestamp, #user_agent

Constructor Details

This class inherits a constructor from Peddler::API

Instance Method Details

#get_invoice(marketplace_id, invoice_identifier, next_token_for_line_items: nil) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Returns invoice details, including header and line items, for the specified invoice.

Parameters:

  • marketplace_id (String)

    The marketplace ID of the marketplace of the invoice. The marketplace ID is a globally unique identifier used to specify an Amazon marketplace. For more information, refer to Marketplace IDs.

  • invoice_identifier (String)

    The unique identifier for an invoice. This field is also returned as part of the InvoiceHeader element in the response. For AP-Inventory invoices the identifier is formatted as InvoiceNumber~PayeeCode.

  • next_token_for_line_items (String) (defaults to: nil)

    The response includes nextTokenForLineItems when the number of line items exceeds the default page size (600). To get the next page of line items, call the operation with this token, including the same request parameters as the call that generated the token.

  • (String)
  • (String)
  • next_token_for_line_items: (String, nil) (defaults to: nil)

Returns:



63
64
65
66
67
68
69
70
71
# File 'lib/peddler/apis/finances_invoices_2026_06_25.rb', line 63

def get_invoice(marketplace_id, invoice_identifier, next_token_for_line_items: nil)
  path = "/finances/invoices/2026-06-25/invoices/#{percent_encode(invoice_identifier)}"
  params = {
    "marketplaceId" => marketplace_id,
    "nextTokenForLineItems" => next_token_for_line_items,
  }.compact
  parser = -> { GetInvoiceResponse }
  get(path, params:, parser:)
end

#get_invoice_headers(marketplace_id, next_token: nil, from_issue_date: nil, to_issue_date: nil, invoices_modified_after: nil) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Returns invoice headers for all invoices matching filters that you specify.

Parameters:

  • next_token (String) (defaults to: nil)

    The response includes nextToken when the number of invoices exceeds the default page size value (100). To get the next page of results, call the operation with this token and include the same arguments as the call that produced the token. To get a complete list, call this operation until nextToken is null. Note that this operation can return empty pages.

  • marketplace_id (String)

    The marketplace ID of the marketplace from which you want to retrieve invoice headers. The marketplace ID is a globally unique identifier used to specify which Amazon marketplace a request is targeting. For more information, refer to Marketplace IDs.

  • from_issue_date (String) (defaults to: nil)

    Retrieve invoice headers issued after this date. The range between fromIssueDate and toIssueDate must not exceed 90 days. Either provide both dates or leave both empty. If you do not provide these dates, fromIssueDate defaults to 90 days before the date of the request. In ISO 8601 date-time format.

  • to_issue_date (String) (defaults to: nil)

    Retrieve invoice headers issued before this date. The range between fromIssueDate and toIssueDate must not exceed 90 days. Either provide both dates or leave both empty. If you do not provide these dates, toIssueDate defaults to the date of the request. In ISO 8601 date-time format.

  • invoices_modified_after (String) (defaults to: nil)

    Retrieve invoices that were modified after this date-time. In ISO 8601 date-time format.

  • (String)
  • next_token: (String, nil) (defaults to: nil)
  • from_issue_date: (String, nil) (defaults to: nil)
  • to_issue_date: (String, nil) (defaults to: nil)
  • invoices_modified_after: (String, nil) (defaults to: nil)

Returns:



36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/peddler/apis/finances_invoices_2026_06_25.rb', line 36

def get_invoice_headers(marketplace_id, next_token: nil, from_issue_date: nil, to_issue_date: nil,
  invoices_modified_after: nil)
  path = "/finances/invoices/2026-06-25/invoices"
  params = {
    "nextToken" => next_token,
    "marketplaceId" => marketplace_id,
    "fromIssueDate" => from_issue_date,
    "toIssueDate" => to_issue_date,
    "invoicesModifiedAfter" => invoices_modified_after,
  }.compact
  parser = -> { GetInvoicesResponse }
  get(path, params:, parser:)
end