Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle product.updated webhook for plans (name) #588

Open
blueyed opened this issue Sep 4, 2018 · 0 comments
Open

Handle product.updated webhook for plans (name) #588

blueyed opened this issue Sep 4, 2018 · 0 comments

Comments

@blueyed
Copy link
Contributor

blueyed commented Sep 4, 2018

If the name of a plan product is changed, a product.updated event is emitted,
but not handled by pinax-stripe to update the plan.

Example event:

{
  "id":"evt_1D6kEgIuxbTU2od2Zgc5sH2K",
  "object":"event",
  "account":"acct_XXX",
  "api_version":"2017-08-15",
  "created":1536089450,
  "data":{
    "object":{
      "id":"prod_XXX",
      "object":"product",
      "active":true,
      "attributes":[],
      "caption":null,
      "created":1535729477,
      "description":null,
      "images":[],
      "livemode":true,
      "metadata":{},
      "name":"WEEKLY",
      "package_dimensions":null,
      "shippable":null,
      "skus":{
        "object":"list",
        "data":[],
        "has_more":false,
        "total_count":0,
        "url":"/v1/skus?product=prod_XXX&active=true"
      },
      "statement_descriptor":null,
      "type":"service",
      "unit_label":null,
      "updated":1536089450,
      "url":null
    },
    "previous_attributes":{
      "name":"WEEKLY (fixed, with tax)",
      "updated":1536089439
    }
  },
  "livemode":true,
  "pending_webhooks":1,
  "request":{
    "id":"req_vcSdyW9nLWVM34",
    "idempotency_key":null
  },
  "type":"product.updated"
}

Code: https://github.com/pinax/pinax-stripe/blob/master/pinax/stripe/webhooks.py#L484-L512

"plan.updated" still gets used, but only if changing the nickname for example:

{
  "id":"evt_1D6kE7IuxbTU2od2DZJ7UpWX",
  "object":"event",
  "account":"acct_XXX",
  "api_version":"2017-08-15",
  "created":1536089415,
  "data":{
    "object":{
      "id":"prod-New Rochelle#77-WEEKLY-#42",
      "object":"plan",
      "active":true,
      "aggregate_usage":null,
      "amount":1295,
      "billing_scheme":"per_unit",
      "created":1535729477,
      "currency":"usd",
      "interval":"week",
      "interval_count":1,
      "livemode":true,
      "metadata":{},
      "name":"WEEKLY (fixed, with tax)",
      "nickname":"Weekly (fixed, with tax)",
      "product":"prod_XXX",
      "statement_descriptor":null,
      "tiers":null,
      "tiers_mode":null,
      "transform_usage":null,
      "trial_period_days":null,
      "usage_type":"licensed"
    },
    "previous_attributes":{
      "nickname":null
    }
  },
  "livemode":true,
  "pending_webhooks":1,
  "request":{
    "id":"req_5ri98H6uv3uIF6",
    "idempotency_key":null
  },
  "type":"plan.updated"
}
@paltman paltman mentioned this issue Oct 8, 2018
@paltman paltman added this to the Next milestone Oct 9, 2018
@paltman paltman modified the milestones: Next, Light Nov 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants