bvstone

"Number is too long" Error from GreenTools for PayPal (G4PP) Create Invoice Call

Posted:

This issue came up while I was testing in the PayPal sandbox.  I posted the question and answer here on StackExchange but in case it doesn't last, I copied the information here.

Question:

I was helping a customer figure out an issue and creating test invoices in the sandbox.

After the 4th one I started getting this error:

{
    "name": "BUSINESS_ERROR",
    "message": "Number is too long.",
    "information_link": 
    "https://developer.paypal.com/docs/api/invoicing/#errors",
    "debug_id": "2ca1d32e1fed3"
}


What number is too long? I've tried looking through all the info and nothing appears too long our out of spec. Hopefully somoene at Paypal can use the debug ID to track this. This test program has worked without issue for months.

Answer:

So, after dealing with PayPal support the number that is too long was the invoice number.

When I started my testing in the sandbox I always had PayPal auto-generate the invoice number. It gave something like:

INV2-UR7F-35N45-DGQZ-BYDE

So, after a few tests, the invoice number was incremented (by PayPal) and eventually reached:

INV2-UR7F-35N99-DGQZ-BYDE

Now, on one more call the invoice would be incremented to:

INV2-UR7F-35N100-DGQZ-BYDE

Which is 26 characters, and the maximum length for invoice number is 25.

The solution? I was told to use smaller invoice numbers. ;)

I feel this is a possible bug in the auto-incrementation of the PayPal Invoice, but I am posting this so when others run into this they know what to do.

What I did was in my sandbox account call the Create Invoice Draft API with an invoice number like "Test001" so that there will be plenty of increments left in the invoice number. After that call there should be no need to supply an invoice number, at least for a very long time.





Reply




© Copyright 1983-2024 BVSTools
GreenBoard(v3) Powered by the eRPG SDK, MAILTOOL Plus!, GreenTools for Google Apps, jQuery, jQuery UI, BlockUI, CKEditor and running on the IBM i (AKA AS/400, iSeries, System i).