Webhooks Integration


How it works

  1. You specify Webhooks endpoint under https://www.subscribestar.com/profile/settings
  2. You start receiving POST requests as described in the section below
At the moment we do not resend webhooks if your application responds with an error or fails to respond within 10 seconds.

Security

Find X-SubscribeStar-Signature in the headers: 


Then compare signature with the HEX digest of MD5 HMAC signed request body (the JSON string you receive from us) using your webhook's secret:
request.headers['X-SubscribeStar-Signature'] == OpenSSL::HMAC.hexdigest("MD5", secret, request.body)

Where secret is taken from your Profile Settings -> Webhooks section on the site. Request body is a JSON string.

Subscription Events

EVENT TYPES (see below, payload key is "event"):
  • email_shared
  • email_unshared
  • new_subscription
  • recurring_pledge_decreased
  • recurring_pledge_increased
  • shipping_address_shared
  • shipping_address_unshared
  • subscription_billing_failed
  • subscription_cancelled

PAYLOAD

{
  "payload": {
      "subscription": {
                                      "id": 10059451,
                                    "cost": 10000,       # ALWAYS IN CENTS (IN THIS CASE == $100.00)
                     "last_payment_amount": 10000,       # CAN BE NULL OR NOT EQUAL TO SUBSCRIPTION PRICE IN CASE IF THE LAST PAYMENT IS UNDER REVIEW OR TIER HAS BEEN DOWNGRADED!
          "last_payment_settlement_amount": 10000,       # CAN BE NULL OR NOT EQUAL TO SUBSCRIPTION PRICE IN CASE IF THE LAST PAYMENT IS UNDER REVIEW OR TIER HAS BEEN DOWNGRADED!
                           "subscriber_id": 91953,
                    "created_at_timestamp": 1573138322,
                    "charged_at_timestamp": 1573138322,
                   "extended_at_timestamp": 1573138322,  # THE DATE FROM WHICH WE COUNT NEXT RECURRING BILLING DATE (USUALLY EQUAL TO CHARGED_AT)
                              "profile_id": 1,           # YOUR STAR PROFILE ID
                          "billing_failed": false,
             "billing_failed_at_timestamp": null,
                               "cancelled": false,
                  "cancelled_at_timestamp": null,
                                  "paused": false,
                     "paused_at_timestamp": null,
                             "restored_at": null,
                                 "trusted": false        # PASSED TRUSTED PERIOD (SEE PROFILE SETTINGS)
      },
      "subscriber": {
                 "email": "[email protected]",
              "nickname": "John Doe",
                    "id": 91953
      }
  },
      "event": "new_subscription", # CAB BE: "email_shared", "email_unshared", "shipping_address_shared", "shipping_address_unshared", "recurring_pledge_increased", "recurring_pledge_decreased", "subscription_billing_failed", "new_subscription", "subscription_cancelled"
    "project": "subscribestar",
  "timestamp": 1573138322
}

Payment Events

EVENT TYPES (see below, payload key is "event"):
  • payment_disputed
  • payment_succeed
PAYLOAD
{
  "payload": {
      "payment": {
                               "id": 1239168,
                           "amount": 10000,
                "settlement_amount": 9820,               # HOW MUCH STAR EARNS FROM THIS TRANSACTION
          "authorized_at_timestamp": 1573138322,         # ALWAYS RELY ON THIS DATE OF THE ACTUAL TRANSACTION
            "captured_at_timestamp": 0,
                    "subscriber_id": 91953,
                  "subscription_id": 59451,
                           "tip_id": null,               # NOT NULL IF TIP
                          "comment": "Thank you!",       # A USER MESSAGE FROM THE TIPPING FORM
                       "profile_id": 1,
                             "type": "subscription_fee"  # CAN BE: "subscription_fee", "contribution", "tip"
      },
      "pledger": {
                 "email": "[email protected]",
              "nickname": "John Doe",
                    "id": 91953,
          "pledger_type": "subscriber"
      }
  },
      "event": "payment_succeed", # CAN BE: "payment_disputed", "payment_succeed"
    "project": "subscribestar",
  "timestamp": 1573138672

Before you launch

Please test it out using http://webhook.site/ before going fully live.
This website uses cookies to improve your experience while you navigate through this website. Continue to use this website as normal if you agree to the use of cookies. View our Privacy Policy for the details. By choosing "I Accept", you consent to our use of cookies.