subscription.updated

The subscription.updated event is triggered when a subscription transition from one status to another, gets renewed, is updated from the platform, it's billing cycle is changed, basically every single time our platform receives an update related to the subscription.

{
    "type": "subscription.updated",
    "id": "evt_c11Uejnwf8sNojZLjgc5w0kX",
    "created": 1624531555,
    "triggered_from": "open_api",
    "data": {
        "object": {
            "object": "subscription",
            "id": 71,
            "address_id": null,
            "campaign_id": null,
            "metadata" : [
                 "metadata-example1",
                 "metadata-example2",
              ],
            "campaign_key":null,
            "address_shipping": {
                "object": "address",
                "id": 43,
                "city": "city name",
                "company": "company name",
                "country": "CA",
                "country_name": "Canada",
                "created_at": "2021-06-24 10:21:26",
                "department": "which department",
                "first_name": "first name",
                "is_default": true,
                "last_name": "last name",
                "line1": "specific address",
                "line2": "apt 100",
                "postal_code": "12345",
                "salutation": null,
                "state": "QC",
                "state_name": "Quebec",
                "title": "title name",
                "type": "shipping",
                "updated_at": "2021-06-24 10:22:48"
            },
            "agency_id": null,
            "auto_renew": true,
            "backdate_start_date": null,
            "billing": "charge_automatically",
            "billing_cycle_anchor": "2021-06-24 10:43:13",
            "campaign_id": 5374,
            "campaign_key": "InstantPromo",
            "cancel_at": "2021-07-24 10:43:13",
            "cancel_at_period_end": 1,
            "cancel_reason": null,
            "canceled_at": "2021-06-24 10:43:15",
            "coupon": null,
            "created": "2021-06-24 10:43:13",
            "current_period_end": "2021-07-24 10:43:13",
            "current_period_start": "2021-06-24 10:43:13",
            "customer": {
                "object": "customer",
                "id": 64,
                "balance": 0,
                "created": "2021-06-24 10:16:11",
                "currency": "cad",
                "default_source": {
                    "object": "source",
                    "id": 106,
                    "address_line1_check": "pass",
                    "address_zip_check": "pass",
                    "brand": "Visa",
                    "country": "US",
                    "cvc_check": "pass",
                    "dynamic_last4": null,
                    "exp_month": 5,
                    "exp_year": 2022,
                    "fingerprint": "b20EgCMpRnuPYluY",
                    "funding": "credit",
                    "last4": "0019",
                    "name": null,
                    "three_d_secure": "optional",
                    "tokenization_method": null
                },
                "delinquent": false,
                "display_name": "display_name",
                "email": "[email protected]",
                "email_confirm": null,
                "first_name": "first name",
                "has_password": 0,
                "language": null,
      					"last_login_method": 'email',
                "last_name": "last name",
                "metadata": {
                    "pelcro_account_id": "1",
                    "pelcro_customer_id": "64"
                },
                "phone": "12345678",
                "phone_confirm": null,
                "salutation": "salutation",
                "title": "title",
      					"username": null
            },
            "days_until_due": null,
            "default_source": {
                "object": "source",
                "id": 106,
                "address_line1_check": "pass",
                "address_zip_check": "pass",
                "brand": "Visa",
                "country": "US",
                "cvc_check": "pass",
                "dynamic_last4": null,
                "exp_month": 5,
                "exp_year": 2022,
                "fingerprint": "b20EgCMpRnuPYluY",
                "funding": "credit",
                "last4": "0019",
                "name": null,
                "three_d_secure": "optional",
                "tokenization_method": null
            },
            "default_tax_rates": null,
            "ended_at": null,
            "expires_at": null,
            "gift_code": null,
            "gift_donor_subscription_id": null,
            "gift_recipient_email": null,
            "gift_recipient_first_name": null,
            "gift_recipient_last_name": null,
            "gift_start_date": null,
            "is_gift_donor": null,
            "is_gift_recipient": null,
            "is_redeemed": null,
            "latest_invoice": {
                "object": "invoice",
                "id": 159,
                "address_billing": {
                    "object": "address",
                    "id": 44,
                    "city": "cit",
                    "company": null,
                    "country": "CA",
                    "country_name": "Canada",
                    "created_at": "2021-06-24 10:28:08",
                    "department": null,
                    "first_name": "first name",
                    "is_default": true,
                    "last_name": "last name",
                    "line1": "ad",
                    "line2": null,
                    "postal_code": "12345",
                    "salutation": null,
                    "state": "QC",
                    "state_name": "Quebec",
                    "title": null,
                    "type": "billing",
                    "updated_at": "2021-06-24 10:28:08"
                },
                "address_shipping": null,
                "amount_due": 15000,
                "amount_paid": 0,
                "amount_remaining": 15000,
                "auto_advance": true,
                "billing": "charge_automatically",
                "billing_address": {
                    "object": "address",
                    "id": 44,
                    "city": "cit",
                    "company": null,
                    "country": "CA",
                    "country_name": "Canada",
                    "created_at": "2021-06-24 10:28:08",
                    "department": null,
                    "first_name": "first name",
                    "is_default": true,
                    "last_name": "last name",
                    "line1": "ad",
                    "line2": null,
                    "postal_code": "12345",
                    "salutation": null,
                    "state": "QC",
                    "state_name": "Quebec",
                    "title": null,
                    "type": "billing",
                    "updated_at": "2021-06-24 10:28:08"
                },
                "billing_reason": "subscription_create",
                "charge_id": 86,
                "created": "2021-06-24 10:43:13",
                "currency": "cad",
                "customer": {
                    "object": "customer",
                    "id": 64,
                    "balance": 0,
                    "created": "2021-06-24 10:16:11",
                    "currency": "cad",
                    "default_source": {
                        "object": "source",
                        "id": 106,
                        "address_line1_check": "pass",
                        "address_zip_check": "pass",
                        "brand": "Visa",
                        "country": "US",
                        "cvc_check": "pass",
                        "dynamic_last4": null,
                        "exp_month": 5,
                        "exp_year": 2022,
                        "fingerprint": "b20EgCMpRnuPYluY",
                        "funding": "credit",
                        "last4": "0019",
                        "name": null,
                        "three_d_secure": "optional",
                        "tokenization_method": null
                    },
                    "delinquent": false,
                    "display_name": "display_name",
                    "email": "[email protected]",
                    "email_confirm": null,
                    "first_name": "first name",
                    "has_password": 0,
                    "language": null,
      							"last_login_method": 'email',
                    "last_name": "last name",
                    "metadata": {
                        "pelcro_account_id": "1",
                        "pelcro_customer_id": "64"
                    },
                    "phone": "12345678",
                    "phone_confirm": null,
                    "salutation": "salutation",
                    "title": "title",
      							"username": null
                },
                "customer_address": {
                    "city": "cit",
                    "country": "CA",
                    "line1": "ad",
                    "line2": null,
                    "postal_code": "12345",
                    "state": "QC"
                },
                "customer_shipping": null,
                "default_tax_rates": null,
                "deleted_at": null,
                "discount_id": null,
                "ending_balance": 0,
                "finalized_at": "2021-06-24 10:43:13",
                "is_imported": null,
                "lines": {
                    "object": "list",
                    "data": [
                        {
                            "object": "line_item",
                            "id": 159,
                            "amount": 15000,
                            "created_at": "2021-06-24 10:43:21",
                            "currency": "cad",
                            "deleted_at": null,
                            "description": "1 × Cool product (at $150.00 / month)",
                            "metadata": {
                                "pelcro_site_id": "1",
                                "pelcro_subscription_id": "71"
                            },
                            "period": {
                                "end": 1627123393,
                                "start": 1624531393
                            },
                            "quantity": 1,
                            "tax_amounts": null,
                            "tax_rates": null,
                            "updated_at": "2021-06-24 10:43:21"
                        }
                    ]
                },
                "marked_uncollectible_at": null,
                "number": "5408B141-0002",
                "paid_at": null,
                "period_end": "2021-06-24 10:43:13",
                "period_start": "2021-06-24 10:43:13",
                "post_payment_credit_notes_amount": 0,
                "pre_payment_credit_notes_amount": 0,
                "purchase_order": null,
                "source": {
                    "object": "source",
                    "id": 106,
                    "address_line1_check": "pass",
                    "address_zip_check": "pass",
                    "brand": "Visa",
                    "country": "US",
                    "cvc_check": "pass",
                    "dynamic_last4": null,
                    "exp_month": 5,
                    "exp_year": 2022,
                    "fingerprint": "b20EgCMpRnuPYluY",
                    "funding": "credit",
                    "last4": "0019",
                    "name": null,
                    "three_d_secure": "optional",
                    "tokenization_method": null
                },
                "plan": {
                    "id": 1,
                    "nickname": "test",
                    "interval": "day"
                },
                "product": {
                    "id": 1,
                    "name": "test",
                    "name_internal": null
                },
                "subscription_id": 10,
                "starting_balance": 0,
                "status": "open",
                "subtotal": 15000,
                "tax": null,
                "tax_percent": null,
                "total": 15000,
                "total_tax_amounts": null,
                "updated_at": "2021-06-24 10:43:22",
                "voided_at": null
            },
            "plan": {
                "object": "plan",
                "id": 3,
                "active": "active",
                "amount": 15000,
                "currency": "cad",
                "domains": null,
                "description": null,
                "entitlements": null,
                "group_owner_plan_id": null,
                "interval": "month",
                "interval_count": 1,
                "nickname": "150 CAD / One-time / Montly",
                "name_internal": "150 CAD / One-time / Montly",
                "type": "regular",
                "trial_period_days": 0,
                "ip_addresses": null,
                "product": {
                    "object": "product",
                    "id": 1,
                    "type": "service",
                    "active": "active",
                    "address_required": 0,
                    "description": "Cool product",
                    "livemode": false,
                    "is_hidden": null,
                    "name": "Cool product",
                    "package_dimensions": null,
                    "shippable": null,
                    "statement_descriptor": "Cool product",
                    "unit_label": null
                }
            },
            "quantity": 1,
            "renews_at": 1660646666,
            "schedules": null,
            "shipments_remaining": null,
            "shipments_suspended_until": null,
            "shipments_undeliverable": true,
            "shipping_address": {
                "object": "address",
                "id": 43,
                "city": "city name",
                "company": "company name",
                "country": "CA",
                "country_name": "Canada",
                "created_at": "2021-06-24 10:21:26",
                "department": "which department",
                "first_name": "first name",
                "is_default": true,
                "last_name": "last name",
                "line1": "specific address",
                "line2": "apt 100",
                "postal_code": "12345",
                "salutation": null,
                "state": "QC",
                "state_name": "Quebec",
                "title": "title name",
                "type": "shipping",
                "updated_at": "2021-06-24 10:22:48"
            },
            "site_id": 1,
            "source": "Web",
            "start_date": "2021-06-24 10:43:13",
            "status": "incomplete",
            "trial_end": null,
            "trial_start": null
        },
        "previous_attributes": {
            "source": "Phone",
            "shipments_undeliverable": 0
        }
    }
}