get https://api.chartmogul.com/v1/invoices/
Retrieves an invoice
object from your ChartMogul account.
Examples
curl -X GET "https://api.chartmogul.com/v1/invoices/inv_565c73b2-85b9-49c9-a25e-2b7df6a677c9" \
-u YOUR_API_KEY:
ChartMogul::Invoice.retrieve("inv_565c73b2-85b9-49c9-a25e-2b7df6a677c9")
ChartMogul.Invoice.retrieve(config, "inv_565c73b2-85b9-49c9-a25e-2b7df6a677c9");
ChartMogul\Invoice::retrieve("inv_565c73b2-85b9-49c9-a25e-2b7df6a677c9");
api.RetrieveInvoice("inv_565c73b2-85b9-49c9-a25e-2b7df6a677c9")
chartmogul.Invoice.retrieve(config, uuid="inv_565c73b2-85b9-49c9-a25e-2b7df6a677c9")
Result Format
{
"uuid": "inv_565c73b2-85b9-49c9-a25e-2b7df6a677c9",
"customer_uuid": "cus_f466e33d-ff2b-4a11-8f85-417eb02157a7",
"external_id": "inv_0001",
"date": "2022-11-01T00:00:00.000Z",
"due_date": "2022-11-15T00:00:00.000Z",
"currency": "USD",
"line_items": [
{
"uuid": "li_d72e6843-5793-41d0-bfdf-0269514c9c56",
"external_id": null,
"type": "subscription",
"subscription_uuid": "sub_e6bc5407-e258-4de0-bb43-61faaf062035",
"subscription_external_id": "sub_0001",
"subscription_set_external_id": "set_0001",
"plan_uuid": "pl_eed05d54-75b4-431b-adb2-eb6b9e543206",
"prorated": false,
"service_period_start": "2022-11-01T00:00:00.000Z",
"service_period_end": "2022-12-01T00:00:00.000Z",
"amount_in_cents": 5000,
"quantity": 1,
"discount_code": "PSO86",
"discount_amount_in_cents": 1000,
"tax_amount_in_cents": 900,
"transaction_fees_in_cents": 200,
"transaction_fees_currency": "USD",
"discount_description": "New signup promo",
"event_order": 5,
"account_code": null
},
{
"uuid": "li_d72e6843-5793-41d0-bfdf-0269514c9c56",
"external_id": null,
"type": "one_time",
"description": "Setup Fees",
"amount_in_cents": 2500,
"quantity": 1,
"discount_code": "PSO86",
"discount_amount_in_cents": 500,
"tax_amount_in_cents": 450,
"transaction_fees_in_cents": 0,
"transaction_fees_currency": "USD",
"discount_description": "New signup promo",
"account_code": null
}
],
"transactions": [
{
"uuid": "tr_879d560a-1bec-41bb-986e-665e38a2f7bc",
"external_id": null,
"type": "payment",
"date": "2022-11-05T00:14:23.000Z",
"result": "successful"
}
]
}
#<ChartMogul::Invoice:0x007fb498a04660
@uuid="inv_565c73b2-85b9-49c9-a25e-2b7df6a677c9",
@customer_uuid="cus_f466e33d-ff2b-4a11-8f85-417eb02157a7",
@external_id="inv_0001",
@date=2022-11-01 00:00:00 UTC,
@due_date=2022-11-15 00:00:00 UTC,
@currency="USD",
@line_items=[
#<ChartMogul::LineItems::Subscription:0x007fb4994d23f8
@uuid="li_d72e6843-5793-41d0-bfdf-0269514c9c56",
@external_id=nil,
@type="subscription",
@subscription_uuid="sub_e6bc5407-e258-4de0-bb43-61faaf062035",
@subscription_external_id="sub_0001",
@subscription_set_external_id="set_0001",
@plan_uuid="pl_eed05d54-75b4-431b-adb2-eb6b9e543206",
@service_period_start=2022-11-01 00:00:00 UTC,
@service_period_end=2022-12-01 00:00:00 UTC,
@amount_in_cents=5000,
@quantity=1,
@discount_code="PSO86",
@discount_amount_in_cents=1000,
@tax_amount_in_cents=900,
@transaction_fees_in_cents=200,
@cancelled_at=nil,
@prorated=false,
@invoice_uuid="inv_565c73b2-85b9-49c9-a25e-2b7df6a677c9",
@transaction_fees_currency="USD",
@discount_description="New signup promo",
@event_order=5,
@account_code=nil
>,
#<ChartMogul::LineItems::OneTime:0x007fb499149358
@uuid="li_0cc8c112-beac-416d-af11-f35744ca4e83",
@external_id=nil,
@type="one_time",
@amount_in_cents=2500,
@description="Setup Fees",
@quantity=1,
@discount_amount_in_cents=500,
@discount_code="PSO86",
@tax_amount_in_cents=450,
@transaction_fees_in_cents=0,
@invoice_uuid="inv_565c73b2-85b9-49c9-a25e-2b7df6a677c9",
@transaction_fees_currency="USD",
@discount_description="New signup promo",
@account_code=nil
>
],
@transactions=[
#<ChartMogul::Transactions::Payment:0x007fb4991013f0
@uuid="tr_879d560a-1bec-41bb-986e-665e38a2f7bc",
@external_id=nil,
@date=2022-11-05 00:14:23 UTC,
@result="successful",
@type="payment",
@invoice_uuid="inv_565c73b2-85b9-49c9-a25e-2b7df6a677c9"
>
]
>
{
uuid: "inv_565c73b2-85b9-49c9-a25e-2b7df6a677c9",
customer_uuid: "cus_f466e33d-ff2b-4a11-8f85-417eb02157a7",
external_id: "inv_0001",
date: "2022-11-01T00:00:00.000Z",
due_date: "2022-11-15T00:00:00.000Z",
currency: "USD",
line_items: [
{
uuid: "li_d72e6843-5793-41d0-bfdf-0269514c9c56",
external_id: null,
type: "subscription",
subscription_uuid: "sub_e6bc5407-e258-4de0-bb43-61faaf062035",
subscription_external_id: "sub_0001",
subscription_set_external_id: "set_0001",
plan_uuid: "pl_eed05d54-75b4-431b-adb2-eb6b9e543206",
prorated: false,
service_period_start: "2022-11-01T00:00:00.000Z",
service_period_end: "2022-12-01T00:00:00.000Z",
amount_in_cents: 5000,
quantity: 1,
discount_code: "PSO86",
discount_amount_in_cents: 1000,
tax_amount_in_cents: 900,
transaction_fees_in_cents: 200,
transaction_fees_currency: "USD",
discount_description: "New signup promo",
event_order: 5,
account_code: null
},
{
uuid: "li_d72e6843-5793-41d0-bfdf-0269514c9c56",
external_id: null,
type: "one_time",
description: "Setup Fees",
amount_in_cents: 2500,
quantity: 1,
discount_code: "PSO86",
discount_amount_in_cents: 500,
tax_amount_in_cents: 450,
transaction_fees_in_cents: 0,
transaction_fees_currency: "USD",
discount_description: "New signup promo",
account_code: null
}
],
transactions: [
{
uuid: "tr_879d560a-1bec-41bb-986e-665e38a2f7bc",
external_id: null,
type: "payment",
date: "2022-11-05T00:14:23.000Z",
result: "successful"
}
]
}
ChartMogul\Invoice::__set_state(array(
"uuid" => "inv_565c73b2-85b9-49c9-a25e-2b7df6a677c9",
"customer_uuid" => "cus_f466e33d-ff2b-4a11-8f85-417eb02157a7",
"date" => "2022-11-01T00:00:00.000Z",
"external_id" => "inv_0001",
"due_date" => "2022-11-15T00:00:00.000Z",
"currency" => "USD",
"line_items" => Doctrine\Common\Collections\ArrayCollection::__set_state(array(
"elements" => array(
0 => ChartMogul\LineItems\Subscription::__set_state(array(
"type" => "subscription",
"subscription_external_id" => "sub_0001",
"subscription_set_external_id" => "set_0001",
"service_period_start" => "2022-11-01T00:00:00.000Z",
"service_period_end" => "2022-12-01T00:00:00.000Z",
"cancelled_at" => NULL,
"prorated" => false,
"subscription_uuid" => "sub_e6bc5407-e258-4de0-bb43-61faaf062035",
"plan_uuid" => "pl_eed05d54-75b4-431b-adb2-eb6b9e543206",
"uuid" => "li_d72e6843-5793-41d0-bfdf-0269514c9c56",
"amount_in_cents" => 5000,
"quantity" => 10,
"discount_amount_in_cents" => 1000,
"discount_code" => "PSO86",
"tax_amount_in_cents" => 900,
"transaction_fees_in_cents" => 200,
"external_id" => NULL,
"invoice_uuid" => NULL,
"transaction_fees_currency" => "USD",
"discount_description" => "New signup promo",
"event_order" => 5,
"account_code" => ""
)),
1 => ChartMogul\LineItems\OneTime::__set_state(array(
"type" => "one_time",
"description" => "Setup Fees",
"uuid" => "li_0cc8c112-beac-416d-af11-f35744ca4e83",
"amount_in_cents" => 2500,
"quantity" => 1,
"discount_amount_in_cents" => 500,
"discount_code" => "PSO86",
"tax_amount_in_cents" => 450,
"transaction_fees_in_cents" => 0,
"external_id" => NULL,
"invoice_uuid" => NULL,
"transaction_fees_currency" => "USD",
"discount_description" => "New signup promo",
"account_code" => ""
)),
),
)),
"transactions" => Doctrine\Common\Collections\ArrayCollection::__set_state(array(
"elements" => array(
0 => ChartMogul\Transactions\Payment::__set_state(array(
"type" => "payment",
"uuid" => "tr_879d560a-1bec-41bb-986e-665e38a2f7bc",
"date" => "2022-11-05T00:14:23.000Z",
"result" => "successful"
))
)
))
));
(*chartmogul.Invoice)(0xc04210a5a0)({
UUID: (string) (len=40) "inv_565c73b2-85b9-49c9-a25e-2b7df6a677c9",
CustomerUUID: (string) (len=40) "cus_f466e33d-ff2b-4a11-8f85-417eb02157a7",
Currency: (string) (len=3) "USD",
Date: (string) (len=24) "2022-11-01T00:00:00.000Z",
DueDate: (string) (len=24) "2022-11-15T00:00:00.000Z",
ExternalID: (string) (len=7) "inv_0001",
LineItems: ([]*chartmogul.LineItem) (len=2) {
(*chartmogul.LineItem)(0xc0421cb140)({
AmountInCents: (int) 5000,
CancelledAt: (string) "",
Description: (string) "",
DiscountAmountInCents: (int) 1000,
DiscountCode: (string) (len=5) "PSO86",
ExternalID: (string) "",
PlanUUID: (string) (len=39) "pl_eed05d54-75b4-431b-adb2-eb6b9e543206",
Prorated: (bool) false,
Quantity: (int) 1,
ServicePeriodEnd: (string) (len=24) "2022-12-01T00:00:00.000Z",
ServicePeriodStart: (string) (len=24) "2022-11-01T00:00:00.000Z",
SubscriptionExternalID: (string) "sub_0001",
SubscriptionUUID: (string) "sub_e6bc5407-e258-4de0-bb43-61faaf062035",
TaxAmountInCents: (int) 900,
TransactionFeesInCents: (int) 200,
TransactionFeesCurrency: (string) "USD",
DiscountDescription: (string) "New signup promo",
EventOrder: (int) 5,
Type: (string) (len=12) "subscription"
}),
(*chartmogul.LineItem)(0xc0421cb080)({
AmountInCents: (int) 2500,
CancelledAt: (string) "",
Description: (string) (len=10) "Setup Fees",
DiscountAmountInCents: (int) 500,
DiscountCode: (string) (len=5) "PSO86",
ExternalID: (string) "",
PlanUUID: (string) "",
Prorated: (bool) false,
Quantity: (int) 1,
ServicePeriodEnd: (string) "",
ServicePeriodStart: (string) "",
SubscriptionExternalID: (string) "sub_001",
SubscriptionSetExternalID: (string) "set_001",
SubscriptionUUID: (string) "",
TaxAmountInCents: (int) 450,
TransactionFeesInCents: (int) 0,
TransactionFeesCurrency: (string) "USD",
DiscountDescription: (string) "New signup promo",
Type: (string) (len=8) "one_time"
})
},
Transactions: ([]*chartmogul.Transaction) (len=1) {
(*chartmogul.Transaction)(0xc0420e2c00)(Transaction() successful payment (2022-11-05T00:14:23.000Z))
},
Errors: (*chartmogul.Errors)(<nil>)
})
<Invoice{
uuid="inv_565c73b2-85b9-49c9-a25e-2b7df6a677c9",
customer_uuid="cus_f466e33d-ff2b-4a11-8f85-417eb02157a7",
currency="USD",
date=datetime.datetime(2022, 11, 1, 0, 0),
due_date=datetime.datetime(2022, 11, 15, 0, 0),
external_id="inv_0001",
line_items=[
<LineItem{
account_code="",
amount_in_cents=5000,
discount_amount_in_cents=1000,
discount_code="PSO86",
external_id=None,
plan_uuid="pl_eed05d54-75b4-431b-adb2-eb6b9e543206",
prorated=False,
quantity=1,
service_period_end=datetime.datetime(2022, 12, 1, 0, 0),
service_period_start=datetime.datetime(2022, 11, 1, 0, 0),
subscription_uuid="sub_e6bc5407-e258-4de0-bb43-61faaf062035",
subscription_external_id="sub_0001",
subscription_set_external_id="set_0001",
tax_amount_in_cents=900,
transaction_fees_in_cents=200,
transaction_fees_currency="USD",
discount_description="New signup promo",
event_order=5,
type="subscription",
uuid="li_d72e6843-5793-41d0-bfdf-0269514c9c56"
}>,
<LineItem{
account_code="",
amount_in_cents=2500,
discount_amount_in_cents=500,
discount_code="PSO86",
external_id=None,
quantity=1,
tax_amount_in_cents=450,
transaction_fees_in_cents=0,
transaction_fees_currency="USD",
discount_description="New signup promo",
type="one_time",
uuid="li_d72e6843-5793-41d0-bfdf-0269514c9c56"
}>
],
transactions=[
<Transaction{
date=datetime.datetime(2022, 11, 5, 0, 14, 23),
external_id=None,
result="successful",
type="payment",
uuid="tr_879d560a-1bec-41bb-986e-665e38a2f7bc"
}>
]
}>
In the response, the JSON
object contains the following data:
uuid
- The UUID of theinvoice
object generated by ChartMogul.customer_uuid
- The UUID of thecustomer
that the invoice belongs to.external_id
- The unique external identifier for this invoice, as specified by you.date
- The date on which this invoice was raised, as specified by you.due_date
- The date within which this invoice must be paid, as specified by you.currency
- The 3-letter code of the currency of this invoice, as specified by you.line_items
contains an array ofline_item
objects of thisinvoice
with the following data:uuid
- The UUID of theline_item
object generated by ChartMogul.external_id
- The unique external identifier for this line item, as specified by you.type
- The type of line item - one ofsubscription
orone_time
, as specified by you.subscription_uuid
- The UUID of thesubscription
object generated by ChartMogul.subscription_set_external_id
- An optional unique external identifier for the subscription set to which this subscription belongs, as specified by yousubscription_external_id
- The unique external identifier for this subscription, as specified by you.plan_uuid
- The UUID of theplan
object associated with the abovesubscription
object. Generated by ChartMogul.prorated
- A boolean stating whether or not this is a prorated charge for thesubscription
object, as specified by you.service_period_start
- The start of the service period for which thesubscription
is being charged, as specified by you.service_period_end
- The end of the service period for which thesubscription
is being charged, as specified by you.description
- A short description of theone_time
line item being charged to the customer, as specified by you.amount_in_cents
- The amount in cents charged towards this line item for the specified service period, after discounts and taxes have been applied. Specified by you.quantity
- The quantity of this line item being billed.discount_code
- A reference code for any discount applied to this line item, as specified by you.discount_amount_in_cents
- The discount amount in cents for this line item if any, as specified by you.tax_amount_in_cents
- The tax amount in cents for this line item if any, as specified by you.transaction_fees_in_cents
- The transaction fees in cents for this line item if any, as specified by you.transaction_fees_currency
- The transaction fees currency for this line item if any, as specified by you.discount_description
- The discount amount in cents description for this line item if any, as specified by you.event_order
- The event_order for ordering events that happen at the same time if any as specified by you.account_code
- The accounting code for the line item, as specified by you.
transactions
contains an array oftransaction
objects of thisinvoice
with the following data:uuid
- The UUID of thetransaction
object generated by ChartMogul.external_id
- The unique external identifier for this transaction, as specified by you.type
- One ofpayment
orrefund
, as specified by you.date
- The timestamp of when the transaction was attempted, as specified by you.result
- The result of the transaction attempt. One ofsuccessful
orfailed
, as specified by you.amount_in_cents
- The amount partially paid/refunded for this transaction.