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

deleting Metadata #637

Closed
drod516 opened this issue Oct 17, 2016 · 12 comments
Closed

deleting Metadata #637

drod516 opened this issue Oct 17, 2016 · 12 comments

Comments

@drod516
Copy link

drod516 commented Oct 17, 2016

How do I delete the Metadata?

say I the client wanted to remove "OftenSays" from
var metadataArray = [ Name : "Ray Barone" , OftenSays : "Thatttttt's right" ]

in the javascript I would remove it and send over the New Array to the API

 var myCustomer = new StripeCustomerUpdateOptions();
            mycustomer.Metadata = metadataArray;
    var customerService = new StripeCustomerService();
    StripeCustomer stripeCustomer = customerService.Update(*customerId*, myCustomer);

I tried the Update() function as shown above . It succeeded but it wont remove it. any help would be nice

@jaymedavis
Copy link
Contributor

hmm - so what is your code you are passing to the Update function for customer to remove it?

@drod516
Copy link
Author

drod516 commented Oct 17, 2016

I just sent the new metadata Array with the CustomerId
exactly like the example. It will add new metadata but it wont delete

 var myCustomer = new StripeCustomerUpdateOptions();
            mycustomer.Metadata = metadataArray;
    var customerService = new StripeCustomerService();
    StripeCustomer stripeCustomer = customerService.Update(*customerId*, myCustomer);

@jaymedavis
Copy link
Contributor

Do you want to erase the metadata entirely? Have you tried updating with an empty dictionary?

@drod516
Copy link
Author

drod516 commented Oct 18, 2016

no just one specific like how you can in the stripe.com dashboard

@jaymedavis
Copy link
Contributor

I would check with Stripe first to see how this is done with CURL... I'm not sure what the logic is to remove an entry. Check with them and then we can figure out how to support it (or if it already exists) with Stripe.net

@drod516
Copy link
Author

drod516 commented Oct 18, 2016

Well it turns out i don't need to mimic that feature anymore but ill see what I can figure out for future reference.

@jaymedavis
Copy link
Contributor

jaymedavis commented Oct 18, 2016

I pinged Stripe in the IRC room - looks like you can just supply a blank value. So in this case, you would pass var metadataArray = [ Name : "Ray Barone" , OftenSays : "" ] ?

edit: feel free to ping again if this doesn't work - support verified with CURL, so Stripe.net should pass the same thing. If it doesn't - re-open and I'll fix 👍

@xt0rted
Copy link
Contributor

xt0rted commented Oct 18, 2016

Can you pass null as well or does it have to be string.Empty?

@drod516
Copy link
Author

drod516 commented Oct 18, 2016

@xt0rted I think it has to be an empty string

@jaymedavis
Copy link
Contributor

I wrote a test for this - null and string.empty works. https://github.com/jaymedavis/stripe.net/pull/643

The build should be done soon...

@jaymedavis
Copy link
Contributor

Thanks @xt0rted - I think null is actually a little cleaner.

@jaymedavis
Copy link
Contributor

All set with tests and readme updates 👍 Thanks much!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants