Billing Management API (1.0)

Download OpenAPI specification:Download

This is a sample Spring Boot RESTful service using springdoc-openapi and OpenAPI 3.

Payments

Payment management API

Get all payments

Returns a list of all payments.

Sample curl command:

curl -X GET "http://localhost:8080/api/payments" \
     -H "accept: application/json"

Responses

Response samples

Content type
application/json
{
  • "id": 5001,
  • "customerId": 1,
  • "invoiceId": 1001,
  • "amount": 199.99,
  • "method": "Credit Card",
  • "status": "COMPLETED",
  • "date": "2023-12-01"
}

Add a new payment

Creates a new payment.

Sample curl command:

curl -X POST "http://localhost:8080/api/payments" \
     -H "accept: application/json" \
     -H "Content-Type: application/json" \
     -d '{
         "customerId":1,
         "invoiceId":1001,
         "amount":199.99,
         "method":"Credit Card",
         "status":"COMPLETED",
         "date":"2023-12-01"
     }'
Request Body schema: application/json
required

Payment to be added

id
integer <int64>

Unique identifier of the payment

customerId
integer <int64>

Customer ID associated with the payment

invoiceId
integer <int64>

Invoice ID associated with the payment

amount
number <double>

Amount of the payment

method
string

Payment method

status
string

Payment status

date
string

Payment date

Responses

Request samples

Content type
application/json
{
  • "id": 5001,
  • "customerId": 1,
  • "invoiceId": 1001,
  • "amount": 199.99,
  • "method": "Credit Card",
  • "status": "COMPLETED",
  • "date": "2023-12-01"
}

Response samples

Content type
application/json
{
  • "id": 5001,
  • "customerId": 1,
  • "invoiceId": 1001,
  • "amount": 199.99,
  • "method": "Credit Card",
  • "status": "COMPLETED",
  • "date": "2023-12-01"
}

Get payments by customer ID

Returns a list of all payments associated with a specific customer.

Sample curl command:

curl -X GET "http://localhost:8080/api/customers/1/payments" \
     -H "accept: application/json"
path Parameters
customerId
required
string
Example: 1

ID of the customer to retrieve payments for

Responses

Response samples

Content type
application/json
{
  • "id": 5001,
  • "customerId": 1,
  • "invoiceId": 1001,
  • "amount": 199.99,
  • "method": "Credit Card",
  • "status": "COMPLETED",
  • "date": "2023-12-01"
}

Invoices

Invoice management API

Get all invoices

Returns a list of all invoices.

Sample curl command:

curl -X GET "http://localhost:8080/api/invoices" \
     -H "accept: application/json"

Responses

Response samples

Content type
application/json
{
  • "id": 1001,
  • "customerId": 1,
  • "amount": 199.99,
  • "status": "PAID",
  • "dueDate": "2023-12-31",
  • "description": "Monthly subscription fee"
}

Add a new invoice

Creates a new invoice.

Sample curl command:

curl -X POST "http://localhost:8080/api/invoices" \
     -H "accept: application/json" \
     -H "Content-Type: application/json" \
     -d '{
         "customerId":1,
         "amount":199.99,
         "status":"PAID",
         "dueDate":"2023-12-31",
         "description":"Monthly subscription fee"
     }'
Request Body schema: application/json
required

Invoice to be added

id
integer <int64>

Unique identifier of the invoice

customerId
integer <int64>

Customer ID associated with the invoice

amount
number <double>

Amount of the invoice

status
string

Status of the invoice

dueDate
string

Due date of the invoice

description
string

Description of the invoice

Responses

Request samples

Content type
application/json
{
  • "id": 1001,
  • "customerId": 1,
  • "amount": 199.99,
  • "status": "PAID",
  • "dueDate": "2023-12-31",
  • "description": "Monthly subscription fee"
}

Response samples

Content type
application/json
{
  • "id": 1001,
  • "customerId": 1,
  • "amount": 199.99,
  • "status": "PAID",
  • "dueDate": "2023-12-31",
  • "description": "Monthly subscription fee"
}

Get invoices by customer ID

Returns a list of all invoices associated with a specific customer.

Sample curl command:

curl -X GET "http://localhost:8080/api/customers/1/invoices" \
     -H "accept: application/json"
path Parameters
customerId
required
string
Example: 1

ID of the customer to retrieve invoices for

Responses

Response samples

Content type
application/json
{
  • "id": 1001,
  • "customerId": 1,
  • "amount": 199.99,
  • "status": "PAID",
  • "dueDate": "2023-12-31",
  • "description": "Monthly subscription fee"
}

Customers

Customer management API

Get all customers

Returns a list of all registered customers.

Sample curl command:

curl -X GET "http://localhost:8080/api/customers" \
     -H "accept: application/json"

Responses

Response samples

Content type
application/json
{
  • "id": 1,
  • "name": "John Doe",
  • "email": "john.doe@example.com",
  • "phone": "+1234567890",
  • "addresses": [
    ]
}

Add a new customer

Creates a new customer.

Sample curl command:

curl -X POST "http://localhost:8080/api/customers" \
     -H "accept: application/json" \
     -H "Content-Type: application/json" \
     -d '{
         "name":"Taro Yamada",
         "email":"taro.yamada@example.com",
         "phone":"+819012345678",
         "addresses":[
             {
                 "street":"123 Main St",
                 "city":"Tokyo",
                 "state":"Tokyo",
                 "postalCode":"100-0001",
                 "country":"Japan"
             }
         ]
     }'
Request Body schema: application/json
required

Customer to be added

id
integer <int64>

Unique identifier of the customer

name
string

Name of the customer

email
string

Email of the customer

phone
string

Customer's phone number

Array of objects (Address)

List of addresses associated with the customer

Responses

Request samples

Content type
application/json
{
  • "id": 1,
  • "name": "John Doe",
  • "email": "john.doe@example.com",
  • "phone": "+1234567890",
  • "addresses": [
    ]
}

Response samples

Content type
application/json
{
  • "id": 1,
  • "name": "John Doe",
  • "email": "john.doe@example.com",
  • "phone": "+1234567890",
  • "addresses": [
    ]
}