Skip to content

fix(wechat): use navigateTo for mini program WebView payment#21

Merged
douglas-ou merged 1 commit intomainfrom
fix/miniprogram-webview-payment
Mar 11, 2026
Merged

fix(wechat): use navigateTo for mini program WebView payment#21
douglas-ou merged 1 commit intomainfrom
fix/miniprogram-webview-payment

Conversation

@douglas-ou
Copy link
Member

Summary

  • Replace postMessage-based bridge payment with wx.miniProgram.navigateTo to jump to a native mini program pay page, fixing the issue where postMessage only delivers on web-view back/share and cannot be used for real-time payment invocation.
  • Add WeChat JSSDK loading logic and detect navigateTo availability instead of the unreliable getCapabilities() handshake.
  • Remove dependency on ensureWechatMiniProgramBridge from PaymentModal.tsx.

Test plan

  • Trigger payment in WebView → confirm navigateTo jumps to mini program /pages/pay/pay
  • Verify wx.requestPayment success → auto-navigate back → polling detects PAID
  • Verify user cancel → error shown → tap back → returns to WebView
  • Run pnpm type-check — passes
  • Run pnpm lint — passes

🤖 Generated with Claude Code

Replace postMessage-based bridge payment with wx.miniProgram.navigateTo
to jump to a native mini program pay page. postMessage only delivers on
web-view back/share and cannot be used for real-time payment invocation.

- Add WeChat JSSDK loading logic for mini program environment
- Detect navigateTo availability instead of unreliable getCapabilities() handshake
- Remove dependency on ensureWechatMiniProgramBridge from PaymentModal

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@douglas-ou douglas-ou merged commit 549182f into main Mar 11, 2026
0 of 2 checks passed
@douglas-ou douglas-ou deleted the fix/miniprogram-webview-payment branch March 11, 2026 02:42
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.

1 participant