question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Stripe clean up user bug

See original GitHub issue

The clean up user function is a little at odds with the stripe API and returned an error for me. It should be changed to:

// When a user deletes there account, clean up after them
exports.cleanupUser = functions.auth.user().onDelete(event => {
  return admin.database().ref(`/stripe_customers/${event.data.uid}`).once('value').then(snapshot => {
    return snapshot.val();
  }).then(customer => {
// change below, customer.customer_id vs customer
    return stripe.customers.del(customer.customer_id);
  }).then(() => {
    return admin.database().ref(`/stripe_customers/${event.data.uid}`).remove();
  });
});

OR change the reference to admin.database().ref(/stripe_customers/${event.data.uid}/customer_id) Thanks

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
jhuleattcommented, Apr 26, 2019

Looks like this was fixed in #228 , closing

0reactions
cyrilzakkacommented, Aug 10, 2017

@SamMatthewsIsACommonName Thanks for that bit of code - was trying to debug things without realizing there was a log to Cloud Functions 😅

Read more comments on GitHub >

github_iconTop Results From Across the Web

Handle errors | Stripe Documentation
This error can occur when your integration is working correctly. Catch it and prompt the customer for a different payment method. To block...
Read more >
Clean up products created from webhook tests #707 - GitHub
Problem I'm using Stripe CLI to test out webhooks, and in my test-mode Products, I see a ton of myproduct ($20.00 USD /...
Read more >
How can I clear test data in Stripe via the API? - Stack Overflow
Then scroll down to the "Compliance and reporting" section. Click Data. Here you will find the "Delete all test data..." button.
Read more >
Stripe Payment Development Error "this product cannot be ...
Problem Symptom When Stripe Payment developer try to delete a ... it has one or more user-created prices” when Delete Product or Price ......
Read more >
Error when trying to delete a Stripe coupon [#2978091] - Drupal
This fails with following error messages: Error: Using $this when not in object context in Stripe\Coupon::delete() (line 54 of ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found