Updating MetaData on Connected account fails

元气小坏坏 提交于 2019-12-12 05:19:59

问题


I am using stripe connect(destination payment) with the help of stripe.net library from Jaymedavis.

The problem that I am facing is that I am not able to retrieve the destination payment ID to update the metadata in the connected account. The following line returns a null preventing me from updating meta data on the connected account. But the strange thing is that when I log in to the dashboard the destination payment ID exists. I am not sure why I am not able to retreive it in code.

Is the charge creation asynchronous?. I am not sure. Stripe's connect documentation does not help either. The following line returns a null. My code is down below. Seeking help.

String deschargeID = result.Transfer.DestinationPayment;

Here is the code that I am using

 var service = new StripeChargeService(ZambreroSecretKey);
 var result = (Stripe.StripeCharge) null;
 try {

  result = service.Create(newCharge);

  if (result.Paid) {

   //get the chargeID on the newgen account and update the metadata.
   //Returns null even though it exists in the dashboard

   String deschargeID = result.Transfer.DestinationPayment;

   var chargeService = new StripeChargeService(newgenSecretKey);
   StripeCharge charge = chargeService.Get(deschargeID);
   charge.Metadata = myDict;
   Response.Redirect("PgeCustSuccess.aspx?OrderID=" + OrderID);

  }
 } catch (StripeException stripeException) {

  Debug.WriteLine(stripeException.Message);
  stripe.Text = stripeException.Message;


 }

回答1:


The charge object's transfer attribute is not expanded by default, meaning it's just a string with the ID of the transfer object ("tr_..."), not a full transfer object.

According to Stripe.net's documentation, you can expand the transfer attribute by adding this line:

service.ExpandTransfer = True

before sending the charge creation request.



来源:https://stackoverflow.com/questions/44711541/updating-metadata-on-connected-account-fails

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!