Webhooks

Article author
Josh Lopez
  • Updated

Events

Listen to events within your application.

You can enable webhooks in the Dev Tools section in the dashboard.

💡 Info: You can verify incoming webhooks with the [verifySignature](<https://developer.memberstack.com/docs/documentation/admin>) method.

Members

member.created

Fires after a new member has been created.

  • Response

    • event string The type of event
    • timestamp number The time at which the event was fired.
    • payload object The Member object
  • Response Example

    {
      event: "member.created",
      timestamp: 1633486880169,
      data: {
        id: "mem_...",
        auth: {
          email: "john@doe.com"
        },
        metaData: { ... },
        customFields: { ... }
      }
    }
    

member.updated

Fires after a member has been updated. Fires on email change, custom fields, and metadata. Does not fire on password change.

  • Response

    • event string The type of event
    • timestamp number The time at which the event was fired.
    • payload object The Member object
  • Response Example

    {
      event: "member.updated",
      timestamp: 1633486880169,
      data: {
        id: "mem_...",
        auth: {
          email: "john@doe.com"
        },
        metaData: { ... },
        customFields: { ... }
      }
    }
    

member.deleted

Fires after a member has been deleted.

  • Response

    • event string The type of event
    • timestamp number The time at which the event was fired.
    • payload object An object containing the deleted member's id
  • Response Example

    {
      event: "member.deleted",
      timestamp: 1633486880169,
      data: {
        id: "mem_..."
      }
    }
    

Plan Connections

member.plan.created

Fires after a new plan connection has been created for a member. Memberstack allows member’s to have multiple plans, and this fires each time a plan is added to a member.

  • Response

    • event string The type of event
    • timestamp number The time at which the event was fired.
    • payload object An object containing the member's id, and the plan connection.
  • Response Example

    {
      event: "member.plan.created",
      timestamp: 1633486880169,
      data: {
        id: "mem_...",
        planConnection: {
            id: "con_...",
            active: true,
            status: "ACTIVE",
            type: "SUBSCRIPTION",
            planId: "pln_..."
            memberId: "mem_..."
        }
      }
    }
    

member.plan.updated

Fires after a plan connection has been updated. Any time the status of the plan updates or payment period updates.

  • Response

    • event string The type of event
    • timestamp number The time at which the event was fired.
    • payload object An object containing the member's id, and the plan connection.
  • Response Example

    {
      event: "member.plan.updated",
      timestamp: 1633486880169,
      data: {
        id: "mem_...",
        planConnection: {
            id: "con_...",
            active: true,
            status: "ACTIVE",
            type: "SUBSCRIPTION",
            planId: "pln_..."
            memberId: "mem_..."
        }
      }
    }
    

member.plan.replaced

Fires when a member replaces a current plan connection with a new plan. More info here

  • Response

    • event string The type of event
    • timestamp number The time at which the event was fired.
    • payload object An object containing the member's id, the previous plan id, and the updated plan connection.
  • Response Example

    {
      event: "member.plan.replaced",
      timestamp: 1633486880169,
      data: {
        id: "mem_...",
        prevPlan: "pln_...",
        planConnection: {
            id: "con_...",
            active: true,
            status: "ACTIVE",
            type: "ONETIME",
            planId: "pln_..."
            memberId: "mem_..."
        }
      }
    }
    

member.plan.canceled

Fires when a member cancels a plan.

  • Response

    • event string The type of event
    • timestamp number The time at which the event was fired.
    • payload object An object containing the member's id, and the canceled plan connection id.
  • Response Example

    {
      event: "member.plan.canceled",
      timestamp: 1633486880169,
      data: {
        id: "mem_...",
        planConnectionId: "con_..."
      }
    }
    

Payments

These webhooks come from stripe invoices.

payment.failed

Fires when a member payment failed.

  • Response

    • event string The type of event
    • timestamp number The time at which the event was fired.
    • payload object An object containing the member's id, and the plan connection for which the payment failed.
  • Response Example

    {
      event: "payment.failed",
      timestamp: 1633486880169,
      data: {
        id: "mem_...",
        planConnection: {
            id: "con_...",
            active: false,
            status: "REQUIRES_PAYMENT",
            type: "ONETIME",
            planId: "pln_..."
            memberId: "mem_..."
        }
      }
    }
    

payment.succeeded

Fires when a member payment succeeded.

  • Response
    • event string The type of event
    • timestamp number The time at which the event was fired.
    • payload object An object containing the member's id, and the plan connection for which the payment succeeded.
  • Response Example
    {
      event: "payment.failed",
      timestamp: 1633486880169,
      data: {
        id: "mem_...",
        planConnection: {
            id: "con_...",
            active: true,
            status: "ACTIVE",
            type: "ONETIME",
            planId: "pln_..."
            memberId: "mem_..."
        }
      }
    }
    

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.