question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Raise Exception in VendorInvoices().submit_invoices() when trying to submit a new invoice

See original GitHub issue

Describe the bug When trying to submit a new invoice to VendorInvoices().submit_invoices() for Retail Partners, I get an exception that json content is invalid. It seems that the key from kwargs is added to the beginning of JSON object, which it is not supposed to.

Error Message

raise exception(error, headers=res.headers)
sp_api.base.exceptions.SellingApiBadRequestException: [{'code': 'InvalidInput', 'message': 'Invoices', 'details': ''}, {'code': 'InvalidInput', 'message': "Invalid content was found starting with element 'body'. One of '{invoices}' is expected.", 'details': ''}]

To Reproduce

Here is the code used to call Amazon Vendor SP-API:

with open("invoice.json", ) as file:
      obj = json.load(file)
 
res = VendorInvoices(account="VC").submit_invoices(body=obj)

This is the invoice object that was created according to Amazon Vendor SP-API guidelines:

{
    "invoices": [
        {
            "billToParty": {
                "address": {
                    "addressLine1": "440 Terry Ave N",
                    "city": "Seattle",
                    "countryCode": "US",
                    "name": "Amazon.com",
                    "stateOrRegion": "WA"
                },
                "partyId": "AKC1"
            },
            "date": "xxxxxxxx",
            "id": "xxxxxxxx",
            "invoiceTotal": {
                "amount": xxxxxxx,
                "currencyCode": "USD"
            },
            "invoiceType": "Invoice",
            "items": [
                {
                    "amazonProductIdentifier": "xxxxxxx",
                    "invoicedQuantity": {
                        "amount": 10.0,
                        "unitOfMeasure": "Eaches"
                    },
                    "itemSequenceNumber": "9",
                    "netCost": {
                        "amount": "xxxxx",
                        "currencyCode": "USD"
                    },
                    "purchaseOrderNumber": "xxxxxxx",
                    "vendorProductIdentifier": "xxxxxxxx"
                }
            ],
            "paymentTerms": {
                "discountDueDays": xx,
                "discountPercent": "xx",
                "netDueDays": xx,
                "type": "Basic"
            },
            "remitToParty": {
                "address": {
                    "addressLine1": "xxxxxxxx",
                    "city": "xxxxxx",
                    "countryCode": "US",
                    "name": "xxxxxx",
                    "postalOrZipCode": "xxxxxx",
                    "stateOrRegion": "WA"
                },
                "partyId": "OR4YV"
            },
            "shipFromParty": {
                "address": {
                    "addressLine1": "xxxxx",
                    "city": "xxxxxx",
                    "countryCode": "US",
                    "name": "xxxxx",
                    "postalOrZipCode": "xxxxxx",
                    "stateOrRegion": "WA"
                },
                "partyId": "OR4YV"
            },
            "shipToParty": {
                "address": {
                    "addressLine1": "440 Terry Ave N",
                    "city": "Seattle",
                    "countryCode": "US",
                    "name": "Amazon.com",
                    "stateOrRegion": "WA"
                },
                "partyId": "AKC1"
            }
        }
    ]
}

Expected behavior

I expect this API call to return an ApiResponse with res.payload that includes transactionId. I can then use transactionId to check the request status later.

Desktop:

OS: Mac
IDE: VS Code

Additional context

Any help to get this resolved is appreciated.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ej-cdxcommented, Jan 6, 2022

Thanks again!!

0reactions
saleweavercommented, Jan 5, 2022
Read more comments on GitHub >

github_iconTop Results From Across the Web

11 Common Invoice Processing Problems and How to Fix ...
Many PA teams struggle with these eleven common issues with processing invoices. Learn what they are and what to do to put your...
Read more >
The Top 7 Challenges Organizations Face When ...
“Transmission error or failure”. #5. The time and effort to create and submit invoices is sometimes prohibitive. When supplier organizations ...
Read more >
Vendor invoices overview - Finance | Dynamics 365
In this article. Vendor invoices; Understanding invoice line quantities; Adding a line that wasn't on the purchase order; Submitting a vendor ...
Read more >
Error: You can try again, or come back later and try connecting ...
My customer is unable to pay an invoice. Keeps seeing this error: "Error: You can try again, or come back later and try...
Read more >
What is Invoice Processing? Definition, Steps, Flowchart & ...
Invoice processing is an accounts payable function with a series of steps for managing vendor or supplier invoices from receipt to payment.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found