checkout: reuse the provider customer across attempts #118

Stängd
öppnade 2026-10-08 21:12:29 +00:00 av supernaut · 1 kommentar
Ägare

What

Every startCheckout creates a new Mollie customer. Related: #85, #112, #113.

Why

beginCheckout says the idempotency key lets a retry reuse the customer. The key is chargeId, a new randomUUID() per call, so it never does. There is no erasure path for these customers yet. #85 also needs a stable customer.

Failing case

Three checkout attempts leave three Mollie customers with the same name and email.

Fix

Store the provider customer ref on customer. Reuse it. Create only when null. Update name and email at the provider when they change.

Done when

  • Two checkouts for one customer create one Mollie customer.
  • Test covers it.

Plan outline

  1. Migration: nullable customer.provider_customer_ref, coordinated with #113 and #112.
  2. Adapter: ensureCustomer(ref | null, name, email) creates or updates.
  3. startCheckout passes the stored ref and persists a new one.
  4. Backfill from payment_method.provider_data.customerId where present.
  5. Keep subscription descriptions unique per customer (see #85).
## What Every `startCheckout` creates a new Mollie customer. Related: #85, #112, #113. ## Why `beginCheckout` says the idempotency key lets a retry reuse the customer. The key is `chargeId`, a new `randomUUID()` per call, so it never does. There is no erasure path for these customers yet. #85 also needs a stable customer. ## Failing case Three checkout attempts leave three Mollie customers with the same name and email. ## Fix Store the provider customer ref on `customer`. Reuse it. Create only when null. Update name and email at the provider when they change. ## Done when - [ ] Two checkouts for one customer create one Mollie customer. - [ ] Test covers it. ## Plan outline 1. Migration: nullable `customer.provider_customer_ref`, coordinated with #113 and #112. 2. Adapter: `ensureCustomer(ref | null, name, email)` creates or updates. 3. `startCheckout` passes the stored ref and persists a new one. 4. Backfill from `payment_method.provider_data.customerId` where present. 5. Keep subscription descriptions unique per customer (see #85).
supernaut lade till detta till projektet Bitborg Payment 2026-10-08 21:14:10 +00:00
Upphovsperson
Ägare

Folded into #144, which now also covers updating name and email at the provider, the backfill from payment_method.provider_data.customerId, and unique subscription descriptions. Closing this one. Follow #144.

Folded into #144, which now also covers updating name and email at the provider, the backfill from `payment_method.provider_data.customerId`, and unique subscription descriptions. Closing this one. Follow #144.
Logga in för att delta i denna konversation.
Ingen milstolpe
Inget projekt
Inga tilldelade
1 deltagare
Notiser
Förfallodatum
Förfallodatumet är ogiltigt eller utanför gränserna. Använd formatet "åååå-mm-dd".

Inget förfallodatum satt.

Beroenden

Inga beroenden satta

Referens
bitborg/bitborg-payment#118
Ingen beskrivning angiven.