Question

Using a webhook to pull very specific data into a Google Sheet

  • 19 July 2023
  • 1 reply
  • 35 views

Been with support on this for a while now - Zapier isn't much help. Basic idea of the problem is that I need to pull new cancellations from customers but the data that is pulled via the webhook does not contain the customer name or email in association with the cancellation request. The product name is also hard to find.

So I can add "customer. Updated" to the list of events to watch for, but it creates two separate rows in the webhook. I am not able to pull data from one result and concatenate it with the other cancellation result.

So how do I do this?

Created a webhook to pull customer.subscription.deleted and customer. Updated and it creates separate rows for each when doing the Test.

I can't grab both and export what I want in Google Sheets.

I then tried using Zapier code and doing it via Python:

import stripe

stripe.api_key = "HAVEAPIKEYPUTINHEREBUTLEAVINGITOUT"

def get_customer_info(): subscriptions = stripe.Subscription.list() for subscription in subscriptions: if subscription.status == "canceled" and "Consistency Club" in subscription.plan.product.name: customer = stripe.Customer.retrieve(subscription.customer) print("Customer Name:", customer.name) print("Customer Email:", customer.email) print("Subscription Cancelled At:", subscription.canceled_at) print("Subscription Cancel Reason:", subscription.cancel_reason)

get_customer_info()

It says the Stripe module doesn't exist. I added it as the type of connection I want and then the code afterwards, still get the same thing.

I've Binged, Googled, YouTubed the heck out of this. And I'm at a loss.

HERE'S THE GOAL:

Pull the following listed in the python code above. Create a new row in Google Sheets Workbook for any new cancellation coming in.


This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

1 reply

Userlevel 7
Badge +14

Hi @aerowsphere 

Good question.

Try using this Zap trigger: Stripe - Canceled Subscription