我试着用Stripe来替别人充电。我成功地完成了连接部分,但之后我尝试创建一个令牌/充电,但它没有工作。
关于代码中使用的参数的一些信息:
这是我的代码:
StripeRequestOptions requestOptions = new StripeRequestOptions();
requestOptions.StripeConnectAccountId = "acct_158fBBAOizDDfp9B";
var myToken = new StripeTokenCreateOptions();
myToken.Card = new StripeCreditCardOptions()
{
// set these properties if passing full card details (do not
// set these properties if you set TokenId)
Number = "4242424242424242",
ExpirationYear = "2022",
ExpirationMonth = "10",
AddressCountry = "US", // optional
AddressLine1 = "24 Beef Flank St", // optional
AddressLine2 = "Apt 24", // optional
AddressCity = "Biggie Smalls", // optional
AddressState = "NC", // optional
AddressZip = "27617", // optional
Name = "Joe Meatballs", // optional
Cvc = "1223" // optional
};
// set this property if using a customer (stripe connect only)
myToken.CustomerId = WebConfig.AppSettings.StripeClientId; // My client ID get from Stripe dashboard.
//var tokenService = new StripeTokenService(WebConfig.AppSettings.StripeSecretApiKey);
var tokenService = new StripeTokenService("sk_test_5E9d7UHs9CVa3Ansop2JzIxI");
StripeToken stripeToken = tokenService.Create(myToken, requestOptions);我有一个,您必须为这个客户传递一个有效的卡ID。错误。
发布于 2015-12-09 21:52:52
几件事:
由于您使用的是Stripe,所以您只能使用Stripe.js或Stripe创建令牌,因此您的服务器永远无法访问卡片信息。另外,我不知道为什么要将令牌的customerId设置为客户机id,客户端不是客户。
另外,API键应该是您的API密钥,因为您使用的是Stripe帐户头,所以选项要么是( API键和连接帐户的帐户id )要么是(访问令牌)。这将在Stripe 文档的身份验证部分中讨论。
https://stackoverflow.com/questions/34171021
复制相似问题