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.
HOW IT WORKS
- You specify Webhooks endpoint under https://www.subscribestar.com/profile/settings
- 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.
SUBSCRIPTION EVENTS
EVENT TYPES (see below, payload key 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": "subscriber@subscribestar.com",
"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 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
"profile_id": 1,
"type": "subscription_fee" # CAN BE: "subscription_fee", "contribution", "tip"
},
"pledger": {
"email": "subscriber@subscribestar.com",
"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.