#elias117-checkout-session
1 messages ยท Page 1 of 1 (latest)
Hi there ๐ you can definitely create a checkout session to charge for a specified amount, but let me double check coupling that with Stripe Tax.
Ok !
Yup, you should be able to combine Stripe Tax with Checkout Sessions, and this guide helps walk through that.
https://stripe.com/docs/payments/checkout/taxes?tax-calculation=stripe-tax
ok is there a guide on the .net core stripe package
I'd like to be able to create a checkout session with the amount and credit card information
When you're looking at the code snippets in our guides, they should have an option to toggle the language that they display in. The point of a checkout session is to collect the customer's payment information, if you already have the card details, then a checkout session may not be the right path. Can you tell me a bit more about the flow you're trying to accomplish?
certainly
I have the amount I want to charge and I have the credit card information and billing address of the customer
all I want to do is make a call to an api endpoint that takes all that information and calculates the tax automatically
and charges the card
returns if it succeeded or not
And the card information that you have, is that in the form a Payment Method object?
https://stripe.com/docs/api/payment_methods
yes it is
or I at least can make a payment method object with the info if need be
right now i believe i have it as this
StripeCreditCardPaymentInfo Object
I do have it in a payment method object
var paymentMethod = new PaymentMethodCreateOptions
{
Type = "card",
Card = new PaymentMethodCardCreateOptions
{
ExpYear = info.ExpirationYear,
ExpMonth = info.ExpirationMonth,
Cvc = info.Cvc,
Number = info.CreditCardNumber.Replace(" ", ""),
},
BillingDetails = new BillingDetailsOptions
{
Name = info.CardHolderName,
}
};
I use that to create the payment method
Gotcha, so you can't do automatic tax directly on a Payment Intent, which leaves you with a couple options.
- You could create a subscription, this doesn't sound like the right fit as sounds like you're trying a one time charge
- You could create a checkout session, but if you already have the payment method this may not make much sense
- You can create an invoice to handle this flow. There are a couple steps to this as you'll need to have a customer object created, add the invoice line(s) to them, and then create the invoice.
Please bear with me a moment, I'm going to test something and see if that might work for your needs.
yeah this would be a one time charge
Apologies about that, the test didn't do what I'd hoped.
So given the provided information, I think invoices are going to be the path that you want.
This doc walks through the steps of creating an invoice:
https://stripe.com/docs/invoicing/integration
In that guide they create a price object, and then use it later. You can alter this process slightly by passing price_data when creating the invoice item, rather than passing price. This link is to our API ref (already set to .NET for you) showing the invoice line creation section:
https://stripe.com/docs/api/invoiceitems/create?lang=dotnet#create_invoiceitem-price_data
I see rather than creating a price object I can just pass in the price_data instead. Am I understanding correctly?
Yup. You may still need to create a product object though. That will depend on what you're selling, and if you're going to need different tax codes for them. If you only sell one type of product, then you set a default tax code at your account level that will be applied whenever using automatic_tax, but if you're selling different types of products then you'll need product objects to map them to the various tax codes.
https://stripe.com/docs/tax/products-prices-tax-codes-tax-behavior
yeah unfortunately this may not be the path we need to take. Its a food delivery business and we are trying to grow across several regions. we cant create product objects for all our vendors menu items
well we can but it may be too much work
is there anyway we can take tax on a payment intent automatically?
No, you can't use do automatic tax calculation on a payment intent. It's also worth noting that in order for us to automatically calculate tax, you have to tell us what is being sold as tax rates fluctuate based on this information.
I can leave it open until the end of my shift (about another hour), but if it's archived you can always send us a new message in #dev-help and we can re-open this one or create a new one.
is there a way I can see it when it is archived
I think so. In my view there is a # icon near the top of the window (near the notification bell and pin icon). Clicking on that shows me all threads and I can search in there, do you see something similar?
Awesome! Happy to help ๐