Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/29.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net 从客户Id中检索卡详细信息_Asp.net_Stripe Payments_Payment Gateway_Payment Processing - Fatal编程技术网

Asp.net 从客户Id中检索卡详细信息

Asp.net 从客户Id中检索卡详细信息,asp.net,stripe-payments,payment-gateway,payment-processing,Asp.net,Stripe Payments,Payment Gateway,Payment Processing,您好,我正在使用条带流程进行支付,我正在从下面的代码生成条带客户Id StripeCustomerId = CreateStripeCustomer(fname, lname, Email, objStripeRequestOptions); 也 它将现有卡作为0提供 有人能告诉我如何从生成的客户Id中提取卡的详细信息,如卡号、姓名、有效月份和年份吗?您无法检索整个卡的信息。 您可以从customer API中的源对象获取一些信息。 检索来源将为您提供最后4位卡号和到期日期 Str

您好,我正在使用条带流程进行支付,我正在从下面的代码生成条带客户Id

  StripeCustomerId = CreateStripeCustomer(fname, lname, Email, objStripeRequestOptions);

它将现有卡作为0提供


有人能告诉我如何从生成的客户Id中提取卡的详细信息,如卡号、姓名、有效月份和年份吗?

您无法检索整个卡的信息。 您可以从customer API中的源对象获取一些信息。 检索来源将为您提供最后4位卡号和到期日期

    StripeConfiguration.SetApiKey("sk_test_BQokikJOvBiI2HlWgH4ol‌fQ2");

    StripeConfiguration.SetApiKey("sk_test_BQokikJOvBiI2HlWgH4ol‌​fQ2");

    var customerService = new StripeCustomerService();
    StripeCustomer customer = customerService.Get("cus_BwS21a7fAH22uk");
,作为对客户的响应,您将具有源属性。请查看返回的JSON响应。它包含添加的卡的源列表

您将得到与此类似的示例对象,在这里您可以看到卡的最后4位作为对象返回,在我的示例中,它是1111


在给出代码时,你能帮我检索4位数的卡号和有效期吗?我刚刚编辑了我的答案,加入了代码片段。检查我是否遇到问题,因为找不到别名条带。我在cI中编写这段代码,认为您应该更新您的答案,同时将代码作为StripeConfiguration.SetApiKeysk_test_bkokikjovbiii2hlwgh4olfq2;var customerService=新的StripeCustomerService;StripeCustomer=customerService.Getcus_bwqoszot2ocuh;StripeConfiguration.SetApiKeysk_test_bKokikjovbii2HLWGH4OLFQ2;StripeConfiguration.SetApiKeysk_test_bKokikjovbii2HLWGH4OLFQ2;var customerService=新的StripeCustomerService;StripeCustomer customer=customerService.Getcus_BwS21a7fAH22uk;作为对客户的响应,您将具有源属性。请查看返回的JSON响应。它包含添加的卡的源列表。
    StripeConfiguration.SetApiKey("sk_test_BQokikJOvBiI2HlWgH4ol‌fQ2");

    StripeConfiguration.SetApiKey("sk_test_BQokikJOvBiI2HlWgH4ol‌​fQ2");

    var customerService = new StripeCustomerService();
    StripeCustomer customer = customerService.Get("cus_BwS21a7fAH22uk");
#<Stripe::ListObject:0x5ea1a78> JSON: {
  "object": "list",
  "data": [
    {"id":"card_1BY6nrCaMyPmWTcG3uosK2up","object":"card","address_city":null,"address_country":null,"address_line1":null,"address_line1_check":null,"address_line2":null,"address_state":null,"address_zip":null,"address_zip_check":null,"brand":"Visa","country":"US","customer":"cus_BvylB8PAVap2JQ","cvc_check":"pass","dynamic_last4":null,"exp_month":12,"exp_year":2017,"fingerprint":"yE1mPcIGvqTYGcxQ","funding":"unknown","last4":"1111","metadata":{},"name":null,"tokenization_method":null}
  ],
  "has_more": false,
  "total_count": 1,
  "url": "/v1/customers/cus_BvylB8PAVap2JQ/sources"
}
var stripecard = "cus_BwS21a7fAH22uk";
StripeCustomer customer;
StripeConfiguration.SetApiKey(ConfigurationManager.AppSettings["StripeApiKey"].ToString());
var customerService = new StripeCustomerService();
customer = customerService.Get(stripecard);
ViewBag.last4card = customer.Sources.Data[0].Card.Last4.ToString();
ViewBag.ExpMonth = customer.Sources.Data[0].Card.ExpirationMonth.ToString();
ViewBag.ExpYear = customer.Sources.Data[0].Card.ExpirationYear.ToString();
ViewBag.Name = customer.Sources.Data[0].Card.Name.ToString();