Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add webhooks for invoices #81

Closed
vincent-pochet opened this issue Apr 21, 2022 · 4 comments · Fixed by #106
Closed

Add webhooks for invoices #81

vincent-pochet opened this issue Apr 21, 2022 · 4 comments · Fixed by #106
Assignees
Labels
API Related to the public API 🔔 Webhook Related to Webhooks Feature Add a new feature to the app Invoice Related to Invoices

Comments

@vincent-pochet
Copy link
Collaborator

vincent-pochet commented Apr 21, 2022

We must add the webhook logic that will be triggered when the invoice is processed

@vincent-pochet vincent-pochet added the enhancement New feature or request label Apr 21, 2022
@jdenquin
Copy link
Contributor

  • Add a webhook_url field on the organization.
  • The payload should be signed.

@jdenquin
Copy link
Contributor

jdenquin commented Apr 21, 2022

  • The payload should be like this one
  {
    "signature": "sig",
    "invoice": {
      "lago_id": "id",
      "incremental_id": "incremental_id",
      "customer": {
        "lago_id": "lago_id",
        "customer_id": "customer_id",
        "metadata": "metadata",
        ...
      },
      "subscription": {
        "lago_id": "lago_id",
        "anniversary_date": "anniversary_date",
        "status": "status"
        "plan": {
          "code": "code",
          "name": "name"
        }
      }
      "from_date": "from_date",
      "to_date": "to_date",
      "issuing_date": "issuing_date",
      "amount_cents": 100,
      "amount_currency": "EUR",
      "vat_amount_cents": 20,
      "vat_amount_currency": "EUR",
      "total_amount_cents": 100,
      "total_amount_currency": "EUR",
      "fees": [
        { // subscription fee
          "item": {
            "type": "subscription",
            "code": "code",
            "name": "name"
          },
          "amount_cents": 100,
          "amount_currency": "EUR",
          "vat_amount_cents": 20,
          "vat_amount_currency": "EUR"
        },
        {  // charge fee
          "item": {
            "type": "billable_metric",
            "code": "code",
            "name": "name"
          }
          "amount_cents": 100,
          "amount_currency": "EUR",
          "vat_amount_cents": 20,
          "vat_amount_currency": "EUR"
        }
      ]
    }
  }

@jdenquin jdenquin self-assigned this Apr 25, 2022
@jdenquin jdenquin added API Related to the public API Feature Add a new feature to the app Invoice Related to Invoices 🔔 Webhook Related to Webhooks and removed enhancement New feature or request labels Apr 25, 2022
@jdenquin
Copy link
Contributor

jdenquin commented Apr 25, 2022

  • Add webhook_url on organizations
  • Write the HTTP client to "consume" the webhook
  • Add the signature logic
  • Call the webhook URL when invoice is generated

@jdenquin
Copy link
Contributor

Product Issue : https://github.com/getlago/lago-product/issues/5

@jdenquin jdenquin linked a pull request Apr 26, 2022 that will close this issue
jdenquin added a commit that referenced this issue Apr 26, 2022
* Add Webhook url to organizations, create Lago Http Client

* add sequential id into serializer

* fix last review

* fix spec
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Related to the public API 🔔 Webhook Related to Webhooks Feature Add a new feature to the app Invoice Related to Invoices
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants