চালান

InvoiceService ব্যবহার করে একটি গুগল বিজ্ঞাপন অ্যাকাউন্টের মাসিক ইনভয়েস পুনরুদ্ধার করা যেতে পারে।

পূর্বশর্ত

  • Google Ads অ্যাকাউন্টের জন্য মাসিক ইনভয়েসিং সক্ষম করুন। Google Ads API ব্যবহার করে বিলিং কীভাবে পরিচালনা করবেন তা জানতে অ্যাকাউন্ট বিলিং সেটআপ এবং বাজেটের নির্দেশিকাগুলি দেখুন।
  • যদি সেট করা থাকে, তাহলে login-customer-id অবশ্যই এমন একটি ম্যানেজার অ্যাকাউন্টের গ্রাহক আইডি উল্লেখ করতে হবে যা Google Ads অ্যাকাউন্ট পরিচালনা করছে যার জন্য আপনি ইনভয়েসগুলি পুনরুদ্ধার করছেন। এটি Google Ads UI-তে পেমেন্ট ম্যানেজার হিসাবে লেবেল করা হয়।

চালানগুলি পুনরুদ্ধার করুন

ইনভয়েস পুনরুদ্ধার করতে, আপনাকে ListInvoicesRequest : customer_id , billing_setup , issue_year , এবং issue_month - এ সমস্ত প্রয়োজনীয় ফিল্ড সেট করে InvoiceService.ListInvoices পদ্ধতির অনুরোধ করতে হবে।

যদি আপনার একটি সমন্বিত বিলিং সেটআপ থাকে, তাহলে Google Ads API একই বিলিং সেটআপের অধীনে সমস্ত গ্রাহকের জন্য ইনভয়েস ফেরত দেয়, শুধুমাত্র API অনুরোধে উল্লেখিত customer_id এর জন্য ইনভয়েস নয়।

customer_id অবশ্যই একটি Google Ads পরিবেশনকারী অ্যাকাউন্ট হতে হবে। একজন পেমেন্ট ম্যানেজারের জন্য সমস্ত ইনভয়েস পেতে, প্রতিটি Google Ads পরিবেশনকারী অ্যাকাউন্টের জন্য একটি অনুরোধ করুন।

এখানে একটি উদাহরণ:

জাভা

// Issues the request.
ListInvoicesResponse response =
    invoiceServiceClient.listInvoices(
        String.valueOf(customerId),
        ResourceNames.billingSetup(customerId, billingSetupId),
        String.valueOf(oneMonthAgo.getYear()),
        MonthOfYear.valueOf(oneMonthAgo.getMonth().toString()));
      

সি#

ListInvoicesResponse response = invoiceServiceClient.ListInvoices(customerId.ToString(),
    ResourceNames.BillingSetup(customerId, billingSetupId),
    // Year must be 2019 or later.
    lastMonthDateTime.Year.ToString("yyyy"),
    lastMonth);
      

পিএইচপি

// Issues the request.
$response = $googleAdsClient->getInvoiceServiceClient()->listInvoices(
    ListInvoicesRequest::build(
        $customerId,
        ResourceNames::forBillingSetup($customerId, $billingSetupId),
        // The year needs to be 2019 or later.
        date('Y', $lastMonth),
        MonthOfYear::value(strtoupper(date('F', $lastMonth)))
    )
);
      

পাইথন

# Issues a request to list invoices.
response = client.get_service("InvoiceService").list_invoices(
    customer_id=customer_id,
    billing_setup=client.get_service("GoogleAdsService").billing_setup_path(
        customer_id, billing_setup_id
    ),
    # The year needs to be 2019 or later, per the docs:
    # https://developers.google.com/google-ads/api/docs/billing/invoice?hl=en#retrieving_invoices
    issue_year=str(last_month.year),
    issue_month=last_month.strftime("%B").upper(),
)
      

রুবি

# Issues a request to list invoices.
response = client.service.invoice.list_invoices(
  customer_id: customer_id,
  billing_setup: client.path.billing_setup(customer_id, billing_setup_id),
  # The year needs to be 2019 or later.
  issue_year: last_month.year.to_s,
  # '%^B' option returns the uppercased full month name (e.g. 'JANUARY').
  issue_month: last_month.strftime("%^B").to_sym,
)
      

পার্ল

# Issue the request.
my $response = $api_client->InvoiceService()->list({
    customerId   => $customer_id,
    billingSetup =>
      Google::Ads::GoogleAds::V23::Utils::ResourceNames::billing_setup(
      ($customer_id, $billing_setup_id)
      ),
    # The year needs to be 2019 or later.
    issueYear  => strftime("%Y", @last_month),
    issueMonth => uc(strftime("%B", @last_month))});
      

কার্ল করা

# This code example gets invoices for a given billing setup.
#
# Variables:
#   API_VERSION,
#   CUSTOMER_ID,
#   DEVELOPER_TOKEN,
#   MANAGER_CUSTOMER_ID,
#   OAUTH2_ACCESS_TOKEN:
#     See https://developers.google.com/google-ads/api/rest/auth#request_headers
#     for details.
#
#   BILLING_SETUP_ID: The billing setup resource name of the requested invoices.
#   ISSUE_MONTH: The issue month of the invoice, for example, JANUARY.
#   ISSUE_YEAR: The issue year to retrieve invoices, in yyyy format.
curl -f "https://googleads.googleapis.com/v${API_VERSION}/customers/${CUSTOMER_ID}/invoices?billingSetup=${BILLING_SETUP_ID}&issueMonth=${ISSUE_MONTH}&issueYear=${ISSUE_YEAR}" \
--header "Content-Type: application/json" \
--header "developer-token: ${DEVELOPER_TOKEN}" \
--header "login-customer-id: ${MANAGER_CUSTOMER_ID}" \
--header "Authorization: Bearer ${OAUTH2_ACCESS_TOKEN}"
      

প্রতিক্রিয়াটি হল একটি ListInvoicesResponse অবজেক্ট যাতে মিলিত Invoices এর তালিকা রয়েছে, যার প্রতিটিতে ক্ষেত্রগুলির একটি বৃহৎ সেট রয়েছে যেমন:

  • আইডি: payments_account_id , payments_profile_id
  • সময়: issue_date , due_date , service_date_range
  • পরিমাণ: subtotal_amount_micros , tax_amount_micros , total_amount_micros
  • PDF: pdf_url । নির্দেশাবলীর জন্য একটি ইনভয়েস PDF ডাউনলোড দেখুন।
  • ইতিহাস: corrected_invoice , replaced_invoices

প্রাসঙ্গিক হলে এতে অন্যান্য নির্দিষ্ট ক্ষেত্রও রয়েছে:

বাজেটের বিস্তারিত তথ্য পান

একটি Invoice account_budget_summaries ক্ষেত্রে AccountBudgetSummary অবজেক্টের তালিকা হিসেবে সম্পর্কিত অ্যাকাউন্ট বাজেট সম্পর্কে বিস্তারিত তথ্য প্রদান করে:

  • আইডি: customer , account_budget , purchase_order_number
  • সময়: billable_activity_date_range
  • পরিমাণ: subtotal_amount_micros , tax_amount_micros , total_amount_micros , invalid_activity_amount_micros , billed_amount_micros , served_amount_micros , overdelivery_amount_micros

অ্যাকাউন্টের বিবরণ পান

একটি Invoice account_summaries ক্ষেত্রে AccountSummary অবজেক্টের তালিকা হিসেবে সম্পর্কিত অ্যাকাউন্ট সম্পর্কে তথ্য প্রদান করে। এতে বিলিং সংশোধন, সমন্বয়, রপ্তানি চার্জ এবং নিয়ন্ত্রক খরচ সম্পর্কে বিশদ বিবরণ অন্তর্ভুক্ত থাকে।

পরিমাণ বুঝুন

AccountBudgetSummary , AccountSummary এবং Invoice অবজেক্টে প্রদত্ত সমস্ত পরিমাণ তাদের পরিষেবার সময়কালে প্রযোজ্য এবং এই নিয়ম অনুসারে মূল্যায়ন করা হয়:

AccountBudgetSummary মূল্যায়নের নিয়ম
served_amount_micros $অ্যাকাউন্ট\_বাজেট\_পরিবেশিত$
billed_amount_micros $অ্যাকাউন্ট\_বাজেট\_বিল করা হয়েছে$
overdelivery_amount_micros $account\_budget\_overdelivery$
invalid_activity_amount_micros $অ্যাকাউন্ট\_বাজেট\_অবৈধ\_কার্যকলাপ$
subtotal_amount_micros $অ্যাকাউন্ট\_বাজেট\_প্রি-ট্যাক্স$
tax_amount_micros $অ্যাকাউন্ট\_বাজেট\_ট্যাক্স$
total_amount_micros $অ্যাকাউন্ট\_বাজেট\_প্রিট ট্যাক্স + $
$অ্যাকাউন্ট\_বাজেট\_ট্যাক্স$
AccountSummary মূল্যায়নের নিয়ম
billing_correction_subtotal_amount_micros $অ্যাকাউন্ট\_বিলিং\_সংশোধন\_প্রি-ট্যাক্স$
coupon_adjustment_subtotal_amount_micros $অ্যাকাউন্ট\_কুপন\_সমন্বয়\_প্রি-ট্যাক্স$
excess_credit_adjustment_subtotal_amount_micros $অ্যাকাউন্ট\_অতিরিক্ত\_ক্রেডিট\_সমন্বয়\_প্রি-ট্যাক্স$
regulatory_costs_subtotal_amount_micros $অ্যাকাউন্ট\_নিয়ন্ত্রক\_খরচ\_করপূর্ব$
export_charge_subtotal_amount_micros $অ্যাকাউন্ট\_রপ্তানি\_চার্জ\_প্রি-ট্যাক্স$
billing_correction_tax_amount_micros $অ্যাকাউন্ট\_বিলিং\_সংশোধন\_ট্যাক্স$
coupon_adjustment_tax_amount_micros $অ্যাকাউন্ট\_কুপন\_সমন্বয়\_ট্যাক্স$
excess_credit_adjustment_tax_amount_micros $অ্যাকাউন্ট\_অতিরিক্ত\_ক্রেডিট\_সমন্বয়\_ট্যাক্স$
regulatory_costs_tax_amount_micros $অ্যাকাউন্ট\_নিয়ন্ত্রক\_খরচ\_কর$
export_charge_tax_amount_micros $অ্যাকাউন্ট\_রপ্তানি\_চার্জ\_ট্যাক্স$
billing_correction_total_amount_micros $অ্যাকাউন্ট\_বিলিং\_সংশোধন\_প্রিট ট্যাক্স + $
$অ্যাকাউন্ট\_বিলিং\_সংশোধন\_ট্যাক্স$
coupon_adjustment_total_amount_micros $অ্যাকাউন্ট\_কুপন\_সমন্বয়\_প্রিট্যাক্স + $
$অ্যাকাউন্ট\_কুপন\_সমন্বয়\_ট্যাক্স$
excess_credit_adjustment_total_amount_micros $অ্যাকাউন্ট\_অতিরিক্ত\_ক্রেডিট\_সমন্বয়\_প্রিট্যাক্স + $
$অ্যাকাউন্ট\_অতিরিক্ত\_ক্রেডিট\_সমন্বয়\_ট্যাক্স$
regulatory_costs_total_amount_micros $অ্যাকাউন্ট\_নিয়ন্ত্রক\_খরচ\_করপূর্ব + $
$অ্যাকাউন্ট\_নিয়ন্ত্রক\_খরচ\_কর$
export_charge_total_amount_micros $অ্যাকাউন্ট\_রপ্তানি\_চার্জ\_প্রিট ট্যাক্স + $
$অ্যাকাউন্ট\_রপ্তানি\_চার্জ\_ট্যাক্স$
subtotal_amount_micros $অ্যাকাউন্ট\_করপূর্ব$
tax_amount_micros $অ্যাকাউন্ট\_ট্যাক্স$
total_amount_micros $অ্যাকাউন্ট\_প্রিট ট্যাক্স + $
$অ্যাকাউন্ট\_ট্যাক্স$
Invoice মূল্যায়নের নিয়ম
adjustments_subtotal_amount_micros $\sum_{i=1}^n অ্যাকাউন্ট\_বিলিং\_সংশোধন\_প্রিট্যাক্স_i + $
$\sum_{i=1}^n অ্যাকাউন্ট\_কুপন\_সমন্বয়\_প্রিট্যাক্স_i + $
$\sum_{i=1}^n অ্যাকাউন্ট\_অতিরিক্ত\_ক্রেডিট\_সমন্বয়\_প্রিট্যাক্স_i$
regulatory_costs_subtotal_amount_micros $\sum_{i=1}^n অ্যাকাউন্ট\_নিয়ন্ত্রক\_খরচ\_প্রি-ট্যাক্স_i$
export_charge_subtotal_amount_micros $\sum_{i=1}^n অ্যাকাউন্ট\_রপ্তানি\_চার্জ\_প্রিট্যাক্স_i$
adjustments_tax_amount_micros $\sum_{i=1}^n অ্যাকাউন্ট\_বিলিং\_সংশোধন\_ট্যাক্স_i + $
$\sum_{i=1}^n অ্যাকাউন্ট\_কুপন\_সমন্বয়\_ট্যাক্স_i + $
$\sum_{i=1}^n অ্যাকাউন্ট\_অতিরিক্ত\_ক্রেডিট\_সমন্বয়\_কর_i$
regulatory_costs_tax_amount_micros $\sum_{i=1}^n অ্যাকাউন্ট\_নিয়ন্ত্রক\_খরচ\_কর_i$
export_charge_tax_amount_micros $\sum_{i=1}^n অ্যাকাউন্ট\_রপ্তানি\_চার্জ\_কর_i$
adjustments_total_amount_micros $সমন্বয়\_প্রিট ট্যাক্স + $
$সমন্বয়\_কর$
regulatory_costs_total_amount_micros $নিয়ন্ত্রক\_খরচ\_করপূর্ব + $
$নিয়ন্ত্রক\_খরচ\_কর$
export_charge_total_amount_micros $রপ্তানি\_চার্জ\_প্রিট ট্যাক্স + $
$রপ্তানি\_চার্জ\_কর$
subtotal_amount_micros $সমন্বয়\_প্রিট ট্যাক্স + $
$\sum_{i=1}^n অ্যাকাউন্ট\_বাজেট\_প্রিট্যাক্স_i$
tax_amount_micros $সমন্বয়\_কর + $
$নিয়ন্ত্রক\_খরচ\_কর + $
$রপ্তানি\_চার্জ\_কর + $
$\sum_{i=1}^n অ্যাকাউন্ট\_বাজেট\_ট্যাক্স_i$
total_amount_micros $প্রি-ট্যাক্স + $
$নিয়ন্ত্রক\_খরচ\_করপূর্ব + $
$রপ্তানি\_চার্জ\_প্রিট ট্যাক্স + $
$ট্যাক্স$

পুনরুদ্ধার করা ইনভয়েসগুলি কীভাবে পুনরাবৃত্তি করা যেতে পারে তার একটি উদাহরণ এখানে দেওয়া হল:

জাভা

// Iterates over all invoices retrieved and prints their information.
for (Invoice invoice : response.getInvoicesList()) {
  System.out.printf(
      "- Found the invoice '%s':\n"
          + "  ID (also known as Invoice Number): '%s'\n"
          + "  Type: %s\n"
          + "  Billing setup ID: '%s'\n"
          + "  Payments account ID (also known as Billing Account Number): '%s'\n"
          + "  Payments profile ID (also known as Billing ID): '%s'\n"
          + "  Issue date (also known as Invoice Date): %s\n"
          + "  Due date: %s\n"
          + "  Currency code: %s\n"
          + "  Service date range (inclusive): from %s to %s\n"
          + "  Adjustments: subtotal '%.2f', tax '%.2f', total '%.2f'\n"
          + "  Regulatory costs: subtotal '%.2f', tax '%.2f', total '%.2f'\n"
          + "  Replaced invoices: '%s'\n"
          + "  Amounts: subtotal '%.2f', tax '%.2f', total '%.2f'\n"
          + "  Corrected invoice: '%s'\n"
          + "  PDF URL: '%s'\n"
          + "  Account budgets: ",
      invoice.getResourceName(),
      invoice.getId(),
      invoice.getType(),
      invoice.getBillingSetup(),
      invoice.getPaymentsAccountId(),
      invoice.getPaymentsProfileId(),
      invoice.getIssueDate(),
      invoice.getDueDate(),
      invoice.getCurrencyCode(),
      invoice.getServiceDateRange().getStartDate(),
      invoice.getServiceDateRange().getEndDate(),
      convertMicrosToCurrency(invoice.getAdjustmentsSubtotalAmountMicros()),
      convertMicrosToCurrency(invoice.getAdjustmentsTaxAmountMicros()),
      convertMicrosToCurrency(invoice.getAdjustmentsTotalAmountMicros()),
      convertMicrosToCurrency(invoice.getRegulatoryCostsSubtotalAmountMicros()),
      convertMicrosToCurrency(invoice.getRegulatoryCostsTaxAmountMicros()),
      convertMicrosToCurrency(invoice.getRegulatoryCostsTotalAmountMicros()),
      invoice.getReplacedInvoicesList(),
      convertMicrosToCurrency(invoice.getSubtotalAmountMicros()),
      convertMicrosToCurrency(invoice.getTaxAmountMicros()),
      convertMicrosToCurrency(invoice.getTotalAmountMicros()),
      invoice.getCorrectedInvoice(),
      invoice.getPdfUrl());
  for (AccountBudgetSummary accountBudgetSummary : invoice.getAccountBudgetSummariesList()) {
    System.out.printf(
        "  - Account budget '%s':\n"
            + "      Name (also known as Account Budget): '%s'\n"
            + "      Customer (also known as Account ID): '%s'\n"
            + "      Customer descriptive name (also known as Account): '%s'\n"
            + "      Purchase order number (also known as Purchase Order): '%s'\n"
            + "      Billing activity date range (inclusive): from %s to %s\n"
            + "      Amounts: subtotal '%.2f', tax '%.2f', total '%.2f'\n",
        accountBudgetSummary.getAccountBudget(),
        accountBudgetSummary.getAccountBudgetName(),
        accountBudgetSummary.getCustomer(),
        accountBudgetSummary.getCustomerDescriptiveName(),
        accountBudgetSummary.getPurchaseOrderNumber(),
        accountBudgetSummary.getBillableActivityDateRange().getStartDate(),
        accountBudgetSummary.getBillableActivityDateRange().getEndDate(),
        convertMicrosToCurrency(accountBudgetSummary.getSubtotalAmountMicros()),
        convertMicrosToCurrency(accountBudgetSummary.getTaxAmountMicros()),
        convertMicrosToCurrency(accountBudgetSummary.getTotalAmountMicros()));
  }
}
      

সি#

// information.
foreach (Invoice invoice in response.Invoices)
{
    Console.WriteLine(
        "- Found the invoice '{0}':\n" +
        "  ID (also known as Invoice Number): '{1}'\n" +
        "  Type: {2}\n" +
        "  Billing setup ID: '{3}'\n" +
        "  Payments account ID (also known as Billing Account Number): '{4}'\n" +
        "  Payments profile ID (also known as Billing ID): '{5}'\n" +
        "  Issue date (also known as Invoice Date): {6}\n" +
        "  Due date: {7}\n" +
        "  Currency code: {8}\n" +
        "  Service date range (inclusive): from {9} to {10}\n" +
        "  Adjustments: subtotal '{11}', tax '{12}', total '{13}'\n" +
        "  Regulatory costs: subtotal '{14}', tax '{15}', total '{16}'\n" +
        "  Replaced invoices: '{17}'\n" +
        "  Amounts: subtotal '{18}', tax '{19}', total '{20}'\n" +
        "  Corrected invoice: '{21}'\n" +
        "  PDF URL: '{22}'\n" +
        "  Account budgets:\n",
        invoice.ResourceName,
        invoice.Id,
        invoice.Type.ToString(),
        invoice.BillingSetup,
        invoice.PaymentsAccountId,
        invoice.PaymentsProfileId,
        invoice.IssueDate,
        invoice.DueDate,
        invoice.CurrencyCode,
        invoice.ServiceDateRange.StartDate,
        invoice.ServiceDateRange.EndDate,
        FormatMicros(invoice.AdjustmentsSubtotalAmountMicros),
        FormatMicros(invoice.AdjustmentsTaxAmountMicros),
        FormatMicros(invoice.AdjustmentsTotalAmountMicros),
        FormatMicros(invoice.RegulatoryCostsSubtotalAmountMicros),
        FormatMicros(invoice.RegulatoryCostsTaxAmountMicros),
        FormatMicros(invoice.RegulatoryCostsTotalAmountMicros),
        invoice.ReplacedInvoices.Count > 0
            ? string.Join("', '", invoice.ReplacedInvoices)
            : "none",
        FormatMicros(invoice.SubtotalAmountMicros),
        FormatMicros(invoice.TaxAmountMicros),
        FormatMicros(invoice.TotalAmountMicros),
        string.IsNullOrEmpty(invoice.CorrectedInvoice)
            ? invoice.CorrectedInvoice
            : "none",
        invoice.PdfUrl);
    foreach (AccountBudgetSummary accountBudgetSummary in
        invoice.AccountBudgetSummaries)
    {
        Console.WriteLine(
            "\t- Account budget '{0}':\n" +
            "\t  Name (also known as Account Budget): '{1}'\n" +
            "\t  Customer (also known as Account ID): '{2}'\n" +
            "\t  Customer descriptive name (also known as Account): '{3}'\n" +
            "\t  Purchase order number (also known as Purchase Order): '{4}'\n" +
            "\t  Billing activity date range (inclusive): from {5} to {6}\n" +
            "\t  Amounts: subtotal '{7}', tax '{8}', total '{9}'\n",
            accountBudgetSummary.AccountBudget,
            accountBudgetSummary.AccountBudgetName ?? "none",
            accountBudgetSummary.Customer,
            accountBudgetSummary.CustomerDescriptiveName ?? "none",
            accountBudgetSummary.PurchaseOrderNumber ?? "none",
            accountBudgetSummary.BillableActivityDateRange.StartDate,
            accountBudgetSummary.BillableActivityDateRange.EndDate,
            FormatMicros(accountBudgetSummary.SubtotalAmountMicros),
            FormatMicros(accountBudgetSummary.TaxAmountMicros),
            FormatMicros(accountBudgetSummary.TotalAmountMicros));
    }
}
      

পিএইচপি

// Iterates over all invoices retrieved and prints their information.
foreach ($response->getInvoices() as $invoice) {
    /** @var Invoice $invoice */
    printf(
        "- Found the invoice '%s':" . PHP_EOL .
        "  ID (also known as Invoice Number): '%s'" . PHP_EOL .
        "  Type: %s" . PHP_EOL .
        "  Billing setup ID: '%s'" . PHP_EOL .
        "  Payments account ID (also known as Billing Account Number): '%s'" . PHP_EOL .
        "  Payments profile ID (also known as Billing ID): '%s'" . PHP_EOL .
        "  Issue date (also known as Invoice Date): %s" . PHP_EOL .
        "  Due date: %s" . PHP_EOL .
        "  Currency code: %s" . PHP_EOL .
        "  Service date range (inclusive): from %s to %s" . PHP_EOL .
        "  Adjustments: subtotal '%.2f', tax '%.2f', total '%.2f'" . PHP_EOL .
        "  Regulatory costs: subtotal '%.2f', tax '%.2f', total '%.2f'" . PHP_EOL .
        "  Replaced invoices: '%s'" . PHP_EOL .
        "  Amounts: subtotal '%.2f', tax '%.2f', total '%.2f'" . PHP_EOL .
        "  Corrected invoice: '%s'" . PHP_EOL .
        "  PDF URL: '%s'" . PHP_EOL .
        "  Account budgets:" . PHP_EOL,
        $invoice->getResourceName(),
        $invoice->getId(),
        InvoiceType::name($invoice->getType()),
        $invoice->getBillingSetup(),
        $invoice->getPaymentsAccountId(),
        $invoice->getPaymentsProfileId(),
        $invoice->getIssueDate(),
        $invoice->getDueDate(),
        $invoice->getCurrencyCode(),
        $invoice->getServiceDateRange()->getStartDate(),
        $invoice->getServiceDateRange()->getEndDate(),
        Helper::microToBase($invoice->getAdjustmentsSubtotalAmountMicros()),
        Helper::microToBase($invoice->getAdjustmentsTaxAmountMicros()),
        Helper::microToBase($invoice->getAdjustmentsTotalAmountMicros()),
        Helper::microToBase($invoice->getRegulatoryCostsSubtotalAmountMicros()),
        Helper::microToBase($invoice->getRegulatoryCostsTaxAmountMicros()),
        Helper::microToBase($invoice->getRegulatoryCostsTotalAmountMicros()),
        $invoice->getReplacedInvoices()
            ? implode(
                "', '",
                iterator_to_array($invoice->getReplacedInvoices()->getIterator())
            ) : 'none',
        Helper::microToBase($invoice->getSubtotalAmountMicros()),
        Helper::microToBase($invoice->getTaxAmountMicros()),
        Helper::microToBase($invoice->getTotalAmountMicros()),
        $invoice->getCorrectedInvoice() ?: 'none',
        $invoice->getPdfUrl()
    );
    foreach ($invoice->getAccountBudgetSummaries() as $accountBudgetSummary) {
        /** @var AccountBudgetSummary $accountBudgetSummary */
        printf(
            "  - Account budget '%s':" . PHP_EOL .
            "      Name (also known as Account Budget): '%s'" . PHP_EOL .
            "      Customer (also known as Account ID): '%s'" . PHP_EOL .
            "      Customer descriptive name (also known as Account): '%s'" . PHP_EOL .
            "      Purchase order number (also known as Purchase Order): '%s'" . PHP_EOL .
            "      Billing activity date range (inclusive): from %s to %s" . PHP_EOL .
            "      Amounts: subtotal '%.2f', tax '%.2f', total '%.2f'" . PHP_EOL,
            $accountBudgetSummary->getAccountBudget(),
            $accountBudgetSummary->getAccountBudgetName() ?: 'none',
            $accountBudgetSummary->getCustomer(),
            $accountBudgetSummary->getCustomerDescriptiveName() ?: 'none',
            $accountBudgetSummary->getPurchaseOrderNumber() ?: 'none',
            $accountBudgetSummary->getBillableActivityDateRange()->getStartDate(),
            $accountBudgetSummary->getBillableActivityDateRange()->getEndDate(),
            Helper::microToBase($accountBudgetSummary->getSubtotalAmountMicros()),
            Helper::microToBase($accountBudgetSummary->getTaxAmountMicros()),
            Helper::microToBase($accountBudgetSummary->getTotalAmountMicros())
        );
    }
}
      

পাইথন

    for invoice in response.invoices:
        print(
            f"""
- Found the invoice {invoice.resource_name}
    ID (also known as Invoice Number): '{invoice.id}'
    Type: {invoice.type_}
    Billing setup ID: '{invoice.billing_setup}'
    Payments account ID (also known as Billing Account Number): '{invoice.payments_account_id}'
    Payments profile ID (also known as Billing ID): '{invoice.payments_profile_id}'
    Issue date (also known as Invoice Date): {invoice.issue_date}
    Due date: {invoice.due_date}
    Currency code: {invoice.currency_code}
    Service date range (inclusive): from {invoice.service_date_range.start_date} to {invoice.service_date_range.end_date}
    Adjustments:
        subtotal {_micros_to_currency(invoice.adjustments_subtotal_amount_micros)}
        tax {_micros_to_currency(invoice.adjustments_tax_amount_micros)}
        total {_micros_to_currency(invoice.adjustments_total_amount_micros)}
    Regulatory costs:
        subtotal {_micros_to_currency(invoice.regulatory_costs_subtotal_amount_micros)}
        tax {_micros_to_currency(invoice.regulatory_costs_tax_amount_micros)}
        total {_micros_to_currency(invoice.regulatory_costs_total_amount_micros)}
    Replaced invoices: {invoice.replaced_invoices.join(", ") if invoice.replaced_invoices else "none"}
    Amounts:
        subtotal {_micros_to_currency(invoice.subtotal_amount_micros)}
        tax {_micros_to_currency(invoice.tax_amount_micros)}
        total {_micros_to_currency(invoice.total_amount_micros)}
    Corrected invoice: {invoice.corrected_invoice or "none"}
    PDF URL: {invoice.pdf_url}
    Account budgets:
    """
        )
        for account_budget_summary in invoice.account_budget_summaries:
            print(
                f"""
                  - Account budget '{account_budget_summary.account_budget}':
                      Name (also known as Account Budget): '{account_budget_summary.account_budget_name}'
                      Customer (also known as Account ID): '{account_budget_summary.customer}'
                      Customer descriptive name (also known as Account): '{account_budget_summary.customer_descriptive_name}'
                      Purchase order number (also known as Purchase Order): '{account_budget_summary.purchase_order_number}'
                      Billing activity date range (inclusive):
                        from #{account_budget_summary.billable_activity_date_range.start_date}
                        to #{account_budget_summary.billable_activity_date_range.end_date}
                      Amounts:
                        subtotal '{_micros_to_currency(account_budget_summary.subtotal_amount_micros)}'
                        tax '{_micros_to_currency(account_budget_summary.tax_amount_micros)}'
                        total '{_micros_to_currency(account_budget_summary.total_amount_micros)}'
                """
            )
      

রুবি

# Iterates over all invoices retrieved and prints their information.
response.invoices.each do |invoice|
  puts <<~OUTPUT
  - Found the invoice '#{invoice.resource_name}'
    ID (also known as Invoice Number): '#{invoice.id}'
    Type: #{invoice.type}
    Billing Setup ID: '#{invoice.billing_setup}'
    Payments account ID (also known as Billing Account Number): '#{invoice.payments_account_id}'
    Payments profile ID (also known as Billing ID): '#{invoice.payments_profile_id}'
    Issue date (also known as Invoice Date): #{invoice.issue_date}
    Due date: #{invoice.due_date}
    Currency code: #{invoice.currency_code}
    Service date range (inclusive):
      from #{invoice.service_date_range.start_date}
      to #{invoice.service_date_range.end_date}
    Adjustments:
      subtotal '#{micro_to_base(invoice.adjustments_subtotal_amount_micros)}'
      tax '#{micro_to_base(invoice.adjustments_tax_amount_micros)}'
      total '#{micro_to_base(invoice.adjustments_total_amount_micros)}'
    Regulatory costs:
      subtotal '#{micro_to_base(invoice.regulatory_costs_subtotal_amount_micros)}'
      tax '#{micro_to_base(invoice.regulatory_costs_tax_amount_micros)}'
      total '#{micro_to_base(invoice.regulatory_costs_total_amount_micros)}'
    Replaced invoices: '#{invoice.replaced_invoices ? invoice.replaced_invoices.join(", ") : 'none'}'
    Amounts:
      subtotal '#{micro_to_base(invoice.subtotal_amount_micros)}'
      tax '#{micro_to_base(invoice.tax_amount_micros)}'
      total '#{micro_to_base(invoice.total_amount_micros)}'
    Corrected invoice: '#{invoice.corrected_invoices ? invoice.corrected_invoices : 'none'}'
    PDF URL: '#{invoice.pdf_url}'
    Account budgets:
  OUTPUT
  invoice.account_budget_summaries.each do |account_budget_summary|
    puts <<~OUTPUT
    \tAccount budget '#{account_budget_summary.account_budget}':
    \t  Name (also known as Account Budget): '#{account_budget_summary.account_budget_name}'
    \t  Customer (also known as Account ID): '#{account_budget_summary.customer}'
    \t  Customer descriptive name (also known as Account): '#{account_budget_summary.customer_descriptive_name}'
    \t  Purchase order number (also known as Purchase Order): '#{account_budget_summary.purchase_order_number}'
    \t  Billing activity date range (inclusive):
    \t    from #{account_budget_summary.billable_activity_date_range.start_date}
    \t    to #{account_budget_summary.billable_activity_date_range.end_date}
    \t  Amounts:
    \t    subtotal '#{micro_to_base(account_budget_summary.subtotal_amount_micros)}'
    \t    tax '#{micro_to_base(account_budget_summary.tax_amount_micros)}'
    \t    total '#{micro_to_base(account_budget_summary.total_amount_micros)}'
    OUTPUT
  end
end
      

পার্ল

# Iterate over all invoices retrieved and print their information.
foreach my $invoice (@$response) {
  printf "- Found the invoice '%s':\n" .
    "  ID (also known as Invoice Number): '%s'\n" .
    "  Type: %s\n" .
    "  Billing setup ID: '%s'\n" .
    "  Payments account ID (also known as Billing Account Number): '%s'\n" .
    "  Payments profile ID (also known as Billing ID): '%s'\n" .
    "  Issue date (also known as Invoice Date): %s\n" .
    "  Due date: %s\n" .
    "  Currency code: %s\n" .
    "  Service date range (inclusive): from %s to %s\n" .
    "  Adjustments: subtotal '%.2f', tax '%.2f', total '%.2f'\n" .
    "  Regulatory costs: subtotal '%.2f', tax '%.2f', total '%.2f'\n" .
    "  Replaced invoices: '%s'\n" .
    "  Amounts: subtotal '%.2f', tax '%.2f', total '%.2f'\n" .
    "  Corrected invoice: '%s'\n" .
    "  PDF URL: '%s'\n" .
    "  Account budgets:\n",
    $invoice->{resourceName},
    $invoice->{id},
    $invoice->{type},
    $invoice->{billingSetup},
    $invoice->{paymentsAccountId},
    $invoice->{paymentsProfileId},
    $invoice->{issueDate},
    $invoice->{dueDate},
    $invoice->{currencyCode},
    $invoice->{serviceDateRange}{startDate},
    $invoice->{serviceDateRange}{endDate},
    micro_to_base($invoice->{adjustmentsSubtotalAmountMicros}),
    micro_to_base($invoice->{adjustmentsTaxAmountMicros}),
    micro_to_base($invoice->{adjustmentsTotalAmountMicros}),
    micro_to_base($invoice->{regulatoryCostsSubtotalAmountMicros}),
    micro_to_base($invoice->{regulatoryCostsTaxAmountMicros}),
    micro_to_base($invoice->{regulatoryCostsTotalAmountMicros}),
    $invoice->{replacedInvoices}
    ? join(',', @{$invoice->{replacedInvoices}})
    : "none",
    micro_to_base($invoice->{subtotalAmountMicros}),
    micro_to_base($invoice->{taxAmountMicros}),
    micro_to_base($invoice->{totalAmountMicros}),
    $invoice->{correctedInvoice} ? $invoice->{correctedInvoice} : "none",
    $invoice->{pdfUrl};

  foreach my $account_budget_summary (@{$invoice->{accountBudgetSummaries}}) {
    printf "  - Account budget '%s':\n" .
      "      Name (also known as Account Budget): '%s'\n" .
      "      Customer (also known as Account ID): '%s'\n" .
      "      Customer descriptive name (also known as Account): '%s'\n" .
      "      Purchase order number (also known as Purchase Order): '%s'\n" .
      "      Billing activity date range (inclusive): from %s to %s\n" .
      "      Amounts: subtotal '%.2f', tax '%.2f', total '%.2f'\n",
      $account_budget_summary->{accountBudget},
      $account_budget_summary->{accountBudgetName}
      ? $account_budget_summary->{accountBudgetName}
      : "none",
      $account_budget_summary->{customer},
      $account_budget_summary->{customerDescriptiveName}
      ? $account_budget_summary->{customerDescriptiveName}
      : "none",
      $account_budget_summary->{purchaseOrderNumber}
      ? $account_budget_summary->{purchaseOrderNumber}
      : "none",
      $account_budget_summary->{billableActivityDateRange}{startDate},
      $account_budget_summary->{billableActivityDateRange}{endDate},
      $account_budget_summary->{subtotalAmountMicros},
      $account_budget_summary->{taxAmountMicros},
      $account_budget_summary->{totalAmountMicros};
  }
}
      

একটি ইনভয়েস পিডিএফ ডাউনলোড করুন

যেকোনো ইনভয়েস PDF ফাইল হিসেবে ডাউনলোড করা যাবে। Invoice পুনরুদ্ধার করার পর, আপনাকে তার pdf_url ফিল্ডে সংরক্ষিত URL-এর জন্য একটি HTTP অনুরোধ পাঠাতে হবে। ইনভয়েস পুনরুদ্ধার করতে ব্যবহৃত একই Google অ্যাকাউন্ট ব্যবহার করে এই অনুরোধটি প্রমাণীকরণ করতে হবে; অর্থাৎ, আপনাকে Authorization: Bearer অনুরোধ শিরোনামে Google অ্যাকাউন্ট ব্যবহার করে তৈরি একটি OAuth অ্যাক্সেস টোকেন নির্দিষ্ট করতে হবে:

curl --request GET \
     --header "Authorization: Bearer access token" \
     Invoice.pdf_url > filename.pdf

ফলাফল হল filename.pdf ফাইলে সংরক্ষিত একটি ইনভয়েস PDF কন্টেন্ট।

সাধারণ ত্রুটি কোডগুলি

দৃশ্যকল্প ত্রুটি কোড
বিলিং সেটআপ, ইস্যুর বছর, অথবা ইস্যুর মাস অনুপস্থিত অথবা খালি। RequestError.REQUIRED_FIELD_MISSING
প্রদত্ত বিলিং সেটআপ, ইস্যুর বছর, অথবা ইস্যুর মাস পার্স করা যাচ্ছে না। FieldError.INVALID_VALUE
১ জানুয়ারী, ২০১৯ এর আগে ইস্যু করা ইনভয়েসের জন্য অনুরোধ করা হচ্ছে। InvoiceError.YEAR_MONTH_TOO_OLD
অনুরোধটি এমন গ্রাহকের জন্য যারা চালান পান না। InvoiceError.NOT_INVOICED_CUSTOMER
ব্যবহারকারীর বিলিং সেটআপের ইনভয়েস দেখার অনুমতি নেই। AuthorizationError.ACTION_NOT_PERMITTED