I try to use Stripe to charge on behalf of someone. I did the connect part with success, but I tried to create a token/charge after that and it doesn't work.
Some info on parameters used in the code:
- "acct_158fBBAOizDDfp9B" - Get from the Connect user;
- WebConfig.AppSettings.StripeClientId - My client Id get from Stripe dashboard;
- WebConfig.AppSettings.StripeSecretApiKey - My Stripe Secret API Key;
- "sk_test_5E9d7UHs9CVa3Ansop2JzIxI" - Private API key get from Connect user.
Here is my code:
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);
I've got a «You must pass a valid card ID for this customer.» error.