{"id":44784790,"url":"https://github.com/cap-go/capacitor-wechat","last_synced_at":"2026-05-11T15:06:05.044Z","repository":{"id":320993376,"uuid":"1083754535","full_name":"Cap-go/capacitor-wechat","owner":"Cap-go","description":"Capacitor plugin to interact with WeChat SDK","archived":false,"fork":false,"pushed_at":"2026-04-01T16:05:10.000Z","size":659,"stargazers_count":10,"open_issues_count":2,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-01T22:53:34.751Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Cap-go.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null},"funding":{"github":"Cap-go","patreon":null,"open_collective":"capgo","ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2025-10-26T16:49:44.000Z","updated_at":"2026-04-01T16:03:32.000Z","dependencies_parsed_at":"2026-02-20T06:01:52.294Z","dependency_job_id":null,"html_url":"https://github.com/Cap-go/capacitor-wechat","commit_stats":null,"previous_names":["cap-go/capacitor-wechat"],"tags_count":36,"template":false,"template_full_name":null,"purl":"pkg:github/Cap-go/capacitor-wechat","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cap-go%2Fcapacitor-wechat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cap-go%2Fcapacitor-wechat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cap-go%2Fcapacitor-wechat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cap-go%2Fcapacitor-wechat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Cap-go","download_url":"https://codeload.github.com/Cap-go/capacitor-wechat/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cap-go%2Fcapacitor-wechat/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31746113,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-13T06:26:45.479Z","status":"ssl_error","status_checked_at":"2026-04-13T06:26:44.645Z","response_time":93,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-02-16T09:05:56.587Z","updated_at":"2026-05-11T15:06:05.026Z","avatar_url":"https://github.com/Cap-go.png","language":"Java","funding_links":["https://github.com/sponsors/Cap-go","https://opencollective.com/capgo"],"categories":[],"sub_categories":[],"readme":"# capacitor-wechat\n\u003ca href=\"https://capgo.app/\"\u003e\u003cimg src=\"https://capgo.app/readme-banner.svg?repo=Cap-go/capacitor-wechat\" alt=\"Capgo - Instant updates for Capacitor\" /\u003e\u003c/a\u003e\n\n\u003cdiv align=\"center\"\u003e\n  \u003ch2\u003e\u003ca href=\"https://capgo.app/?ref=plugin_wechat\"\u003e ➡️ Get Instant updates for your App with Capgo\u003c/a\u003e\u003c/h2\u003e\n  \u003ch2\u003e\u003ca href=\"https://capgo.app/consulting/?ref=plugin_wechat\"\u003e Missing a feature? We'll build the plugin for you 💪\u003c/a\u003e\u003c/h2\u003e\n\u003c/div\u003e\n\nWeChat SDK for Capacitor - enables authentication, sharing, payments, and mini-programs.\n\n## Documentation\n\nThe most complete doc is available here: https://capgo.app/docs/plugins/wechat/\n\n## Compatibility\n\n| Plugin version | Capacitor compatibility | Maintained |\n| -------------- | ----------------------- | ---------- |\n| v8.\\*.\\*       | v8.\\*.\\*                | ✅          |\n| v7.\\*.\\*       | v7.\\*.\\*                | On demand   |\n| v6.\\*.\\*       | v6.\\*.\\*                | ❌          |\n| v5.\\*.\\*       | v5.\\*.\\*                | ❌          |\n\n\u003e **Note:** The major version of this plugin follows the major version of Capacitor. Use the version that matches your Capacitor installation (e.g., plugin v8 for Capacitor 8). Only the latest major version is actively maintained.\n\n## Install\n\n```bash\nnpm install @capgo/capacitor-wechat\nnpx cap sync\n```\n\n## Configuration\n\n### Capacitor config\n\nAdd your WeChat credentials to `capacitor.config.ts` (or `.json`). You can override them at runtime by calling `CapacitorWechat.initialize(...)`.\n\n```ts\nconst config: CapacitorConfig = {\n  appId: 'com.example.app',\n  appName: 'Example',\n  webDir: 'dist',\n  plugins: {\n    CapacitorWechat: {\n      appId: 'wx1234567890abcdef',\n      universalLink: 'https://your-universal-link.example.com/'\n    }\n  }\n};\n```\n\n### iOS\n\nAdd the following to your `Info.plist`:\n\n```xml\n\u003ckey\u003eLSApplicationQueriesSchemes\u003c/key\u003e\n\u003carray\u003e\n  \u003cstring\u003eweixin\u003c/string\u003e\n  \u003cstring\u003eweixinULAPI\u003c/string\u003e\n\u003c/array\u003e\n\n\u003ckey\u003eCFBundleURLTypes\u003c/key\u003e\n\u003carray\u003e\n  \u003cdict\u003e\n    \u003ckey\u003eCFBundleTypeRole\u003c/key\u003e\n    \u003cstring\u003eEditor\u003c/string\u003e\n    \u003ckey\u003eCFBundleURLName\u003c/key\u003e\n    \u003cstring\u003eweixin\u003c/string\u003e\n    \u003ckey\u003eCFBundleURLSchemes\u003c/key\u003e\n    \u003carray\u003e\n      \u003cstring\u003eYOUR_WECHAT_APP_ID\u003c/string\u003e\n    \u003c/array\u003e\n  \u003c/dict\u003e\n\u003c/array\u003e\n```\n\nYou'll need to integrate the WeChat SDK into your iOS project. Add the WeChat SDK to your `Podfile` or download it from the [WeChat Open Platform](https://developers.weixin.qq.com/doc/oplatform/en/Mobile_App/Access_Guide/iOS.html).\n\n**Important:** iOS requires a valid Universal Link to be configured. You must set the `universalLink` parameter either in your `capacitor.config` (as shown above) or when calling `initialize()`. Without a valid Universal Link, the app will crash during WeChat SDK initialization. Learn more about configuring Universal Links in the [WeChat iOS documentation](https://developers.weixin.qq.com/doc/oplatform/en/Mobile_App/Access_Guide/iOS.html).\n\n### Android\n\nAdd the following to your `AndroidManifest.xml`:\n\n```xml\n\u003cmanifest\u003e\n  \u003capplication\u003e\n    \u003c!-- WeChat callback activity --\u003e\n    \u003cactivity\n      android:name=\".wxapi.WXEntryActivity\"\n      android:exported=\"true\"\n      android:label=\"@string/app_name\"\n      android:launchMode=\"singleTask\"\n      android:theme=\"@android:style/Theme.Translucent.NoTitleBar\"\u003e\n      \u003cintent-filter\u003e\n        \u003caction android:name=\"android.intent.action.VIEW\" /\u003e\n        \u003ccategory android:name=\"android.intent.category.DEFAULT\" /\u003e\n      \u003c/intent-filter\u003e\n    \u003c/activity\u003e\n  \u003c/application\u003e\n\u003c/manifest\u003e\n```\n\nYou'll need to integrate the WeChat SDK into your Android project. Add the WeChat SDK dependency to your `build.gradle` or download it from the [WeChat Open Platform](https://developers.weixin.qq.com/doc/oplatform/en/Mobile_App/Access_Guide/Android.html).\n\nCreate `WXEntryActivity` and `WXPayEntryActivity` inside your application's package (`your.package.name.wxapi`). Both activities should extend `ee.forgr.plugin.capacitor_wechat.WechatResponseActivity` so the plugin can receive callbacks from WeChat:\n\n```java\npackage your.package.name.wxapi;\n\nimport ee.forgr.plugin.capacitor_wechat.WechatResponseActivity;\n\npublic class WXEntryActivity extends WechatResponseActivity {}\n\npublic class WXPayEntryActivity extends WechatResponseActivity {}\n```\n\nRegister these activities in your app manifest just like the snippet above (WeChat requires both for general SDK + Pay callbacks).\n\n## Setup\n\nBefore using any WeChat functionality, you need to register your app with a WeChat App ID from the [WeChat Open Platform](https://open.weixin.qq.com/). Once you have the credentials, either place them in `capacitor.config` or call `CapacitorWechat.initialize` before making other calls:\n\n```ts\nimport { CapacitorWechat } from '@capgo/capacitor-wechat';\n\nawait CapacitorWechat.initialize({\n  appId: 'wx1234567890abcdef',\n  universalLink: 'https://your-universal-link.example.com/'\n});\n```\n\n## API\n\n\u003cdocgen-index\u003e\n\n* [`initialize(...)`](#initialize)\n* [`isInstalled()`](#isinstalled)\n* [`auth(...)`](#auth)\n* [`share(...)`](#share)\n* [`sendPaymentRequest(...)`](#sendpaymentrequest)\n* [`openMiniProgram(...)`](#openminiprogram)\n* [`chooseInvoice(...)`](#chooseinvoice)\n* [`getPluginVersion()`](#getpluginversion)\n* [Interfaces](#interfaces)\n\n\u003c/docgen-index\u003e\n\n\u003cdocgen-api\u003e\n\u003c!--Update the source file JSDoc comments and rerun docgen to update the docs below--\u003e\n\nCapacitor WeChat Plugin - WeChat SDK integration for authentication, sharing, payments, and mini-programs.\n\n### initialize(...)\n\n```typescript\ninitialize(options: WechatInitializationOptions) =\u003e Promise\u003cvoid\u003e\n```\n\nInitialize the WeChat SDK with your application credentials.\n\nYou can also set these values in `capacitor.config.ts` under the `CapacitorWechat`\nplugin configuration. Calling this method overrides any bundled configuration at runtime.\n\n| Param         | Type                                                                                | Description                                                   |\n| ------------- | ----------------------------------------------------------------------------------- | ------------------------------------------------------------- |\n| **`options`** | \u003ccode\u003e\u003ca href=\"#wechatinitializationoptions\"\u003eWechatInitializationOptions\u003c/a\u003e\u003c/code\u003e | - Initialization options including the required WeChat App ID |\n\n**Since:** 1.1.0\n\n--------------------\n\n\n### isInstalled()\n\n```typescript\nisInstalled() =\u003e Promise\u003c{ installed: boolean; }\u003e\n```\n\nCheck if WeChat app is installed on the device.\n\n**Returns:** \u003ccode\u003ePromise\u0026lt;{ installed: boolean; }\u0026gt;\u003c/code\u003e\n\n**Since:** 1.0.0\n\n--------------------\n\n\n### auth(...)\n\n```typescript\nauth(options: WechatAuthOptions) =\u003e Promise\u003cWechatAuthResponse\u003e\n```\n\nAuthenticate user with WeChat OAuth.\n\n| Param         | Type                                                            | Description                              |\n| ------------- | --------------------------------------------------------------- | ---------------------------------------- |\n| **`options`** | \u003ccode\u003e\u003ca href=\"#wechatauthoptions\"\u003eWechatAuthOptions\u003c/a\u003e\u003c/code\u003e | - Authentication options including scope |\n\n**Returns:** \u003ccode\u003ePromise\u0026lt;\u003ca href=\"#wechatauthresponse\"\u003eWechatAuthResponse\u003c/a\u003e\u0026gt;\u003c/code\u003e\n\n**Since:** 1.0.0\n\n--------------------\n\n\n### share(...)\n\n```typescript\nshare(options: WechatShareOptions) =\u003e Promise\u003cvoid\u003e\n```\n\nShare content to WeChat.\n\n| Param         | Type                                                              | Description                                        |\n| ------------- | ----------------------------------------------------------------- | -------------------------------------------------- |\n| **`options`** | \u003ccode\u003e\u003ca href=\"#wechatshareoptions\"\u003eWechatShareOptions\u003c/a\u003e\u003c/code\u003e | - Share options including type, scene, and content |\n\n**Since:** 1.0.0\n\n--------------------\n\n\n### sendPaymentRequest(...)\n\n```typescript\nsendPaymentRequest(options: WechatPaymentOptions) =\u003e Promise\u003cvoid\u003e\n```\n\nSend payment request to WeChat Pay.\n\n| Param         | Type                                                                  | Description                           |\n| ------------- | --------------------------------------------------------------------- | ------------------------------------- |\n| **`options`** | \u003ccode\u003e\u003ca href=\"#wechatpaymentoptions\"\u003eWechatPaymentOptions\u003c/a\u003e\u003c/code\u003e | - Payment request options from server |\n\n**Since:** 1.0.0\n\n--------------------\n\n\n### openMiniProgram(...)\n\n```typescript\nopenMiniProgram(options: WechatMiniProgramOptions) =\u003e Promise\u003c{ extMsg?: string; }\u003e\n```\n\nOpen WeChat mini-program.\n\n| Param         | Type                                                                          | Description                                        |\n| ------------- | ----------------------------------------------------------------------------- | -------------------------------------------------- |\n| **`options`** | \u003ccode\u003e\u003ca href=\"#wechatminiprogramoptions\"\u003eWechatMiniProgramOptions\u003c/a\u003e\u003c/code\u003e | - Mini-program options including username and path |\n\n**Returns:** \u003ccode\u003ePromise\u0026lt;{ extMsg?: string; }\u0026gt;\u003c/code\u003e\n\n**Since:** 1.0.0\n\n--------------------\n\n\n### chooseInvoice(...)\n\n```typescript\nchooseInvoice(options: WechatInvoiceOptions) =\u003e Promise\u003cWechatInvoiceResponse\u003e\n```\n\nChoose invoice from WeChat.\n\n| Param         | Type                                                                  | Description                 |\n| ------------- | --------------------------------------------------------------------- | --------------------------- |\n| **`options`** | \u003ccode\u003e\u003ca href=\"#wechatinvoiceoptions\"\u003eWechatInvoiceOptions\u003c/a\u003e\u003c/code\u003e | - Invoice selection options |\n\n**Returns:** \u003ccode\u003ePromise\u0026lt;\u003ca href=\"#wechatinvoiceresponse\"\u003eWechatInvoiceResponse\u003c/a\u003e\u0026gt;\u003c/code\u003e\n\n**Since:** 1.0.0\n\n--------------------\n\n\n### getPluginVersion()\n\n```typescript\ngetPluginVersion() =\u003e Promise\u003c{ version: string; }\u003e\n```\n\nGet the native Capacitor plugin version.\n\n**Returns:** \u003ccode\u003ePromise\u0026lt;{ version: string; }\u0026gt;\u003c/code\u003e\n\n**Since:** 1.0.0\n\n--------------------\n\n\n### Interfaces\n\n\n#### WechatInitializationOptions\n\nWeChat initialization options.\n\n| Prop                | Type                | Description                                                         |\n| ------------------- | ------------------- | ------------------------------------------------------------------- |\n| **`appId`**         | \u003ccode\u003estring\u003c/code\u003e | Required WeChat application ID.                                     |\n| **`universalLink`** | \u003ccode\u003estring\u003c/code\u003e | iOS universal link that is associated with your WeChat application. |\n\n\n#### WechatAuthResponse\n\nWeChat authentication response.\n\n| Prop        | Type                | Description                                      |\n| ----------- | ------------------- | ------------------------------------------------ |\n| **`code`**  | \u003ccode\u003estring\u003c/code\u003e | Authorization code to exchange for access token. |\n| **`state`** | \u003ccode\u003estring\u003c/code\u003e | State parameter if provided in request.          |\n\n\n#### WechatAuthOptions\n\nWeChat authentication options.\n\n| Prop        | Type                | Description                                                                        |\n| ----------- | ------------------- | ---------------------------------------------------------------------------------- |\n| **`scope`** | \u003ccode\u003estring\u003c/code\u003e | OAuth scope. Use 'snsapi_userinfo' for user info or 'snsapi_login' for login only. |\n| **`state`** | \u003ccode\u003estring\u003c/code\u003e | Optional state parameter for CSRF protection.                                      |\n\n\n#### WechatShareOptions\n\nWeChat share options.\n\n| Prop                        | Type                                                                            | Description                                                                     |\n| --------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |\n| **`scene`**                 | \u003ccode\u003enumber\u003c/code\u003e                                                             | Share scene: 0 = Session (chat), 1 = Timeline (moments), 2 = Favorite.          |\n| **`type`**                  | \u003ccode\u003e'text' \\| 'image' \\| 'link' \\| 'music' \\| 'video' \\| 'miniprogram'\u003c/code\u003e | Share type: 'text', 'image', 'link', 'music', 'video', 'miniprogram'.           |\n| **`text`**                  | \u003ccode\u003estring\u003c/code\u003e                                                             | Text content (for type 'text').                                                 |\n| **`title`**                 | \u003ccode\u003estring\u003c/code\u003e                                                             | Title (for type 'link', 'music', 'video', 'miniprogram').                       |\n| **`description`**           | \u003ccode\u003estring\u003c/code\u003e                                                             | Description (for type 'link', 'music', 'video', 'miniprogram').                 |\n| **`link`**                  | \u003ccode\u003estring\u003c/code\u003e                                                             | Link URL (for type 'link').                                                     |\n| **`imageUrl`**              | \u003ccode\u003estring\u003c/code\u003e                                                             | Image URL or base64 data.                                                       |\n| **`thumbUrl`**              | \u003ccode\u003estring\u003c/code\u003e                                                             | Thumbnail URL or base64 data (for type 'link', 'music', 'video').               |\n| **`mediaUrl`**              | \u003ccode\u003estring\u003c/code\u003e                                                             | Music or video URL (for type 'music', 'video').                                 |\n| **`miniProgramUsername`**   | \u003ccode\u003estring\u003c/code\u003e                                                             | Mini-program username (for type 'miniprogram').                                 |\n| **`miniProgramPath`**       | \u003ccode\u003estring\u003c/code\u003e                                                             | Mini-program path (for type 'miniprogram').                                     |\n| **`miniProgramType`**       | \u003ccode\u003enumber\u003c/code\u003e                                                             | Mini-program type: 0 = Release, 1 = Test, 2 = Preview (for type 'miniprogram'). |\n| **`miniProgramWebPageUrl`** | \u003ccode\u003estring\u003c/code\u003e                                                             | Mini-program web page URL fallback (for type 'miniprogram').                    |\n\n\n#### WechatPaymentOptions\n\nWeChat payment options.\n\n| Prop            | Type                | Description                            |\n| --------------- | ------------------- | -------------------------------------- |\n| **`partnerId`** | \u003ccode\u003estring\u003c/code\u003e | Partner ID (merchant ID).              |\n| **`prepayId`**  | \u003ccode\u003estring\u003c/code\u003e | Prepay ID from unified order API.      |\n| **`nonceStr`**  | \u003ccode\u003estring\u003c/code\u003e | Random string.                         |\n| **`timeStamp`** | \u003ccode\u003estring\u003c/code\u003e | Timestamp.                             |\n| **`package`**   | \u003ccode\u003estring\u003c/code\u003e | Package value, typically 'Sign=WXPay'. |\n| **`sign`**      | \u003ccode\u003estring\u003c/code\u003e | Signature.                             |\n\n\n#### WechatMiniProgramOptions\n\nWeChat mini-program options.\n\n| Prop           | Type                | Description                                            |\n| -------------- | ------------------- | ------------------------------------------------------ |\n| **`username`** | \u003ccode\u003estring\u003c/code\u003e | Mini-program username (original ID).                   |\n| **`path`**     | \u003ccode\u003estring\u003c/code\u003e | Path to open in mini-program.                          |\n| **`type`**     | \u003ccode\u003enumber\u003c/code\u003e | Mini-program type: 0 = Release, 1 = Test, 2 = Preview. |\n\n\n#### WechatInvoiceResponse\n\nWeChat invoice response.\n\n| Prop        | Type                             | Description                 |\n| ----------- | -------------------------------- | --------------------------- |\n| **`cards`** | \u003ccode\u003eWechatInvoiceCard[]\u003c/code\u003e | Array of selected card IDs. |\n\n\n#### WechatInvoiceCard\n\nWeChat invoice card item.\n\n| Prop              | Type                | Description                        |\n| ----------------- | ------------------- | ---------------------------------- |\n| **`cardId`**      | \u003ccode\u003estring\u003c/code\u003e | The selected card identifier.      |\n| **`encryptCode`** | \u003ccode\u003estring\u003c/code\u003e | Encrypted code returned by WeChat. |\n\n\n#### WechatInvoiceOptions\n\nWeChat invoice options.\n\n| Prop            | Type                | Description     |\n| --------------- | ------------------- | --------------- |\n| **`appId`**     | \u003ccode\u003estring\u003c/code\u003e | App ID.         |\n| **`signType`**  | \u003ccode\u003estring\u003c/code\u003e | Signature type. |\n| **`cardSign`**  | \u003ccode\u003estring\u003c/code\u003e | Card signature. |\n| **`timeStamp`** | \u003ccode\u003estring\u003c/code\u003e | Timestamp.      |\n| **`nonceStr`**  | \u003ccode\u003estring\u003c/code\u003e | Random string.  |\n\n\u003c/docgen-api\u003e\n\n## Usage Examples\n\n### Check Installation\n\n```typescript\nimport { CapacitorWechat } from '@capgo/capacitor-wechat';\n\nconst checkWechat = async () =\u003e {\n  const { installed } = await CapacitorWechat.isInstalled();\n  console.log('WeChat installed:', installed);\n};\n```\n\n### Authentication\n\n```typescript\nconst loginWithWechat = async () =\u003e {\n  try {\n    const { code } = await CapacitorWechat.auth({\n      scope: 'snsapi_userinfo',\n      state: 'my_random_state'\n    });\n\n    // Send code to your backend to exchange for access token\n    const response = await fetch('https://yourapi.com/auth/wechat', {\n      method: 'POST',\n      body: JSON.stringify({ code })\n    });\n\n    const { access_token } = await response.json();\n    console.log('Access token:', access_token);\n  } catch (error) {\n    console.error('WeChat auth failed:', error);\n  }\n};\n```\n\n### Share Content\n\n```typescript\n// Share text\nconst shareText = async () =\u003e {\n  await CapacitorWechat.share({\n    scene: 0, // 0 = Chat, 1 = Moments, 2 = Favorite\n    type: 'text',\n    text: 'Hello from Capacitor WeChat!'\n  });\n};\n\n// Share link\nconst shareLink = async () =\u003e {\n  await CapacitorWechat.share({\n    scene: 1,\n    type: 'link',\n    title: 'Check out this awesome app!',\n    description: 'Built with Capacitor',\n    link: 'https://capacitorjs.com',\n    thumbUrl: 'https://capacitorjs.com/icon.png'\n  });\n};\n```\n\n### Payment\n\n```typescript\nconst payWithWechat = async () =\u003e {\n  // First, get payment parameters from your server\n  const paymentParams = await fetchPaymentParamsFromServer();\n\n  try {\n    await CapacitorWechat.sendPaymentRequest({\n      partnerId: paymentParams.partnerId,\n      prepayId: paymentParams.prepayId,\n      nonceStr: paymentParams.nonceStr,\n      timeStamp: paymentParams.timeStamp,\n      package: paymentParams.package,\n      sign: paymentParams.sign\n    });\n\n    console.log('Payment successful!');\n  } catch (error) {\n    console.error('Payment failed:', error);\n  }\n};\n```\n\n### Open Mini Program\n\n```typescript\nconst openMiniProgram = async () =\u003e {\n  const { extMsg } = await CapacitorWechat.openMiniProgram({\n    username: 'gh_xxxxxxxxxxxxx', // Mini program original ID\n    path: 'pages/index/index',\n    type: 0 // 0 = Release, 1 = Test, 2 = Preview\n  });\n\n  console.log('Mini program returned:', extMsg);\n};\n```\n\n## Important Notes\n\n1. **WeChat SDK**: The plugin pulls the official SDKs via CocoaPods (`WechatOpenSDK`) and Gradle (`com.tencent.mm.opensdk:wechat-sdk-android-without-mta`). If you use a custom build setup, ensure those dependencies stay intact.\n\n2. **App Registration**: You must register your app on the [WeChat Open Platform](https://open.weixin.qq.com/) to get an App ID.\n\n3. **Universal Links (iOS)**: For iOS 13+, you need to configure Universal Links for WeChat callbacks.\n\n4. **Backend Integration**: Authentication and payment features require backend integration to exchange codes for tokens and prepare payment parameters.\n\n## Troubleshooting\n\n### iOS: App crashes with NSException on startup\n\n**Problem:** App crashes immediately when WeChat plugin loads with an NSException error.\n\n**Solution:** This usually happens when the `universalLink` is not configured or is empty. Ensure you have set the `universalLink` in your `capacitor.config` or when calling `initialize()`:\n\n```typescript\n// In capacitor.config.ts\nplugins: {\n  CapacitorWechat: {\n    appId: 'wx1234567890abcdef',\n    universalLink: 'https://your-domain.com/universal-link/'  // Required for iOS!\n  }\n}\n\n// Or in your app initialization\nawait CapacitorWechat.initialize({\n  appId: 'wx1234567890abcdef',\n  universalLink: 'https://your-domain.com/universal-link/'\n});\n```\n\nLearn how to set up Universal Links for WeChat in the [WeChat iOS documentation](https://developers.weixin.qq.com/doc/oplatform/en/Mobile_App/Access_Guide/iOS.html).\n\n### iOS: Build errors with WechatOpenSDK\n\n**Problem:** Build fails with errors about missing WechatOpenSDK module.\n\n**Solution:** Make sure the WeChat SDK is properly installed via CocoaPods. Run:\n\n```bash\ncd ios/App\npod install\n```\n\n## Credits\n\nThis plugin was inspired by [cordova-plugin-wechat](https://github.com/xu-li/cordova-plugin-wechat) and adapted for Capacitor.\n\n## License\n\nMIT\n\n## Contributing\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to this plugin.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcap-go%2Fcapacitor-wechat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcap-go%2Fcapacitor-wechat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcap-go%2Fcapacitor-wechat/lists"}