Skip to content

Comments

Fix Stripe Link payment method not being sent to transactionInitialize#52

Merged
lkostrowski merged 1 commit intomainfrom
ENG-1214
Jan 27, 2026
Merged

Fix Stripe Link payment method not being sent to transactionInitialize#52
lkostrowski merged 1 commit intomainfrom
ENG-1214

Conversation

@lkostrowski
Copy link
Member

@lkostrowski lkostrowski commented Jan 27, 2026

Summary

  • Fix payment with Stripe Link failing because elements.submit() returns selectedPaymentMethod as undefined for Link
  • Track the selected payment method type via PaymentElement's onChange event and use it as a fallback

Problem

When a user pays with Stripe Link (saved payment credentials), elements.submit() returns selectedPaymentMethod as undefined instead of "link". This causes the transactionInitialize mutation to fail because no payment method type is provided.

Solution

Use the PaymentElement's onChange event to track the selected payment method type (event.value.type). When elements.submit() doesn't return selectedPaymentMethod, fall back to the value captured from onChange.

Changes (stripe-checkout-form.tsx)

  1. Import StripePaymentElementChangeEvent type
  2. Add paymentMethodType state to track the selected type from onChange
  3. Add onChange handler on PaymentElement
  4. Resolve payment method as selectedPaymentMethod || paymentMethodType

Test plan

  • Pay with a new card — should work as before
  • Register with Stripe Link during checkout
  • On a subsequent payment, use saved Link credentials
  • Verify paymentMethod sent to transactionInitialize is "link"
  • Confirm payment completes successfully

Related

saleor/apps#2207

🤖 Generated with Claude Code

@vercel
Copy link

vercel bot commented Jan 27, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
saleor-payment-apps-testclient Ready Ready Preview Jan 27, 2026 7:11am

Request Review

@lkostrowski lkostrowski changed the title Support Link payment method Fix Stripe Link payment method not being sent to transactionInitialize Jan 27, 2026
@lkostrowski lkostrowski merged commit 2cfe94c into main Jan 27, 2026
6 checks passed
@lkostrowski lkostrowski deleted the ENG-1214 branch January 27, 2026 12:13
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.

2 participants