Stripe clean up user bug
See original GitHub issueThe 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:
- Created 6 years ago
- Reactions:1
- Comments:7 (2 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Looks like this was fixed in #228 , closing
@SamMatthewsIsACommonName Thanks for that bit of code - was trying to debug things without realizing there was a log to Cloud Functions 😅