On the VAT rate it wouldn't matter which way I (or other customers) preferred to do it. That decision would have already been made when the payment was taken otherwise I'd have to process another payment via Stripe - very messy for accounting. The example could have also been:
A $60 payment in Stripe from someone in the UK, France etc should result in an invoice for $50 + $10 VAT
A $50 payment in Stripe from someone in the US, Canada etc should result in an invoice for $50 + $0.00 VAT
Something like this should do the trick (I guess you have the second half of this already):
def get_tax_amount(stripe_payment)
if stripe_payment.metadata.tax.nil?
if customer.auto_eu_vat_on? && EU_COUNTRY_CODES.include?(stripe_payment.country_code)
return stripe_payment.amount * (EU_VAT_RATES[customer.country_code]/100)
end
else
return 0.0
end
else
return stripe_payment.amount * (stripe_payment.metadata.tax/100)
end
end
Critically with my current payment mechanisms I only find out the customer's country when they checkout with Stripe. I don't want to ask them before that to keep the form field count low and work within WuFoo's constraints. I don't know if I need to charge a customer VAT until after they have paid. (I conscious that I'm effectively either my giving EU customers a discount or charging non-EU customers a premium but that's not a concern at the moment.)The only cases I can think of that would require metatdata are:
1) A $60 payment in Stripe from someone in Germany where the company's EU VAT number is provided in metadata should result in an invoice for $60 + $0.00 VAT
2) If I'm selling products that have different VAT rates. That's unlikely if your market is primarily software / digital products like Stripe's market.