Skip to content

Latest commit

 

History

History
525 lines (393 loc) · 23.8 KB

File metadata and controls

525 lines (393 loc) · 23.8 KB

Invoices

Overview

Available Operations

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/invoices.write scope.

  • listInvoices - List all the invoices created under a Moov account.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/invoices.read scope.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/invoices.read scope.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/invoices.write scope.

  • delete - Delete an invoice. Only invoices in draft status can be deleted.

Deleting an invoice indicates it was created by mistake and should be completely disregarded. Deleted invoices are hidden from list results by default, but can still be retrieved individually through the get invoice endpoint. If you need to void an invoice that was already sent or is otherwise part of the invoice history, cancel it instead by updating its status to canceled.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/invoices.write scope.

  • createInvoicePayment - Creates a payment resource to represent that an invoice was paid outside of the Moov platform. If a payment link was created for the invoice, the corresponding payment link is canceled, but a receipt is still sent.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/invoices.write scope.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/invoices.read scope.

createInvoice

Create an invoice for a Moov account.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/invoices.write scope.

Example Usage

package hello.world;

import io.moov.sdk.Moov;
import io.moov.sdk.models.components.*;
import io.moov.sdk.models.errors.CreateInvoiceError;
import io.moov.sdk.models.errors.GenericError;
import io.moov.sdk.models.operations.CreateInvoiceResponse;
import java.lang.Exception;
import java.time.OffsetDateTime;
import java.util.List;

public class Application {

    public static void main(String[] args) throws GenericError, CreateInvoiceError, Exception {

        Moov sdk = Moov.builder()
                .security(Security.builder()
                    .username("")
                    .password("")
                    .build())
            .build();

        CreateInvoiceResponse res = sdk.invoices().createInvoice()
                .accountID("c463fb80-6410-48b7-9e2e-6e9ec58a654f")
                .createInvoice(CreateInvoice.builder()
                    .customerAccountID("3dfff852-927d-47e8-822c-2fffc57ff6b9")
                    .lineItems(CreateInvoiceLineItems.builder()
                        .items(List.of(
                            CreateInvoiceLineItem.builder()
                                .name("Professional Services")
                                .basePrice(AmountDecimal.builder()
                                    .currency("USD")
                                    .valueDecimal("1000.00")
                                    .build())
                                .quantity(1)
                                .build()))
                        .build())
                    .description("Professional services for Q1 2026")
                    .invoiceDate(OffsetDateTime.parse("2026-01-15T00:00:00Z"))
                    .dueDate(OffsetDateTime.parse("2026-02-15T00:00:00Z"))
                    .taxAmount(AmountDecimal.builder()
                        .currency("USD")
                        .valueDecimal("80.00")
                        .build())
                    .build())
                .call();

        if (res.invoice().isPresent()) {
            System.out.println(res.invoice().get());
        }
    }
}

Parameters

Parameter Type Required Description
accountID String ✔️ N/A
createInvoice CreateInvoice ✔️ N/A

Response

CreateInvoiceResponse

Errors

Error Type Status Code Content Type
models/errors/GenericError 400, 409 application/json
models/errors/CreateInvoiceError 422 application/json
models/errors/APIException 4XX, 5XX */*

listInvoices

List all the invoices created under a Moov account.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/invoices.read scope.

Example Usage

package hello.world;

import io.moov.sdk.Moov;
import io.moov.sdk.models.components.Security;
import io.moov.sdk.models.errors.ListInvoicesValidationError;
import io.moov.sdk.models.operations.ListInvoicesRequest;
import io.moov.sdk.models.operations.ListInvoicesResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws ListInvoicesValidationError, Exception {

        Moov sdk = Moov.builder()
                .security(Security.builder()
                    .username("")
                    .password("")
                    .build())
            .build();

        ListInvoicesRequest req = ListInvoicesRequest.builder()
                .accountID("114b02db-e4ca-47de-acc9-5624f4afccb5")
                .skip(60L)
                .count(20L)
                .build();

        ListInvoicesResponse res = sdk.invoices().listInvoices()
                .request(req)
                .call();

        if (res.invoices().isPresent()) {
            System.out.println(res.invoices().get());
        }
    }
}

Parameters

Parameter Type Required Description
request ListInvoicesRequest ✔️ The request object to use for the request.

Response

ListInvoicesResponse

Errors

Error Type Status Code Content Type
models/errors/ListInvoicesValidationError 422 application/json
models/errors/APIException 4XX, 5XX */*

getInvoice

Retrieve an invoice by ID.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/invoices.read scope.

Example Usage

package hello.world;

import io.moov.sdk.Moov;
import io.moov.sdk.models.components.Security;
import io.moov.sdk.models.operations.GetInvoiceResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws Exception {

        Moov sdk = Moov.builder()
                .security(Security.builder()
                    .username("")
                    .password("")
                    .build())
            .build();

        GetInvoiceResponse res = sdk.invoices().getInvoice()
                .accountID("3ecce96f-a052-4c96-b389-98e880af1ab4")
                .invoiceID("fc90d016-39ea-4110-b77a-2e1c95827f46")
                .call();

        if (res.invoice().isPresent()) {
            System.out.println(res.invoice().get());
        }
    }
}

Parameters

Parameter Type Required Description
accountID String ✔️ N/A
invoiceID String ✔️ N/A

Response

GetInvoiceResponse

Errors

Error Type Status Code Content Type
models/errors/APIException 4XX, 5XX */*

updateInvoice

Updates an invoice.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/invoices.write scope.

Example Usage

package hello.world;

import io.moov.sdk.Moov;
import io.moov.sdk.models.components.*;
import io.moov.sdk.models.errors.GenericError;
import io.moov.sdk.models.errors.UpdateInvoiceError;
import io.moov.sdk.models.operations.UpdateInvoiceResponse;
import java.lang.Exception;
import java.time.OffsetDateTime;
import java.util.List;

public class Application {

    public static void main(String[] args) throws GenericError, UpdateInvoiceError, Exception {

        Moov sdk = Moov.builder()
                .security(Security.builder()
                    .username("")
                    .password("")
                    .build())
            .build();

        UpdateInvoiceResponse res = sdk.invoices().updateInvoice()
                .accountID("fcce46d6-5a85-404a-afa3-f7303401bd08")
                .invoiceID("3eef5109-9937-40a3-b507-d5bc81fc02a2")
                .updateInvoice(UpdateInvoice.builder()
                    .description("Updated professional services for Q1 2026")
                    .lineItems(CreateInvoiceLineItemsUpdate.builder()
                        .items(List.of(
                            CreateInvoiceLineItem.builder()
                                .name("Professional Services")
                                .basePrice(AmountDecimal.builder()
                                    .currency("USD")
                                    .valueDecimal("1000.00")
                                    .build())
                                .quantity(1)
                                .build()))
                        .build())
                    .invoiceDate(OffsetDateTime.parse("2026-01-16T00:00:00Z"))
                    .dueDate(OffsetDateTime.parse("2026-02-16T00:00:00Z"))
                    .build())
                .call();

        if (res.invoice().isPresent()) {
            System.out.println(res.invoice().get());
        }
    }
}

Parameters

Parameter Type Required Description
accountID String ✔️ N/A
invoiceID String ✔️ N/A
updateInvoice UpdateInvoice ✔️ N/A

Response

UpdateInvoiceResponse

Errors

Error Type Status Code Content Type
models/errors/GenericError 400, 409 application/json
models/errors/UpdateInvoiceError 422 application/json
models/errors/APIException 4XX, 5XX */*

delete

Delete an invoice. Only invoices in draft status can be deleted.

Deleting an invoice indicates it was created by mistake and should be completely disregarded. Deleted invoices are hidden from list results by default, but can still be retrieved individually through the get invoice endpoint. If you need to void an invoice that was already sent or is otherwise part of the invoice history, cancel it instead by updating its status to canceled.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/invoices.write scope.

Example Usage

package hello.world;

import io.moov.sdk.Moov;
import io.moov.sdk.models.components.Security;
import io.moov.sdk.models.errors.GenericError;
import io.moov.sdk.models.operations.DeleteInvoiceResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws GenericError, Exception {

        Moov sdk = Moov.builder()
                .security(Security.builder()
                    .username("")
                    .password("")
                    .build())
            .build();

        DeleteInvoiceResponse res = sdk.invoices().delete()
                .accountID("<id>")
                .invoiceID("<id>")
                .call();

        // handle response
    }
}

Parameters

Parameter Type Required Description
accountID String ✔️ N/A
invoiceID String ✔️ N/A

Response

DeleteInvoiceResponse

Errors

Error Type Status Code Content Type
models/errors/GenericError 400, 409 application/json
models/errors/APIException 4XX, 5XX */*

createInvoicePayment

Creates a payment resource to represent that an invoice was paid outside of the Moov platform. If a payment link was created for the invoice, the corresponding payment link is canceled, but a receipt is still sent.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/invoices.write scope.

Example Usage

package hello.world;

import io.moov.sdk.Moov;
import io.moov.sdk.models.components.*;
import io.moov.sdk.models.errors.CreateInvoicePaymentError;
import io.moov.sdk.models.errors.GenericError;
import io.moov.sdk.models.operations.CreateInvoicePaymentResponse;
import java.lang.Exception;
import java.time.OffsetDateTime;

public class Application {

    public static void main(String[] args) throws GenericError, CreateInvoicePaymentError, Exception {

        Moov sdk = Moov.builder()
                .security(Security.builder()
                    .username("")
                    .password("")
                    .build())
            .build();

        CreateInvoicePaymentResponse res = sdk.invoices().createInvoicePayment()
                .accountID("e02333e4-a835-46d1-8d02-9af7a405e65f")
                .invoiceID("99e7ebb0-9996-49b2-98f0-304c7332ece6")
                .createInvoicePayment(CreateInvoicePayment.builder()
                    .amount(AmountDecimal.builder()
                        .currency("USD")
                        .valueDecimal("500.00")
                        .build())
                    .foreignID("EXT-PAY-12345")
                    .description("Payment received via wire transfer")
                    .paymentDate(OffsetDateTime.parse("2026-01-20T14:45:00Z"))
                    .build())
                .call();

        if (res.invoicePayment().isPresent()) {
            System.out.println(res.invoicePayment().get());
        }
    }
}

Parameters

Parameter Type Required Description
accountID String ✔️ N/A
invoiceID String ✔️ N/A
createInvoicePayment CreateInvoicePayment ✔️ N/A

Response

CreateInvoicePaymentResponse

Errors

Error Type Status Code Content Type
models/errors/GenericError 400, 409 application/json
models/errors/CreateInvoicePaymentError 422 application/json
models/errors/APIException 4XX, 5XX */*

listInvoicePayments

List all the payments made towards an invoice.

To access this endpoint using an access token you'll need to specify the /accounts/{accountID}/invoices.read scope.

Example Usage

package hello.world;

import io.moov.sdk.Moov;
import io.moov.sdk.models.components.Security;
import io.moov.sdk.models.operations.ListInvoicePaymentsResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws Exception {

        Moov sdk = Moov.builder()
                .security(Security.builder()
                    .username("")
                    .password("")
                    .build())
            .build();

        ListInvoicePaymentsResponse res = sdk.invoices().listInvoicePayments()
                .accountID("dcfbb04d-465e-4dbc-ad14-420961d94d21")
                .invoiceID("d25d8b7f-bb29-420c-8185-4ed9df60ba13")
                .call();

        if (res.invoicePayments().isPresent()) {
            System.out.println(res.invoicePayments().get());
        }
    }
}

Parameters

Parameter Type Required Description
accountID String ✔️ N/A
invoiceID String ✔️ N/A

Response

ListInvoicePaymentsResponse

Errors

Error Type Status Code Content Type
models/errors/APIException 4XX, 5XX */*