如何访问此StripeCharge映射器对象?

时间:2012-12-16 17:54:59

标签: c#

stripe.com将此信息发送给我的ashx文件

{
"type": "charge.refunded",
"livemode": false,
"object": "event",
"created": 1326853478,
"id": "evt_00000000000000",
"data": {
 "object": {
  "livemode": false,
  "fee_details": [
    {
      "application": null,
      "type": "stripe_fee",
      "amount": 0,
      "currency": "usd",
      "description": "Stripe processing fees"
    }
  ],
  "amount_refunded": 0,
  "invoice": null,
  "failure_message": null,
  "object": "charge",
  "created": 1355641115,
  "amount": 0,
  "customer": null,
  "currency": "usd",
  "card": {
    "address_state": null,
    "exp_year": 2012,
    "type": "Visa",
    "address_country": null,
    "country": "US",
    "address_line1": null,
    "fingerprint": "thIB5TIJqKMnqdMm",
    "address_line2": null,
    "last4": "4242",
    "object": "card",
    "cvc_check": "pass",
    "address_city": null,
    "address_zip_check": null,
    "name": null,
    "address_zip": null,
    "exp_month": 12,
    "address_line1_check": null
  },
  "id": "ch_00000000000000",
  "dispute": null,
  "paid": true,
  "refunded": true,
  "fee": 0,
  "description": null
}
}
}

然后我使用代码 https://github.com/jaymedavis/stripe.net 这显示了这样做:

var json = new StreamReader(context.Request.InputStream).ReadToEnd();
var stripeEvent = StripeEventUtility.ParseEvent(json); 
var StripeCharge = Stripe.Mapper<StripeCharge>
                   .MapFromJson(stripeEvent.Data.Object.ToString());

但是现在如何从stripeCharge var中找到例如amount_refunded或description?

2 个答案:

答案 0 :(得分:0)

StripeCharge.CustomerId.ToString(); 对我来说问题是当声明为var时不理解StripeCharge 是一个动态表达式,将在运行时填充。

所以当我在visual studio中键入StripeCharge点时,我没有看到任何属性。 所以我认为它不起作用。

答案 1 :(得分:0)

深入了解stripecharge类的成员。如果您可以将代码与类一起粘贴(如果您的问题是打开的话),那将是一件好事。我可以在这里看到你已经回答了我的问题,所以PLZ也明确了这一点