GenerateInvoiceNumber API Operation

Generates an invoice number that your app can present to a merchant for use in the creation of a new invoice.

GenerateInvoiceNumberRequest Message

You can use the GenerateInvoiceNumber request to get a string for use in the number field of a CreateInvoice or CreateAndSendInvoice call. In this way, the GenerateInvoiceNumber request enables your app to simulate the Invoice Creation page on the PayPal site (since that page pre-populates the invoice number value).

The GenerateInvoiceNumber request enables your app to provide a merchant with the merchant's next invoice number; the number provided is unique and, for tracking purposes, is based on the previous invoice number of the merchant. Your app can enable a merchant to choose the provided invoice number number, or change it.

RequestEnvelope Fields

Field Description
detailLevel common:DetailLevelCode (Optional) Not applicable to this call.
errorLanguage xs:string (Required) RFC 3066 language in which error messages are returned; by default, the value is en_US, which is the only language currently supported.

GenerateInvoiceNumberResponse Message

The response contains a number that is a potential number for an invoice.

GenerateInvoiceNumberResponse Fields

Field Description
responseEnvelope common:ResponseEnvelope Common response information, including a timestamp and the response acknowledgment status.
invoiceNumber xs:string The potential number of an invoice, for use in the number field of a CreateInvoice or CreateAndSendInvoice call. For more information, see the description of the GenerateInvoiceNumberRequest message, above. Maximum length: 50 characters.

ResponseEnvelope Fields

Field Description
ack common:AckCode Acknowledgment code. Value is:
  • Success — The operation completed successfully.
  • Failure — The operation failed.
  • SuccessWithWarning — The operation completed successfully; however, there is a warning message.
  • FailureWithWarning — The operation failed with a warning message.
build xs:string Build number. It is used only by PayPal Merchant Technical Support.
correlationId xs:string Correlation identifier. It is a 13-character, alphanumeric string (for example, db87c705a910e) that is used only by PayPal Merchant Technical Support.
Note: You must log and store this data for every response you receive. PayPal Technical Support uses the information to assist with reported issues.
timestamp xs:datetime Date on which the response was sent, for example: 2012-04-02T22:33:35.774-07:00
Note: You must log and store this data for every response you receive. PayPal Technical Support uses the information to assist with reported issues.

PPFault Message

The PPFaultMessage returns ErrorData and the ResponseEnvelope information to your application if an error occurs.

FaultMessage Fields

Field Description
error common:ErrorData Detailed error information.
responseEnvelope common:ResponseEnvelope Common response information, including a timestamp and the response acknowledgment status.

ErrorData Fields

Field Description
category common:ErrorCategory The location where the error occurred. Value is:
  • System — The system encountered errors; try again
  • Application — The application encountered errors; try again
  • Request — The request was incorrect
domain xs:string The domain to which this service belongs.
errorId xs:long A 6-digit number that uniquely identifies a particular error.
exceptionID This field is not used.
message xs:string A description of the error.
parameter common:ErrorParameter Represents contextual information about the error.
severity common:ErrorSeverity The severity of the error encountered. Value is:
  • Error — Processing of the request was interrupted
  • Warning — Processing of the request was completed
subdomain This field is not used.

GenerateInvoiceNumber API Errors

Code Message
520002 Internal error.
520003 Authentication failed. API credentials are incorrect.
520009 Account is restricted.
570054 Invalid token.
570058 Authentication failed. User account is not confirmed.
580045 Merchant does not have a PayPal account associated with this email address.