Skip to main content

max / makenotwork

2.0 KB · 39 lines History Blame Raw
1 -- The buyer's cross-currency conversion preference.
2 --
3 -- When a buyer's currency differs from the creator's, someone has to convert.
4 -- The buyer carries it either way, and this is where they say how:
5 --
6 -- 'checkout' -- Stripe converts and presents the price in the buyer's local
7 -- currency. Its rate carries a conversion fee. The default,
8 -- because it is the path where the buyer sees the real total on
9 -- Stripe's own page before committing to it.
10 -- 'bank' -- the session stays in the creator's currency and the buyer's
11 -- card issuer converts at a rate MNW cannot see or quote.
12 --
13 -- Mechanically this is one boolean on the Checkout Session
14 -- (`adaptive_pricing.enabled`). It is stored per buyer so a returning buyer is
15 -- not asked on every purchase; it stays changeable at checkout, so it is a
16 -- preference and not a lock.
17 --
18 -- WHY IT DEFAULTS TO 'checkout'. It is the only path where a number can be put
19 -- in front of the buyer before they pay. On the 'bank' path there is nothing
20 -- honest to display, since the rate belongs to their card issuer and is not
21 -- knowable in advance. A default of 'bank' would quietly make every
22 -- cross-currency purchase the one whose cost is invisible until the statement.
23 --
24 -- Guests have no row here. The checkout route falls back to the same default,
25 -- which is why the column default and the Rust default must not drift apart
26 -- (`ConversionChoice::default()`).
27
28 ALTER TABLE users
29 ADD COLUMN conversion_preference VARCHAR(10) NOT NULL DEFAULT 'checkout';
30
31 ALTER TABLE users
32 ADD CONSTRAINT users_conversion_preference_known
33 CHECK (conversion_preference IN ('checkout', 'bank'));
34
35 COMMENT ON COLUMN users.conversion_preference IS
36 'How this buyer wants a cross-currency purchase converted: checkout = Stripe '
37 'converts and shows the total, bank = their card issuer converts at its own '
38 'rate. Sets adaptive_pricing.enabled on the Checkout Session.';
39