簡體   English   中英

創建包含來源(信用卡)的 Stripe 客戶后,我可以獲得返回的信用卡詳細信息嗎?

[英]Can I get the returned credit card details after creating a Stripe customer that includes a source (credit card)?

使用 Stripe 創建一個新客戶,如下所示,我以令牌 ID 的形式向客戶添加一個來源(信用卡)。 創建客戶后,我可以看到返回了源 ID,但沒有返回數據。

問題- 是否可以讓客戶獲取數據,這樣我就不必從 Stripe 執行另一個請求來獲取卡的詳細信息?

這是一個簡單的例子

StripeConfiguration.ApiKey = "sk_test_1234";
var options = new CustomerCreateOptions {
       Email = "email,
       Name = "name,
       Source = "12345" // card token number here
};
var service = new CustomerService();
customer = service.Create(options);

這是我在客戶回來時看到的。 您可以看到 defaultSourceId(卡片),但 DefaultSource 為空。 如果它返回詳細信息(品牌、lastfour、exp 月份、exp 年份等),那就太好了,否則我必須再次調用 Stripe 以獲取卡片詳細信息。

在此處輸入圖片說明

創建或檢索客戶時,默認情況下不再包含客戶的來源: https : //stripe.com/docs/api/customers/object#customer_object-sources

如果您仍想檢索源列表,則必須擴展客戶創建調用: https : //stripe.com/docs/api/expanding_objects

例如:

StripeConfiguration.ApiKey = "sk_test_1234";
var options = new CustomerCreateOptions {
       Email = "email,
       Name = "name,
       Source = "12345" // card token number here
};
// Request the full list of sources attached to this customer
options.AddExpand("sources");

var service = new CustomerService();
customer = service.Create(options);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM