invoiced-java
This repository contains the Java client library for the Invoiced API.
You can find detailed API documentation along with java code snippets here.
Installing
You can build the jar file by doing
gradle jar
or build the complete all in one jar file by doing
gradle fatJar
Requirements
- Gradle 5.6.4
- Java 8+
Usage
First, you must instantiate a new client
import com.invoiced.entity.Connection;
Connection invoiced = new Connection("{YOUR_API_KEY}",false);
Then, API calls can be made like this:
# retrieve invoice
Invoice invoice = invoiced.newInvoice().retrieve({INVOICE_ID});
# mark as paid
Payment payment = invoiced.newPayment();
payment.amount = invoice.balance;
payment.method = "check";
paymentItem = new PaymentItem();
paymentItem.type = "invoice";
paymentItem.invoice = invoice.id;
paymentItem.amount = invoice.balance;
payment.appliedTo = PaymentItem{paymentItem};
payment.create();
If you want to use the sandbox API instead then you must set the second argument on the client to true
like this:
import com.invoiced.entity.Connection;
Connection invoiced = new Connection("{YOUR_API_KEY}",true);
Developing
The test suite can be ran with gradle test
Deployment
Here is a useful guide for deploying to Maven.