Create Card For Customer In Stripe Using C#

Hello, Today we will learn how we can add a card method in stripe customer. Before moving to that please refer my previous blog here to create customer in connected account.

In that blog we receive the “CustomerId” from stripe in the response object. We will use that id in the request.

Here is the code for add card to customer in connected account.

var requestOptions = new RequestOptions();
requestOptions.StripeAccount = "Connected Account Id";

var cardoptions = new CardCreateOptions
{
Source = "tok_visa" 
};

var cardservice = new CardService();
var Card = cardservice.Create("Stripe Customer Id", cardoptions, requestOptions);

The Card will be the card object return from stripe. we can use that card id while making payment in stripe.

In the source parameter we need to pass the card token. For, testing purpose I have used the test token provided by stripe. If you want to generate the token using card number, please follow the article here.

Submit a Comment

Your email address will not be published. Required fields are marked *

Subscribe

Select Categories