Invoices

The section containing the endpoints for invoice management. Notice that when we create an invoice, we create an invoice in Stripe for the selected user. Then, after the invoice is created in Stripe, we receive the payment result of that invoice on the webhook, and then we create and manage the invoice in our database.

Get invoices

GET {{BASE_URL}}/admin/api/invoices

Get all invoices for all teams

Query Parameters

Name
Type
Description

page*

String

1

limit*

String

5

Headers

Name
Type
Description

Api-Key*

String

Admin api key

{
    "invoices": [
        {
            "_id": "65490130ff600e06af2a9694",
            "invoiceId": "in_1O9UOhA0ZUrt0vQJoum7M20X",
            "user": {
                "_id": "6548a41138406c14db33b606",
                "name": "John Doe"
            },
            "status": "paid",
            "amount": 3300,
            "invoicePdf": "https://pay.stripe.com/invoice/acct_1NOaelA0ZUrt0vQJ/test_YWNjdF8xTk9hZWxBMFpVcnQwdlFKLF9PeFBENUF5elR4cDU3bU5ycVVreUVuVVd3dm5hTmhnLDg5ODI0MDY202009yaqn40z/pdf?s=ap",
            "createdAt": "2023-11-06T15:07:28.550Z",
            "updatedAt": "2023-11-06T15:07:46.295Z"
        }
    ],
    "count": 1
}

Get invoice

GET {{BASE_URL}}/admin/api/invoices/{id}

Get a specific invoice by unique id.

Path Parameters

Name
Type
Description

id

String

Invoice ID

Query Parameters

Name
Type
Description

page*

String

1

limit*

String

5

Headers

Name
Type
Description

Api-Key*

String

Admin api key

{
    "_id": "65490130ff600e06af2a9694",
    "invoiceId": "in_1O9UOhA0ZUrt0vQJoum7M20X",
    "user": {
        "_id": "6548a41138406c14db33b606",
        "name": "John Doe"
    },
    "status": "paid",
    "amount": 3300,
    "invoicePdf": "https://pay.stripe.com/invoice/acct_1NOaelA0ZUrt0vQJ/test_YWNjdF8xTk9hZWxBMFpVcnQwdlFKLF9PeFBENUF5elR4cDU3bU5ycVVreUVuVVd3dm5hTmhnLDg5ODI0MDY202009yaqn40z/pdf?s=ap",
    "createdAt": "2023-11-06T15:07:28.550Z",
    "updatedAt": "2023-11-06T15:07:46.295Z"
}

Create invoice

POST {{BASE_URL}}/admin/api/invoices

Create an invoice for a specific team.

Headers

Name
Type
Description

Api-Key*

String

Admin api key

Request Body

Name
Type
Description

data*

Object

{
    "id": "in_1O9oovA0ZUrt0vQJ2CDhxoy4",
    "object": "invoice",
    "account_country": "US",
    "account_name": "Rezet",
    "account_tax_ids": null,
    "amount_due": 0,
    "amount_paid": 0,
    "amount_remaining": 0,
    "amount_shipping": 0,
    "application": null,
    "application_fee_amount": null,
    "attempt_count": 0,
    "attempted": false,
    "auto_advance": true,
    "automatic_tax": {
        "enabled": false,
        "status": null
    },
    "billing_reason": "manual",
    "charge": null,
    "collection_method": "charge_automatically",
    "created": 1699361753,
    "currency": "eur",
    "custom_fields": null,
    "customer": "cus_OxIokju2aarNVm",
    "customer_address": {
        "city": "Test",
        "country": "Afghanistan",
        "line1": "Test",
        "line2": "test1",
        "postal_code": "34334",
        "state": "Test"
    },
    "customer_email": "john.doe@mail.com",
    "customer_name": "John Doe",
    "customer_phone": null,
    "customer_shipping": null,
    "customer_tax_exempt": "none",
    "customer_tax_ids": [],
    "default_payment_method": "pm_1O9OCiA0ZUrt0vQJ7GqrPclY",
    "default_source": null,
    "default_tax_rates": [],
    "description": "Enclaive resources payment",
    "discount": null,
    "discounts": [],
    "due_date": null,
    "effective_at": null,
    "ending_balance": null,
    "footer": "Building confidential computing technology to shield workload in the cloud, leveraging Intel SGX/TDX, AMD SEV, RISC-V Salus and soon ARM-CCA.",
    "from_invoice": null,
    "hosted_invoice_url": null,
    "invoice_pdf": null,
    "last_finalization_error": null,
    "latest_revision": null,
    "lines": {
        "object": "list",
        "data": [],
        "has_more": false,
        "total_count": 0,
        "url": "/v1/invoices/in_1O9oovA0ZUrt0vQJ2CDhxoy4/lines"
    },
    "livemode": false,
    "metadata": {},
    "next_payment_attempt": 1699365353,
    "number": null,
    "on_behalf_of": null,
    "paid": false,
    "paid_out_of_band": false,
    "payment_intent": null,
    "payment_settings": {
        "default_mandate": null,
        "payment_method_options": null,
        "payment_method_types": null
    },
    "period_end": 1699361753,
    "period_start": 1699361753,
    "post_payment_credit_notes_amount": 0,
    "pre_payment_credit_notes_amount": 0,
    "quote": null,
    "receipt_number": null,
    "rendering": {
        "amount_tax_display": null,
        "pdf": {
            "page_size": "auto"
        }
    },
    "rendering_options": null,
    "shipping_cost": null,
    "shipping_details": null,
    "starting_balance": 0,
    "statement_descriptor": null,
    "status": "draft",
    "status_transitions": {
        "finalized_at": null,
        "marked_uncollectible_at": null,
        "paid_at": null,
        "voided_at": null
    },
    "subscription": null,
    "subscription_details": {
        "metadata": null
    },
    "subtotal": 0,
    "subtotal_excluding_tax": 0,
    "tax": null,
    "test_clock": null,
    "total": 0,
    "total_discount_amounts": [],
    "total_excluding_tax": 0,
    "total_tax_amounts": [],
    "transfer_data": null,
    "webhooks_delivered_at": null
}
Request payload
{
    "items": [
        {
            "name": " All resources",
            "amount": 1
        }
    ],
    "customer": "cus_OxIokju2aarNVm",
    "paymentMethod": "pm_1O9OCiA0ZUrt0vQJ7GqrPclY"
}

Last updated