Create a new invoice and send an email to the customer.
required | name | format | description |
---|---|---|---|
* | amountBase | Money, Format: X.XX Ex: 1000.00 |
Base amount to charge. |
attachmentId | Valid file ID |
File associated with the invoice. Available for download on PayJunction's hosted checkout form. |
|
* | customerEmail | Max Length 255 |
Email address the Invoice will be sent to. Required if notification type is not set, EMAIL, or BOTH. |
customerFirstName | Max Length 16 |
The customer's first name. |
|
customerIdentifier | Max Length 64 |
Your own identifier to associate with the customer. |
|
customerLastName | Max Length 32 |
The customer's last name. |
|
* | customerPhone | 10-Digit Long Code - only numerical values (USA Only) |
Phone number the Invoice will be texted to. Required if notification type is TEXT or BOTH. |
invoiceNumber | Max Length 32 |
An invoice number. |
|
message | Max Length 2048 |
Message to the customer displayed on PayJunction's hosted checkout form. |
|
notificationType | EMAIL | TEXT | BOTH | NONE |
Defaults to "EMAIL" if not set. |
|
* | terminalId | Valid Terminal ID |
The terminal on which to process the transaction when the invoice is paid. |
To attach a PDF file to the Invoice you must first save it to the Invoice system using POST /invoices/files
Invoices can be voided and reopened after creation but they cannot be edited. If an Invoice must be corrected, the original must be voided and a new Invoice created.
Example Request (please replace placeholder values)
curl -X POST https://api.payjunction.com/invoices \ -u "login:password" \ -H "Accept: application/json" \ -H "X-PJ-Application-Key: YOUR_PRODUCTION_APP_KEY" \ -d amountBase=1.99 \ -d customerEmail=jdoe@payjunction.com \
-d customerPhone=8006010230 \
-d customerFirstName=John \ -d customerLastName=Doe \ -d invoiceNumber="TO-123456" \ -d message="Invoice for takeout order #123456" \
-d notificationType="BOTH" \ -d terminalId=1
Example Request in the "Labs Demo" account
curl -X POST https://api.payjunctionlabs.com/invoices \
-u "pj-ql-01:pj-ql-01p" \
-H "Accept: application/json" \
-H "X-PJ-Application-Key: c0d73641-65ae-4e9b-bbab-fb6215d7ee98" \
-d amountBase=1.99 \
-d customerEmail=jdoe@payjunction.com \
-d customerPhone=8006010230 \
-d customerFirstName=John \
-d customerLastName=Doe \
-d invoiceNumber="TO-123456" \
-d message="Invoice for takeout order #123456" \
-d notificationType="BOTH" \
-d terminalId=1
Example Response
{ "amountBase" : "1.99", "created" : "2020-11-24T01:19:23Z", "customerEmail" : "jdoe@payjunction.com", "customerFirstName" : "John", "customerIdentifier" : "customer-id", "customerLastName" : "Doe", "hostedInvoiceUrl" : "https://www.payjunction.com/trinity/invoice#/e321790e-c030-4501-aa99-09e35158c1a6" "invoiceId" : "e321790e-c030-4501-aa99-09e35158c1a6", "invoiceNumber" : "TO-123456", "lastModified" : "2020-11-24T01:19:23Z", "message" : "Invoice for takeout order #123456", "status" : "OPEN", "terminalId" : 1 }