Skip to content

Instantly share code, notes, and snippets.

@reindert-vetter
Last active August 20, 2021 08:41
Show Gist options
  • Save reindert-vetter/78e59abd4a8aa60ffd7b0a8de72e6584 to your computer and use it in GitHub Desktop.
Save reindert-vetter/78e59abd4a8aa60ffd7b0a8de72e6584 to your computer and use it in GitHub Desktop.
{
"id": "1",
"billing_address": {
"name": ""
"street": ""
},
"created_at": "2021-01-01 12:00:00",
"custom_fields": null,
"customer": [
"email": "[email protected]",
"name": null,
"phone": null,
],
"discounts": [
{
"type": "promotion",
"amount": {
"value": "10.00",
"currency": "EUR"
},
"code": "SUMMERSALE",
"promotion_id": 5,
},
],
"is_first": true,
"is_upsell": true,
"items": [
{
"id": 1,
"contract": {
"id": "1",
"interval": "monthly",
"source": "manual" "checkout"
"type": "oneoff" "subscription" "installment"
...
},
"discounts": [
{
"type": "promotion",
"amount": {
"value": "10.00",
"currency": "EUR"
},
"code": "SUMMERSALE",
"promotion_id": 5,
},
{
"type": "sale",
"amount": {
"value": "10.00",
"currency": "EUR"
},
},
{
"type": "tier",
"amount": {
"value": "1.00",
"currency": "EUR"
},
}
],
"label": "Product A",
"product": {
"id": 1,
"label": "Huidige label product A"
}
"quantity": 1,
"subtotal": "100.00",
"tax": {
"amount": {
"currency": "EUR",
"value": "21.00",
},
"country": "NL",
"rate": 21
}
"total": "121.00",
"type": "main/null" "gift" "bump"
}
],
"memo": null,
"mode": "live",
"number": "825ADB9-DRAFT",
"paid_at": "2021-01-01 12:00:00"
"payment_url": null,
"reference": guidv4,
"shipping_address": null,
"source": "manual" "checkout",
"status": "draft" "open" "paid",
"subtotal": "100.00",
"taxes": [
{
"amount": {
"currency": "EUR",
"value": "21.00",
},
"country": "NL",
"rate": 9
},
{
"amount": {
"currency": "EUR",
"value": "21.00",
},
"country": "NL",
"rate": 21
}
],
"total": {
"currency": "eur",
"total": "121.00",
},
}
@reindert-vetter
Copy link
Author

reindert-vetter commented Aug 3, 2021

_at voor timestamps/datetimes, date voor datums
alle timestamps met tz teruggeven, "2021-01-01T12:00:00+0000"
include om relaties te mergen in basislevel include=prices,images
amount object met currency en value als string
booleans altijd met is
orders niet filteren op orders.type maar op contracts.type met subscription_type=recurring/installment/none/null

@reindert-vetter
Copy link
Author

reindert-vetter commented Aug 5, 2021

Geen period omdat we dat via een contract moeten ophalen:

      "period": { // for contract.type recurring only
        "end": "2021-12-31", -> invoice_date + days(billing_cycle) - 1
        "start": "2021-01-01" -> invoice_date
      },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment