accounting

Stable. Describes behaviour that is built and covered by tests in this repository.

API reference

GET /v1/accounting/summary #

Income and expenses of a period, one block per currency

Currencies are never converted or added together. Income is read from the invoices: an invoice counts on the UTC day its payment succeeded (gross is its total, tax its TAX lines), credit notes against paid invoices and invoices refunded in full are the refunds. Provider commission is not recorded by Payrudder; provider_fees_minor is what the tenant entered as payment_fees expenses, and provider_fees_recorded is false when there is none. expenses_minor includes those fees. profit_minor is net income minus expenses. The series has one point for every day (or month) of the period. app_id limits the expenses, not the income.

Parameters

NameInTypeDescription
from requiredquerystring · dateFirst day, inside the period
to requiredquerystring · dateLast day, inside the period; at most five years after `from`
app_idquerystring · uuid
granularityqueryday | monthDefault: day up to 62 days, month beyond. Day is allowed for at most 366 days.

Responses

StatusMeaningBody
200OKAccountingSummary
400Error envelopeError
Example response
{
  "from_date": "string",
  "to_date": "string",
  "granularity": "day",
  "app_id": "string",
  "currencies": [
    {
      "currency": "string",
      "gross_income_minor": "string",
      "tax_minor": "string",
      "refunds_minor": "string",
      "net_income_minor": "string",
      "expenses_minor": "string",
      "provider_fees_minor": "string",
      "provider_fees_recorded": false,
      "profit_minor": "string",
      "paid_invoices": "string",
      "expense_by_category": [
        {
          "category": {},
          "amount_minor": "string"
        }
      ],
      "series": [
        {
          "bucket": "string",
          "gross_income_minor": "string",
          "tax_minor": "string",
          "refunds_minor": "string",
          "net_income_minor": "string",
          "expenses_minor": "string",
          "profit_minor": "string",
          "discounts_minor": "string"
        }
      ],
      "discounts_minor": "string",
      "sales_minor": "string",
      "coupons": [
        {
          "coupon_code": "string",
          "invoices": "string",
          "gross_minor": "string",
          "discount_minor": "string",
          "net_minor": "string"
        }
      ]
    }
  ]
}
curl
curl -X GET https://YOUR-API-ADDRESS/v1/accounting/summary \
  -H "Authorization: Bearer $PAYRUDDER_API_KEY"

GET /v1/accounting/export.csv #

The accounting series as CSV

The query of the summary. One row per currency and day (or month), then a total row per currency; amounts are minor units. The provider_fees_minor of a total row is not_recorded when no payment_fees expense exists. discounts_minor is what coupons took off (contra-revenue) and sales_before_discounts_minor is gross - tax + discounts.

Parameters

NameInTypeDescription
from requiredquerystring · date
to requiredquerystring · date
app_idquerystring · uuid
granularityqueryday | month

Responses

StatusMeaningBody
200OK
curl
curl -X GET https://YOUR-API-ADDRESS/v1/accounting/export.csv \
  -H "Authorization: Bearer $PAYRUDDER_API_KEY"

GET /v1/accounting/coupons.csv #

Gross sales, discounts and net per coupon as CSV

The query of the summary. One row per currency and coupon over the invoices paid in the period: their number, what they came to before the coupon (positive lines, tax excluded), what the coupon took off, and the net. Currencies are never added together.

Parameters

NameInTypeDescription
from requiredquerystring · date
to requiredquerystring · date
app_idquerystring · uuid
granularityqueryday | month

Responses

StatusMeaningBody
200OK
400Error envelopeError
curl
curl -X GET https://YOUR-API-ADDRESS/v1/accounting/coupons.csv \
  -H "Authorization: Bearer $PAYRUDDER_API_KEY"

Models

AccountingCoupon

FieldTypeDescription
coupon_code requiredstring
invoices requiredstring · int64
gross_minor requiredstring · int64What those invoices came to before the coupon: positive lines, tax excluded
discount_minor requiredstring · int64
net_minor requiredstring · int64gross - discount

AccountingCurrency

FieldTypeDescription
currency requiredstring
gross_income_minor requiredstring · int64Invoices paid in the period, tax included
tax_minor requiredstring · int64The tax lines of those invoices, less the tax that credit notes issued in the period gave back (it is negative in a period that gave back more than it collected)
refunds_minor requiredstring · int64Credit notes against paid invoices plus invoices refunded in full
net_income_minor requiredstring · int64gross - tax - refunds
expenses_minor requiredstring · int64Every live occurrence in the period, provider fees included
provider_fees_minor requiredstring · int64The payment_fees expenses; meaningful only when provider_fees_recorded
provider_fees_recorded requiredbooleanFalse: no commission was entered, which is not the same as zero
profit_minor requiredstring · int64net income - expenses; negative for a loss
paid_invoices requiredstring · int64
expense_by_category requiredarray of object
series requiredarray of AccountingPoint
discounts_minor requiredstring · int64What coupons took off the paid invoices (contra-revenue, a positive number). gross_income_minor is already after it
sales_minor requiredstring · int64Revenue before discounts: gross - tax + discounts
coupons requiredarray of AccountingCouponGross, discounts and net per coupon, most discount first

AccountingPoint

FieldTypeDescription
bucket requiredstring · dateThe day, or the first day of the month
gross_income_minor requiredstring · int64
tax_minor requiredstring · int64
refunds_minor requiredstring · int64
net_income_minor requiredstring · int64
expenses_minor requiredstring · int64
profit_minor requiredstring · int64
discounts_minor requiredstring · int64What coupons took off the invoices paid in this bucket

AccountingSummary

FieldTypeDescription
from_date requiredstring · date
to_date requiredstring · date
granularity requiredday | month
app_id requiredstring
currencies requiredarray of AccountingCurrencyOrdered by currency code; a currency with no income and no expenses has no block

Error

FieldTypeDescription
error requiredobject