Reputation: 626
I am using stripe.net for making payments in asp.net. I ran into a problem. I couldn’t update the metadata of the charge retrieved, although I was able to retrieve the charge from stripe as per the documentation on stripe.net. However updating a charge is not mentioned in the documentation. Any help would be much appreciated. Here is the code that I am using
var chargeService = new StripeChargeService(newgenSecretKey);
//successfully retrieves the charge
StripeCharge charge = chargeService.Get("py_1AXfkAJsBBkng4KEnulfiR7I");
//Metadata is not getting updated
charge.Metadata = myDict;
The following code does not update the Meta Data in the dashboard.
Apart from this, there is another option of StripeChargeUpdateOptions
but I am not sure how this was intended to work. There is not documentation in github as well. Unlike the StripeChargeService
which take in the stripe secret key as argument,StripeChargeUpdateOptions
does not take any. I tried using this without any luck. But I think this is what I have to use because for a charge you can only update 4 parameters including metadata and StripeChargeUpdateOptions
has only those. I was wondering if anyone out there could help me with this.
The following code is what I tried
var chargeServiceupdate = new StripeChargeUpdateOptions();
chargeServiceupdate.Metadata = myDict;
PS : MyDict is a dictionary and I tried using it when creating a charge. Meta data is succesfully being set. Cannot do the same when I retrieve a charge and try to set it.
Upvotes: 0
Views: 594
Reputation: 23864
The wrapper has a class called StripeChargeService with an Update
method.
You need to call that method.
If you are missing that method then you are likely running an old version of the library (see https://github.com/jaymedavis/stripe.net/issues/412) and need to upgrade to the latest version.
Updating MetaData on Connected account fails may also be of assistance.
Upvotes: 1