Skip to content

Remove testmode config and pre-checkout customer creation#9

Merged
sandervanhooft merged 1 commit intomainfrom
fix/testmode-and-customer-creation
Mar 13, 2026
Merged

Remove testmode config and pre-checkout customer creation#9
sandervanhooft merged 1 commit intomainfrom
fix/testmode-and-customer-creation

Conversation

@sandervanhooft
Copy link
Copy Markdown
Member

Changes

Issue #5: Remove VATLY_TESTMODE

The Vatly API infers testmode purely from the API key prefix (test_ = test mode). No need to configure or pass it explicitly.

Changes:

  • Removed testmode config option from config/vatly.php
  • Changed VatlyConfig::isTestmode() to derive from API key prefix instead of config
  • Removed ManagesTestmode trait entirely
  • Removed use ManagesTestmode from CheckoutBuilder and SubscriptionBuilder
  • Removed testmode from checkout payload
  • Updated tests to reflect payload changes

Issue #6: Remove ensureHasVatlyCustomer from checkout/subscribe

Don't pre-create customers before checkout. Let Vatly handle customer creation during checkout, then sync via webhooks. This fixes the 422 error when email already exists in Vatly.

Changes:

  • Removed $this->ensureHasVatlyCustomer() call from checkout() method
  • Removed $this->ensureHasVatlyCustomer() call from subscribe() method
  • customerId in payload will be null for new users (filtered out by array_filter)

Closes #5
Closes #6

- Remove VATLY_TESTMODE config (API infers from key prefix)
- Remove ManagesTestmode trait and related code
- Remove ensureHasVatlyCustomer() from checkout/subscribe
- Let Vatly handle customer creation, sync via webhooks

Closes #5, closes #6
@sandervanhooft sandervanhooft merged commit 0272b00 into main Mar 13, 2026
5 checks passed
@sandervanhooft sandervanhooft deleted the fix/testmode-and-customer-creation branch March 13, 2026 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Handle existing customer when creating checkout Remove redundant VATLY_TESTMODE config option

1 participant