Credit Balances
Invoiced contains an account credit system that lets you grant credits to customers which can be applied to future invoices. Credits can be automatically applied to new invoices or applied at your direction, depending on your Invoiced settings.
Credits are added to a customer account with a Payment or Adjustment. They can then be applied to invoices with a Payment.
Credit Balance Adjustment Object
A credit balance adjustment allows you to add credits to a customer account when there was no payment. For example, if there was a service outage or a referral credit owed then it can be reflected with an adjustment.
Attributes
{
"amount": 50,
"created_at": 1607550710,
"currency": "usd",
"customer": 78,
"date": 1607550710,
"id": 717,
"notes": null,
"object": "credit_balance_adjustment"
}
Parameter | Type | Description |
---|---|---|
id | string | The adjustment's unique ID |
object | string | Object type, credit_balance_adjustment |
customer | number | Customer ID |
currency | string | 3-letter ISO code |
amount | number | Adjustment amount |
date | timestamp | Adjustment date |
notes | string | Notes |
created_at | timestamp | Timestamp when created |
updated_at | timestamp | Timestamp when updated |
Create a credit balance adjustment
curl "https://api.invoiced.com/credit_balance_adjustments" \
-u {API_KEY}: \
-d customer=78 \
-d amount=50
invoiced.CreditBalanceAdjustment.create(
:customer => 78,
:amount => 50
)
<?php
$invoiced->CreditBalanceAdjustment->create([
'customer' => 78,
'amount' => 50
]);
client.CreditBalanceAdjustment.create(
customer=78,
amount=49
)
CreditBalanceAdjustment creditBalanceAdjustment = invoiced.newCreditBalanceAdjustment();
creditBalanceAdjustment.customer = 78L;
creditBalanceAdjustment.amount = 50;
creditBalanceAdjustment.create();
var creditBalanceAdjustment = invoiced.NewCreditBalanceAdjustment();
creditBalanceAdjustment.Customer = 78;
creditBalanceAdjustment.Amount = 50;
creditBalanceAdjustment.Create();
creditBalanceAdjustment, err := client.CreditBalanceAdjustment.Create(&invoiced.CreditBalanceAdjustmentRequest{
Customer: invoiced.Int64(78),
Amount: invoiced.Float64(50),
})
The above command returns JSON structured like this:
{
"amount": 50,
"created_at": 1607550710,
"currency": "usd",
"customer": 78,
"date": 1607550710,
"id": 717,
"notes": null,
"object": "credit_balance_adjustment"
}
Create a new credit balance adjustment with this endpoint.
HTTP Request
POST /credit_balance_adjustments
Attributes
Parameter | Type | Description |
---|---|---|
customer | number | Customer ID |
currency | string | 3-letter ISO code |
amount | number | Adjustment amount |
date | timestamp | Adjustment date |
notes | string | Notes |
Retrieve a credit balance adjustment
curl "https://api.invoiced.com/credit_balance_adjustments/:id" \
-u {API_KEY}:
creditBalanceAdjustment = invoiced.CreditBalanceAdjustment.retrieve("{ADJUSTMENT_ID}")
<?php
$creditBalanceAdjustment = $invoiced->CreditBalanceAdjustment->retrieve("{ADJUSTMENT_ID}");
creditBalanceAdjustment = client.CreditBalanceAdjustment.retrieve("{ADJUSTMENT_ID}")
CreditBalanceAdjustment creditBalanceAdjustment = invoiced.newCreditBalanceAdjustment().retrieve({ADJUSTMENT_ID});
var creditBalanceAdjustment = invoiced.NewCreditBalanceAdjustment().Retrieve({ADJUSTMENT_ID});
creditBalanceAdjustment, err := client.CreditBalanceAdjustment.Retrieve({ADJUSTMENT_ID})
The above command returns JSON structured like this:
{
"amount": 50,
"created_at": 1607550710,
"currency": "usd",
"customer": 78,
"date": 1607550710,
"id": 717,
"notes": null,
"object": "credit_balance_adjustment"
}
This endpoint retrieves a specific credit balance adjustment.
HTTP Request
GET /credit_balance_adjustments/:id
Update a credit balance adjustment
curl "https://api.invoiced.com/credit_balance_adjustments/:id" \
-u {API_KEY}: \
-X PATCH \
-d notes="Service outage on 12/9/2020"
creditBalanceAdjustment.notes = "Service outage on 12/9/2020"
creditBalanceAdjustment.save
<?php
$creditBalanceAdjustment->notes = "Service outage on 12/9/2020";
$creditBalanceAdjustment->save();
creditBalanceAdjustment.notes = "Service outage on 12/9/2020"
creditBalanceAdjustment.save()
creditBalanceAdjustment.notes = "Service outage on 12/9/2020";
creditBalanceAdjustment.save();
creditBalanceAdjustment.Notes = "Service outage on 12/9/2020";
creditBalanceAdjustment.SaveAll();
err := invoiced.CreditBalanceAdjustment.Update({ADJUSTMENT_ID}, &invoiced.CreditBalanceAdjustmentRequest{
Notes: invoiced.String("Service outage on 12/9/2020"),
})
The above command returns JSON structured like this:
{
"amount": 50,
"created_at": 1607550710,
"currency": "usd",
"customer": 78,
"date": 1607550710,
"id": 717,
"notes": null,
"object": "credit_balance_adjustment"
}
Use this endpoint to update a credit balance adjustment.
The properties that can be updated via this endpoint are limited. For other updates, it is necessary to delete and recreate the credit balance adjustment.
HTTP Request
PATCH /credit_balance_adjustments/:id
Attributes
Parameter | Type | Description |
---|---|---|
customer | number | Customer ID |
currency | string | 3-letter ISO code |
amount | number | Adjustment amount |
date | timestamp | Adjustment date |
notes | string | Notes |
Delete a credit balance adjustment
curl "https://api.invoiced.com/credit_balance_adjustments/:id" \
-u {API_KEY}: \
-X DELETE
creditBalanceAdjustment.delete
<?php
$creditBalanceAdjustment->delete();
creditBalanceAdjustment.delete()
creditBalanceAdjustment.delete();
creditBalanceAdjustment.Delete();
err := client.CreditBalanceAdjustment.Delete({ADJUSTMENT_ID})
The above command returns
204 No Content
This endpoint deletes a specific credit balance adjustment.
HTTP Request
DELETE /credit_balance_adjustments/:id
List all credit balance adjustments
curl "https://api.invoiced.com/credit_balance_adjustments" \
-u {API_KEY}:
items, metadata = invoiced.CreditBalanceAdjustment.list(:per_page => 3)
<?php
list($creditBalanceAdjustments, $metadata) = $invoiced->CreditBalanceAdjustment->all(['per_page' => 3]);
creditBalanceAdjustments, metadata = client.CreditBalanceAdjustment.list(per_page=3)
EntityList<CreditBalanceAdjustment> creditBalanceAdjustments = conn.newCreditBalanceAdjustment().listAll();
var creditBalanceAdjustments = invoiced.NewCreditBalanceAdjustment().ListAll();
creditBalanceAdjustments, err := client.CreditBalanceAdjustment.ListAll(nil, nil)
The above command returns JSON structured like this:
[
{
"amount": 50,
"created_at": 1607550710,
"currency": "usd",
"customer": 78,
"date": 1607550710,
"id": 717,
"notes": null,
"object": "credit_balance_adjustment"
}
]
This endpoint retrieves all credit balance adjustments.
HTTP Request
GET /credit_balance_adjustments