Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/297.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
C# Stripe.net-尝试代为收费_C#_Stripe Payments_Stripe Connect_Stripe.net - Fatal编程技术网

C# Stripe.net-尝试代为收费

C# Stripe.net-尝试代为收费,c#,stripe-payments,stripe-connect,stripe.net,C#,Stripe Payments,Stripe Connect,Stripe.net,我试着用条纹来代表某人收费。我成功地完成了连接部分,但之后我尝试创建一个令牌/费用,但没有成功 有关代码中使用的参数的一些信息: “acct_158; fbbaoizddfp9b”-从连接用户处获取 WebConfig.AppSettings.StripeClientId-从Stripe获取的我的客户端Id 仪表板 WebConfig.AppSettings.StripeSecretApiKey-我的条纹 秘密API密钥 “sk_测试_5E9d7UHs9CVa3Ansop2JzIxI”-专用A

我试着用条纹来代表某人收费。我成功地完成了连接部分,但之后我尝试创建一个令牌/费用,但没有成功

有关代码中使用的参数的一些信息:

  • “acct_158; fbbaoizddfp9b”-从连接用户处获取
  • WebConfig.AppSettings.StripeClientId-从Stripe获取的我的客户端Id 仪表板
  • WebConfig.AppSettings.StripeSecretApiKey-我的条纹 秘密API密钥
  • “sk_测试_5E9d7UHs9CVa3Ansop2JzIxI”-专用API密钥 从连接用户获取
这是我的密码:

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。»错误。

有几件事:

由于您使用的是Stripe Connect,因此您只能使用Stripe.js或Stripe Checkout创建令牌,因此您的服务器不应访问卡信息。另外,我不知道为什么要将令牌的customerId设置为客户id,客户不是客户

此外,API密钥应该是您的API密钥,因为您使用的是条带帐户头,所以选项是(您的API密钥和连接帐户的帐户id)或(访问令牌)。这将在条带连接的身份验证部分讨论