Subscription Webhook Events

POSThttps://your-server.com/webhooks/easyflow

Listen to subscription events to keep your integration always synchronized.

Webhooks are the safest and most reliable way to stay updated in real time. Your application receives a notification whenever the status of a subscription changes.

Every business in participants receives its own notification. participants brings only the id and name of each business.

Subscription Events

  • subscription.created — Subscription created.
  • subscription.updated — Subscription updated.
  • subscription.activated — Subscription activated.
  • subscription.canceled — Subscription canceled.
  • subscription.deactivated — Subscription deactivated automatically, because the last retry of a recurrence also failed. See retry in Create subscription.
  • subscription.expired — Subscription expired.
  • subscription.inactivated — Subscription inactivated manually.

Deactivated or inactivated

In both cases the status of the subscription becomes inactive; the subscription is not canceled. The event tells you why:

  • subscription.deactivated is automatic. Easyflow sends it when a recurrence used all its retries without being paid.
  • subscription.inactivated is sent when the subscription is inactivated manually. It comes together with subscription.updated.

Origin of the subscription

Besides subscriptions from an offer (origin equal to offer), a subscription can be created through the API (api) or by a buyer who subscribes through a recurring payment link (payment-link). Subscriptions created through the API or by a payment link send the same events listed above; no event is specific to either origin. They are created as soon as the first order is charged, whatever the result of the card: subscription.created is sent and, if the first order is refused, subscription.canceled follows.

The webhook payload does not include origin. To know how a subscription was created, read origin in Get subscription or Filter subscription.

Order and payment link of the subscription

Every subscription.* event brings orderId and paymentLinkId, right after id. Both keys are always present, and a missing value comes as null, never as a missing key:

  • orderId is the order of the subscription. For a subscription created through the API or by a payment link, it is the order of the first cycle. For a subscription from an offer, it is the order of the purchase.
  • paymentLinkId is the payment link when the subscription was created by a payment link, and null for the other origins.

Use orderId to match subscription.created with the order events of the same order. The subscriptionRecurrence.* events and the response of Get subscription do not change and do not bring these fields.

Events

  • subscription.created
  • subscription.updated
  • subscription.activated
  • subscription.canceled
  • subscription.deactivated
  • subscription.expired
  • subscription.inactivated

Easyflow sends an HTTP request with this payload to the URL registered for your webhook.

Payloadrequired

Webhook payload received by your server in the event of an event.

Content typeapplication/jsonobject

  • eventstring

    Name of the event received.

    Possible values:subscription.createdsubscription.updatedsubscription.activatedsubscription.canceledsubscription.deactivatedsubscription.expiredsubscription.inactivated

  • occurredAtstring · date-time

    Date and time when the notification was sent, in UTC.

  • payloadobject

    Complete subscription data.

    Show child attributesHide child attributes
    • idstring · uuidrequired
    • orderIdstring · uuidrequirednullable

      Order of the subscription. For a subscription created through the API or by a payment link, it is the order of the first cycle. For a subscription from an offer, it is the order of the purchase. The key is always present.

    • paymentLinkIdstring · uuidrequirednullable

      Payment link that created the subscription. null when the subscription was not created by a payment link. The key is always present.

    • namestring
    • createdAtstring · date-time
    • expirationstring · date-timenullable

      Date and time when the subscription ends. null while the date has not been set. For example, a subscription created through the API or by a payment link starts with null, and the date is set when the subscription is activated.

    • installmentsinteger
    • numberRecurrencesinteger
    • repeatIndefinitelyboolean
    • periodicitystring

      Possible values:MonthlyQuarterlyBiannualyAnnualy

    • statusstring

      Possible values:activeinactivecanceledexpired

    • paymentMethodstring

      Possible values:credit-cardpixbank-billetcryptodebit-cardtransfer

    • recurrencePaymentStatusstring

      Possible values:pendingfaileddelayedpaidcanceled

    • recurrenceValueInCentsinteger
    • customValueobject

      Custom value charged in a range of recurrences. The object is always present. Its three fields are null when the subscription has no custom value, as when it is created through the API or by a payment link.

      Show child attributesHide child attributes
      • recurrenceFromintegernullable
      • recurrenceTointegernullable
      • valueInCentsintegernullable
    • retryobject
      Show child attributesHide child attributes
      • intervalInDaysinteger
      • retriesMaxNumberinteger
    • customerobject
      Show child attributesHide child attributes
      • namestring
      • emailstring
      • phoneobject
        Show child attributesHide child attributes
        • dddstring
        • numberstring
        • areaCodestring
        • isMobileboolean
      • documentobject
        Show child attributesHide child attributes
        • typestring
        • numberstring
      • deliveryAddressobject
        Show child attributesHide child attributes
        • streetstring
        • neighborhoodstring
        • numberstring
        • citystring
        • statestring
        • zipCodestring
        • complementstring
      • billingAddressobject
        Show child attributesHide child attributes
        • streetstring
        • neighborhoodstring
        • numberstring
        • citystring
        • statestring
        • zipCodestring
        • complementstring
    • participantsarray of objects
      Show child attributesHide child attributes
      • businessobject
        Show child attributesHide child attributes
        • idstring · uuid
        • namestring