EOT/Denotion in s2Member is not set when subscription in Stripe is automatically cancelled. Here is an example of such an event “customer.subscritpion.deleted” after all retries for a payment fail.
evt_1GxX4rAvAK7zTur2fj9FI3pD
customer.subscription.deleted
Date
6/24/20, 1:47:41 PM
Source
Automatic
Event data
{
"object": {
"id": "sub_FJ5Or1Hb2X6kO9",
"object": "subscription",
"application_fee_percent": null,
"billing_cycle_anchor": 1592822829,
"billing_thresholds": null,
"cancel_at": null,
"cancel_at_period_end": false,
"canceled_at": 1592999261,
"collection_method": "charge_automatically",
"created": 1561286829,
"current_period_end": 1624358829,
"current_period_start": 1592822829,
"customer": "cus_FJ5OuDLsHZ3ufE",
"days_until_due": null,
"default_payment_method": null,
"default_source": null,
"default_tax_rates": [
],
"discount": null,
"ended_at": 1592999261,
"items": {
"object": "list",
"data": [
{
"id": "si_FJ5OhgPppQSxtT",
"object": "subscription_item",
"billing_thresholds": null,
"created": 1561286830,
"metadata": {
},
"plan": {
"id": "s2_414ae998b9b3b758f13019ba0f7aacd1",
"object": "plan",
"active": true,
"aggregate_usage": null,
"amount": 120000,
"amount_decimal": "120000",
"billing_scheme": "per_unit",
"created": 1561286828,
"currency": "nok",
"interval": "day",
"interval_count": 365,
"livemode": true,
"metadata": {
"recurring": "true",
"recurring_times": "-1"
},
"nickname": null,
"product": "prod_FJ5OBr2opXq6kq",
"tiers": null,
"tiers_mode": null,
"transform_usage": null,
"trial_period_days": 365,
"usage_type": "licensed"
},
"price": {
"id": "s2_414ae998b9b3b758f13019ba0f7aacd1",
"object": "price",
"active": true,
"billing_scheme": "per_unit",
"created": 1561286828,
"currency": "nok",
"livemode": true,
"lookup_key": null,
"metadata": {
"recurring": "true",
"recurring_times": "-1"
},
"nickname": null,
"product": "prod_FJ5OBr2opXq6kq",
"recurring": {
"aggregate_usage": null,
"interval": "day",
"interval_count": 365,
"trial_period_days": 365,
"usage_type": "licensed"
},
"tiers_mode": null,
"transform_quantity": null,
"type": "recurring",
"unit_amount": 120000,
"unit_amount_decimal": "120000"
},
"quantity": 1,
"subscription": "sub_FJ5Or1Hb2X6kO9",
"tax_rates": [
]
}
],
"has_more": false,
"total_count": 1,
"url": "/v1/subscription_items?subscription=sub_FJ5Or1Hb2X6kO9"
},
"latest_invoice": "in_1GwnBIAvAK7zTur2kYCNSOjR",
"livemode": true,
"metadata": {
"tax_info": "{"tax":"0.00","tax_per":"0%"}"
},
"next_pending_invoice_item_invoice": null,
"pause_collection": null,
"pending_invoice_item_interval": null,
"pending_setup_intent": null,
"pending_update": null,
"plan": {
"id": "s2_414ae998b9b3b758f13019ba0f7aacd1",
"object": "plan",
"active": true,
"aggregate_usage": null,
"amount": 120000,
"amount_decimal": "120000",
"billing_scheme": "per_unit",
"created": 1561286828,
"currency": "nok",
"interval": "day",
"interval_count": 365,
"livemode": true,
"metadata": {
"recurring": "true",
"recurring_times": "-1"
},
"nickname": null,
"product": "prod_FJ5OBr2opXq6kq",
"tiers": null,
"tiers_mode": null,
"transform_usage": null,
"trial_period_days": 365,
"usage_type": "licensed"
},
"quantity": 1,
"schedule": null,
"start_date": 1561286829,
"status": "canceled",
"tax_percent": null,
"transfer_data": null,
"trial_end": 1592822829,
"trial_start": 1561286829
}
}
However if a customer cancel a subscription using the “Cancel Membership” function in s2member, EOT will be updated in s2member and set to the expiry date of the subscription and the subscription will be updated. Here is an example where a customer has cancelled the subscription:
customer.subscription.updated
Date
6/23/20, 10:58:16 PM
Source
API
Event data
{
"object": {
"id": "sub_FMCLt5DlSP5yOA",
"object": "subscription",
"application_fee_percent": null,
"billing_cycle_anchor": 1593540580,
"billing_thresholds": null,
"cancel_at": 1593540580,
"cancel_at_period_end": true,
"canceled_at": 1592945896,
"collection_method": "charge_automatically",
"created": 1562004580,
"current_period_end": 1593540580,
"current_period_start": 1562004580,
"customer": "cus_FMCLRexB1dBc4D",
"days_until_due": null,
"default_payment_method": null,
"default_source": null,
"default_tax_rates": [
],
"discount": null,
"ended_at": null,
"items": {
"object": "list",
"data": [
{
"id": "si_FMCL7yfDpEOJhb",
"object": "subscription_item",
"billing_thresholds": null,
"created": 1562004581,
"metadata": {
},
"plan": {
"id": "s2_88d5960a5f6f5e7d2c0e8ac8de474378",
"object": "plan",
"active": true,
"aggregate_usage": null,
"amount": 50000,
"amount_decimal": "50000",
"billing_scheme": "per_unit",
"created": 1559839301,
"currency": "nok",
"interval": "day",
"interval_count": 365,
"livemode": true,
"metadata": {
"recurring": "true",
"recurring_times": "-1"
},
"nickname": null,
"product": "prod_FCoHimZg8tXBXB",
"tiers": null,
"tiers_mode": null,
"transform_usage": null,
"trial_period_days": 365,
"usage_type": "licensed"
},
"price": {
"id": "s2_88d5960a5f6f5e7d2c0e8ac8de474378",
"object": "price",
"active": true,
"billing_scheme": "per_unit",
"created": 1559839301,
"currency": "nok",
"livemode": true,
"lookup_key": null,
"metadata": {
"recurring": "true",
"recurring_times": "-1"
},
"nickname": null,
"product": "prod_FCoHimZg8tXBXB",
"recurring": {
"aggregate_usage": null,
"interval": "day",
"interval_count": 365,
"trial_period_days": 365,
"usage_type": "licensed"
},
"tiers_mode": null,
"transform_quantity": null,
"type": "recurring",
"unit_amount": 50000,
"unit_amount_decimal": "50000"
},
"quantity": 1,
"subscription": "sub_FMCLt5DlSP5yOA",
"tax_rates": [
]
}
],
"has_more": false,
"total_count": 1,
"url": "/v1/subscription_items?subscription=sub_FMCLt5DlSP5yOA"
},
"latest_invoice": "in_1ErTweAvAK7zTur2zZarSMcl",
"livemode": true,
"metadata": {
"tax_info": "{"tax":"0.00","tax_per":"0%"}"
},
"next_pending_invoice_item_invoice": null,
"pause_collection": null,
"pending_invoice_item_interval": null,
"pending_setup_intent": null,
"pending_update": null,
"plan": {
"id": "s2_88d5960a5f6f5e7d2c0e8ac8de474378",
"object": "plan",
"active": true,
"aggregate_usage": null,
"amount": 50000,
"amount_decimal": "50000",
"billing_scheme": "per_unit",
"created": 1559839301,
"currency": "nok",
"interval": "day",
"interval_count": 365,
"livemode": true,
"metadata": {
"recurring": "true",
"recurring_times": "-1"
},
"nickname": null,
"product": "prod_FCoHimZg8tXBXB",
"tiers": null,
"tiers_mode": null,
"transform_usage": null,
"trial_period_days": 365,
"usage_type": "licensed"
},
"quantity": 1,
"schedule": null,
"start_date": 1562004580,
"status": "trialing",
"tax_percent": null,
"transfer_data": null,
"trial_end": 1593540580,
"trial_start": 1562004580
},
"previous_attributes": {
"cancel_at": null,
"cancel_at_period_end": false,
"canceled_at": null
}
}
Screenshot from s2member where the EOT is set correctly according to when the subscrition will end
This matches the status of the subscription in Stripe