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 (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. |
| metadata[externalId] | Text, Valid ASCII Max Length 36 | Optional identifier copied from the invoice to the transaction at creation time. |
| metadata[externalData] | Text, Valid ASCII Max Length 36 | Optional status or value copied to the transaction at creation time. |
| notificationType | EMAIL | TEXT | BOTH | NONE | Defaults to "EMAIL" if not set. |
* | terminalId | Valid Terminal ID | Always specify a terminalId to ensure consistent behavior. If omitted, the default terminal assigned to the API Credential will be used (if set and on). If no default is configured or the terminal is off, the request will fail. |
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 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
curl -X POST https://api.payjunction.com/invoices \
-u "YOUR_USER:YOUR_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 "metadata[externalId]=e1ad3185-6f93-458c-9df7-3d88edb4953e" \
-d "metadata[externalData]=UNRECONCILED" \
-d "transactionMetadata[externalId]=6c8370a2-2559-4cc1-9faf-04a0b4d2ff52" \
-d "transactionMetadata[externalData]=UNRECONCILED" \
-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,
"metadata" : {
"externalId" : "e1ad3185-6f93-458c-9df7-3d88edb4953e",
"externalData" : "UNRECONCILED"
},
"transactionMetadata" : {
"externalId" : "6c8370a2-2559-4cc1-9faf-04a0b4d2ff52",
"externalData" : "UNRECONCILED"
}
}