Comments (5)
Thanks for the very fast answer, after looking through available events, I will try to do it this way:
if (stripeEvent.Type == Events.PaymentMethodAttached)
{
var element = stripeEvent.Data.Object as Stripe.PaymentMethod;
var service = new CustomerService();
var customer = await service.GetAsync(element.CustomerId);
if (customer.Address == null)
{
var address = element.BillingDetails.Address;
await service.UpdateAsync(element.CustomerId, new CustomerUpdateOptions()
{
Address = new AddressOptions()
{
City = address.City,
State = address.State,
Country = address.Country,
Line1 = address.Line1,
Line2 = address.Line2,
PostalCode = address.PostalCode
}
});
}
}
So when the first payment method is attached, I will apply the address to the customer.
Only question is if I'm fast enough, so that the update is done before the invoice is created and sent to the user. I just hope so and will need to check in Live-Mode, as in Dev Mode the email is not created automatically, so the code is always fast enough.
Btw. it would be awesome if one could configure included elements in the webhook definition. Something like, please include the customer in the webhook. (Expand like)
For all finding this post, yes it works and invoices have the right address.
from checkout-single-subscription.
Sorry for the delayed response! The billing address will be on the PaymentMethod attached to the Customer.
from checkout-single-subscription.
@cjavilla-stripe Hi, sorry to open the topic up again, but this leads to big issues.
The invoice created from a subscription through checkout does not contain the customer address. I think the reason is, that the customer created by stripe checkout does not have the billing address set, but only contains it on the PaymentMethod.
Do you have any proposal on how to fix it?
from checkout-single-subscription.
One option is to update the customer when you receive the checkout.session.completed event.
from checkout-single-subscription.
Thanks for the update, @Phmager. Happy to hear this solution works for you.
from checkout-single-subscription.
Related Issues (20)
- Demo links broken
- Use
- Add error handling to Java server example for /create-checkout-session HOT 3
- Examples needed fixing for legibility and Windows environments HOT 1
- handleFetchResult not used in checkout-single-subscription client HOT 1
- Add go / dotnet to .cli.json HOT 6
- PHP Demo's "shared.php" file missing (again) HOT 1
- Google Pay OR Apple Pay button is not showing.
- How to backdate and postdate the start of a subscription with the new checkout? HOT 1
- Change .NET Code to use App Secrets HOT 1
- The client HOT 1
- Stripe session customer info not being retrieved despite successful webhook HOT 6
- How to make a referral program with stripe subscription HOT 1
- PHP Demo's "shared.php" file missing HOT 4
- Clarify instructions for config.ini.sample to .config.ini HOT 1
- Checkout page attaches Payment Method to customer even if card data is incorrect. HOT 1
- Readme intro - error with prices create commant HOT 1
- No StripeOptions class HOT 2
- Repeat Orders HOT 5
- Stripe
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from checkout-single-subscription.