Kiksen
Kiksen

Reputation: 1767

Stripe Billing Address C# / Dotnet core

Got Stripe up and running quickly and setup my form to include Billing address. But can't seem to find any way to store it in stripe, using the .net sdk.
If I go to stripe dashboard I can manually put in the billing address for a customer.

My working code looks like the following:

var stripeCustomerCreateOptions = new StripeCustomerCreateOptions
{
    Email = value.StripeEmail,
    SourceToken = value.StripeToken,
};

var stripeCustomerService = new StripeCustomerService();
StripeCustomer customer = stripeCustomerService.Create(stripeCustomerCreateOptions);

var stripeSubscriptionService = new StripeSubscriptionService();
var subscription = stripeSubscriptionService.Create(customer.Id, _stripePlanId);

I would expect there was an option on the StripeCustomerCreateOptions to include billing information.

I get the billing information in form post request.

After looking further into it. I can see that the Credit card has the information about address. But that is not desired.
I would like the receipt to have the billing address.
The only way I have gotten that to work is to update the customer manually from the dashboard.

Upvotes: 2

Views: 958

Answers (2)

Chirag
Chirag

Reputation: 76

For Version 21.7.0 Here passing Billing address is changed like below code

var options = new CustomerCreateOptions
{
     Email = stripeEmail,
     SourceToken = stripeToken,
     Shipping = new ShippingOptions()
     {
          Name = LoginUser.FirstName + " " + LoginUser.LastName,
          Phone = LoginUser.Mobile,
          Address = new AddressOptions()
          {
              Line1 = LoginUser.Address,
              PostalCode = LoginUser.ZipCode,
              State = LoginUser.State,
              City = LoginUser.City,
              Country = LoginUser.Country
          }
     }
};

Upvotes: 3

Kiksen
Kiksen

Reputation: 1767

Found out after talking to support I had to set the shipping address, to get the billing address on their backend....

            var stripeCustomerCreateOptions = new StripeCustomerCreateOptions
            {
                Email = stripeEmail,
                SourceToken = stripeToken,
                Shipping = new StripeShippingOptions()
                {
                    Name = stripeBillingName,
                    Line1 = stripeBillingAddressLine1,
                    PostalCode = stripeBillingAddressZip,
                    State = stripeBillingAddressState,
                    CityOrTown = stripeBillingAddressCity,
                    Country = stripeBillingAddressCountry
                }
            };

Upvotes: 2

Related Questions