{"id":14616,"date":"2022-12-06T18:08:16","date_gmt":"2022-12-06T10:08:16","guid":{"rendered":"https:\/\/www.yimenapp.com\/kb-yimen\/?p=14616"},"modified":"2022-12-06T18:08:17","modified_gmt":"2022-12-06T10:08:17","slug":"settransanctionlistener-%e8%ae%be%e7%bd%ae%e4%ba%a4%e6%98%93%e7%9b%91%e5%90%ac%e5%99%a8-app%e5%bc%80%e5%8f%91%e6%8e%a5%e5%85%a5%e8%8b%b9%e6%9e%9c%e5%86%85%e8%b4%adios%e5%86%85%e8%b4%ad%e5%bc%80","status":"publish","type":"post","link":"https:\/\/www.yimenapp.com\/kb-yimen\/14616\/","title":{"rendered":"setTransanctionListener\u00a0\u8bbe\u7f6e\u4ea4\u6613\u76d1\u542c\u5668 APP\u5f00\u53d1\u63a5\u5165\u82f9\u679c\u5185\u8d2dIOS\u5185\u8d2d\u5f00\u53d1\u6559\u7a0b"},"content":{"rendered":"\n<figure id=\"pid16585\" class=\"wp-block-table\"><table><tbody><tr><td>\u7528\u505a\u7f51\u9875\u7684\u6280\u672f\u505a<a rel=\"noreferrer noopener\" href=\"https:\/\/www.yimenapp.com\/\" target=\"_blank\">APP<\/a>\uff01<br><span class=\"wpcom_keyword_link\"><a href=\"https:\/\/www.yimenapp.com\" title=\"\u5f00\u53d1APP\u4ece\u4e00\u95e8\u5f00\u59cb\">\u4e00\u95e8<\/a><\/span>\u63d0\u4f9b\u6807\u51c6\u5316\u7684<strong>jsbridge-mini.js\u5e93<\/strong>\uff0c\u60a8\u53ea\u9700\u8981\u5728\u9875\u9762<strong>\u5f15\u7528<\/strong>\u5e76<strong>\u6267\u884c<\/strong>JS\u5373\u53ef\u5b9e\u73b0\u5404\u79cd<strong>\u539f\u751fAPP\u3001\u539f\u751fPC<\/strong>\u7684\u529f\u80fd\u80fd\u529b\u3002<br><br><strong>==================APP\u7aef==================<\/strong><br><strong>\u3010APP\u7aef\u3011\uff08\u5b89\u5353\u7248&amp;\u82f9\u679c\u7248\uff09<\/strong>\u76ee\u524d\u63d0\u4f9b200+\u539f\u751f\u529f\u80fd\uff0c2000+JS\u6620\u5c04\u63a5\u53e3\uff0c\u7528\u505a\u7f51\u7ad9\u7684\u6280\u672f\u5373\u53ef\u5b9e\u73b0\u5404\u79cd\u539f\u751fAPP\u80fd\u529b\u3001APP demo\u5730\u5740<a rel=\"noreferrer noopener\" href=\"https:\/\/www.yimenapp.com\/doc\/demo.cshtml\" target=\"_blank\">https:\/\/www.yimenapp.com\/doc\/demo.cshtml<\/a>\u4e0b\u8f7d\u6559\u7a0b\uff1a<br>\u2666\u00a0<strong>JS-SDK<\/strong>\u00a0\u5f15\u7528\u65b9\u5f0f\uff1a<br>\u2666 \u666e\u901a\u7f51\u9875 script \u65b9\u5f0f\u52a0\u8f7d\uff1a\u4e0b\u8f7d\u6700\u65b0\u7248\uff0c\u8bf7\u5728\u9875\u9762\u4e0a\u8c03\u7528 jsBridge \u63a5\u53e3\u4e4b\u524d\u5f15\u7528 jsbridge-mini.js \u5e93\uff1b<br>\u2666 js module \u65b9\u5f0f\u5f15\u7528\uff1anpm install ym-jsbridge\u00a0<a rel=\"noreferrer noopener\" href=\"https:\/\/www.npmjs.com\/package\/ym-jsbridge\" target=\"_blank\">\u5177\u4f53\u8bf7\u53c2\u8003 npm package<\/a><\/td><\/tr><\/tbody><\/table><figcaption>\u4e00\u95e8APP\u5f00\u53d1\u5e73\u53f0\u901a\u7528JS<\/figcaption><\/figure>\n\n\n\n<p>setTransanctionListener\u00a0\u8bbe\u7f6e\u4ea4\u6613\u76d1\u542c\u5668 APP\u5f00\u53d1\u63a5\u5165\u82f9\u679c\u5185\u8d2d<span class=\"wpcom_tag_link\"><a href=\"https:\/\/www.yimenapp.com\/kb-yimen\/tag\/ios%e5%86%85%e8%b4%ad%e5%bc%80%e5%8f%91\/\" title=\"IOS\u5185\u8d2d\u5f00\u53d1\" target=\"_blank\">IOS\u5185\u8d2d\u5f00\u53d1<\/a><\/span>\u6559\u7a0b<\/p>\n\n\n\n<p>\u2022 \u8c03\u7528 getUnfinishedTransactions\/purchase\/restoreTransactions\/finishTransaction \u65b9\u6cd5\u4e4b\u524d\u5e94\u8bbe\u7f6e\u672c\u76d1\u542c\u5668\uff0c\u6240\u6709\u4ea4\u6613\u72b6\u6001\u53d8\u66f4\u90fd\u4f1a\u901a\u77e5\u5230\u6b64\u76d1\u542c\u5668\u3002<\/p>\n\n\n\n<p>\u2022 \u7cfb\u7edf\u4ee5\u6570\u7ec4\u5f62\u5f0f\u5c06\u4ea4\u6613\u4fe1\u606f\u4f20\u9012\u7ed9\u56de\u8c03\u53c2\u6570 transactions<\/p>\n\n\n\n<p>\u2022 \u5982\u679c\u591a\u6b21\u8bbe\u7f6e\u76d1\u542c\u5668\uff0c\u53ea\u6709\u6700\u540e\u4e00\u4e2a\u624d\u4f1a\u6536\u5230\u901a\u77e5\u3002<\/p>\n\n\n\n<p>\u6838\u5fc3\u4ee3\u7801\u793a\u4f8b\uff0c\u8be6\u60c5\u53c2\u9605demo<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-js\" data-lang=\"JavaScript\"><code>jsBridge.iap.setTransanctionListener(function(succ, transactions) {\n  if (succ) {\n    var json = JSON.stringify(transactions);\n    jsBridge.setClipboardText(json);\n    \/\/transactions.forEach(function(x){jsBridge.iap.finishTransaction({transactionId: x.transactionId});})\n    alert(json);\n  } else {\n    alert(&quot;\u64cd\u4f5c\u5931\u8d25\\n&quot; + JSON.stringify(transactions));\n  }\n});\nalert(&quot;\u5df2\u8bbe\u7f6e\u76d1\u542c\u5668&quot;);\n\n\/**\ntransactions \u8fd4\u56de\u4ea4\u6613\u4fe1\u606f\u6570\u7ec4\n[{\n  state:                 \/\/\u4ea4\u6613\u72b6\u6001\uff0c\u8be6\u89c1\u4ea4\u6613\u72b6\u6001\u5e38\u91cf\uff0c\u6570\u5b57\u7c7b\u578b    \n  transactionId:         \/\/\u4ea4\u6613id\uff0c\u5b57\u7b26\u4e32\u7c7b\u578b    \n  originalTransactionId: \/\/\u539f\u59cb\u4ea4\u6613id\uff0c\u53ea\u5728state\u4e3a\u6062\u590d\u8d2d\u4e70\u65f6\u6709\u6548\uff0c\u5b57\u7b26\u4e32\u7c7b\u578b\n  transactionDate:       \/\/\u4ea4\u6613\u65f6\u95f4\uff0cUNIX \u65f6\u95f4\u6233\uff08\u79d2\uff09\n  receipt:               \/\/\u4ea4\u6613\u51ed\u8bc1\uff0c\u7ecf\u8fc7base64\u7f16\u7801\uff0c\u7528\u4e8e\u9a8c\u8bc1\u4ea4\u6613\u662f\u5426\u5408\u6cd5\u548c\u6709\u6548\uff0c\u907f\u514d\u56e0\u8d8a\u72f1\u7834\u89e3\u5185\u8d2d\u540e\u9020\u6210\u635f\u5931\uff0c\u53ea\u5728state\u4e3a\u8d2d\u4e70\u6210\u529f\u65f6\u6709\u6548\uff0c\u5b57\u7b26\u4e32\u7c7b\u578b\n  errorCode:             \/\/\u4ea4\u6613\u5931\u8d25\u65f6\u7684\u9519\u8bef\u7801\uff0c\u6570\u5b57\u7c7b\u578b    \n  errorMsg:              \/\/\u4ea4\u6613\u5931\u8d25\u65f6\u7684\u8bf4\u660e\uff0c\u5b57\u7b26\u4e32\u7c7b\u578b    \n  payment:               \/\/\u5546\u54c1\u8d2d\u4e70\u4fe1\u606f\n  {\n    productId:           \/\/\u5546\u54c1ID\uff0c\u5b57\u7b26\u4e32\u7c7b\u578b\n    quantity:            \/\/\u8d2d\u4e70\u6570\u91cf\uff0c\u6570\u5b57\u7c7b\u578b\n    applicationUsername: \/\/\u7528\u6237\u4fe1\u606f\uff0c\u5b57\u7b26\u4e32\u7c7b\u578b\n  },\n  downloads:             \/\/\u6709\u4e0b\u8f7d\u5185\u5bb9\u65f6\u7684\u4e0b\u8f7d\u4fe1\u606f\u5217\u8868\n  [{    \n    state:               \/\/\u4e0b\u8f7d\u72b6\u6001\uff0c\u8be6\u89c1\u4e0b\u8f7d\u72b6\u6001\u5e38\u91cf\uff0c\u6570\u5b57\u7c7b\u578b\n    transactionId:       \/\/\u4e0b\u8f7d\u5185\u5bb9\u6240\u5c5e\u4ea4\u6613id\uff0c\u5b57\u7b26\u4e32\u7c7b\u578b\n    contentId:           \/\/\u4e0b\u8f7d\u5185\u5bb9id\uff0c\u5b57\u7b26\u4e32\u7c7b\u578b\n    progress:            \/\/\u4e0b\u8f7d\u8fdb\u5ea6\uff0c\u53d6\u503c\u8303\u56f40~1\uff0c\u6570\u5b57\u7c7b\u578b\n    contentLength:       \/\/\u6587\u4ef6\u5185\u5bb9\u5927\u5c0f\uff0c\u6570\u5b57\u7c7b\u578b\n    timeRemaining:       \/\/\u4e0b\u8f7d\u5269\u4f59\u65f6\u95f4\uff0c-1\u65f6\u8868\u793a\u672a\u77e5\uff0c\u6570\u5b57\u7c7b\u578b\n    contentVersion:      \/\/\u4e0b\u8f7d\u5185\u5bb9\u7684\u7248\u672c\uff0c\u5b57\u7b26\u4e32\u7c7b\u578b\n    contentURL:          \/\/\u4e0b\u8f7d\u6210\u529f\u540e\u6587\u4ef6\u8def\u5f84\uff0c\u5b57\u7b26\u4e32\u7c7b\u578b\n    errorCode:           \/\/\u4e0b\u8f7d\u5931\u8d25\u65f6\u7684\u9519\u8bef\u7801\uff0c\u6570\u5b57\u7c7b\u578b\n    errorMsg:            \/\/\u4e0b\u8f7d\u5931\u8d25\u65f6\u7684\u9519\u8bef\u63cf\u8ff0\uff0c\u5b57\u7b26\u4e32\u7c7b\u578b\n  }]\n}]\n\nstate(transaction) \u4ea4\u6613\u72b6\u6001\u5e38\u91cf\u8bf4\u660e\n0: \u5df2\u52a0\u5165\u4ea4\u6613\u961f\u5217(Transaction is being added to the server queue.)\n1: \u4ea4\u6613\u5b8c\u6210(Transaction is in queue, user has been charged.  Client should complete the transaction.)\n2: \u4ea4\u6613\u5931\u8d25(Transaction was cancelled or failed before being added to the server queue.)\n3: \u6062\u590d\u8d2d\u4e70(Transaction was restored from user&#39;s purchase history.  Client should complete the transaction.)\n4: \u4ea4\u6613\u7b49\u5f85\u88ab\u786e\u8ba4(The transaction is in the queue, but its final status is pending external action.)\n    \nstate(download) \u4e0b\u8f7d\u72b6\u6001\u5e38\u91cf\u8bf4\u660e\n0: \u7b49\u5f85\u4e0b\u8f7d(Download is inactive, waiting to be downloaded)\n1: \u6b63\u5728\u4e0b\u8f7d(Download is actively downloading)\n2: \u6682\u505c\u4e0b\u8f7d(Download was paused by the user)\n3: \u4e0b\u8f7d\u5b8c\u6210(Download is finished, content is available)\n4: \u4e0b\u8f7d\u5931\u8d25(Download failed)\n5: \u53d6\u6d88\u4e0b\u8f7d(Download was cancelled)\n\n**\/<\/code><\/pre><\/div>\n\n\n\n<p>A\u6807\u7b7e\u6267\u884cJS\u793a\u4f8b\u4ee3\u7801<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-html\" data-lang=\"HTML\"><code>&lt;a href=&quot;javascript:void(0)&quot; onclick=&quot;zhixing()&quot;&gt;\u6267\u884c&lt;\/a&gt; \n&lt;!-- \u5199\u5165\u4e00\u4e2aA\u6807\u7b7ehref\u503c\u4e3a&quot;javascript:void(0)&quot;\uff0c\u5b9a\u4e49\u70b9\u51fb\u4e8b\u4ef6onclick\uff1b--&gt;\n&lt;script src=&quot;\u60a8\u7684\u670d\u52a1\u5668URL\/jsbridge-mini.js&quot;&gt;&lt;\/script&gt;\n&lt;!-- \u5728\u60a8\u7684\u670d\u52a1\u5668\u5f15\u5165\u4e00\u95e8JS\u5730\u5740\uff0c\u8bf7\u4e0b\u8f7djsbridge-mini.js\u4e0a\u4f20\u60a8\u81ea\u5df1\u7684\u670d\u52a1\u5668\u83b7\u53d6\u94fe\u63a5\uff1b--&gt;\n&lt;script type=&quot;text\/javascript&quot;&gt;\nfunction zhixing() {\n\n\n&lt;!--\u8fd9\u91cc\u53ef\u4ee5\u76f4\u63a5\u590d\u5236JS\u6838\u5fc3\u4ee3\u7801\u5230\u6b64{}\u62ec\u53f7\u5185--&gt;\njsBridge.iap.setTransanctionListener(function(succ, transactions) {\n  if (succ) {\n    var json = JSON.stringify(transactions);\n    jsBridge.setClipboardText(json);\n    \/\/transactions.forEach(function(x){jsBridge.iap.finishTransaction({transactionId: x.transactionId});})\n    alert(json);\n  } else {\n    alert(&quot;\u64cd\u4f5c\u5931\u8d25\\n&quot; + JSON.stringify(transactions));\n  }\n});\nalert(&quot;\u5df2\u8bbe\u7f6e\u76d1\u542c\u5668&quot;);\n\n\/**\ntransactions \u8fd4\u56de\u4ea4\u6613\u4fe1\u606f\u6570\u7ec4\n[{\n  state:                 \/\/\u4ea4\u6613\u72b6\u6001\uff0c\u8be6\u89c1\u4ea4\u6613\u72b6\u6001\u5e38\u91cf\uff0c\u6570\u5b57\u7c7b\u578b    \n  transactionId:         \/\/\u4ea4\u6613id\uff0c\u5b57\u7b26\u4e32\u7c7b\u578b    \n  originalTransactionId: \/\/\u539f\u59cb\u4ea4\u6613id\uff0c\u53ea\u5728state\u4e3a\u6062\u590d\u8d2d\u4e70\u65f6\u6709\u6548\uff0c\u5b57\u7b26\u4e32\u7c7b\u578b\n  transactionDate:       \/\/\u4ea4\u6613\u65f6\u95f4\uff0cUNIX \u65f6\u95f4\u6233\uff08\u79d2\uff09\n  receipt:               \/\/\u4ea4\u6613\u51ed\u8bc1\uff0c\u7ecf\u8fc7base64\u7f16\u7801\uff0c\u7528\u4e8e\u9a8c\u8bc1\u4ea4\u6613\u662f\u5426\u5408\u6cd5\u548c\u6709\u6548\uff0c\u907f\u514d\u56e0\u8d8a\u72f1\u7834\u89e3\u5185\u8d2d\u540e\u9020\u6210\u635f\u5931\uff0c\u53ea\u5728state\u4e3a\u8d2d\u4e70\u6210\u529f\u65f6\u6709\u6548\uff0c\u5b57\u7b26\u4e32\u7c7b\u578b\n  errorCode:             \/\/\u4ea4\u6613\u5931\u8d25\u65f6\u7684\u9519\u8bef\u7801\uff0c\u6570\u5b57\u7c7b\u578b    \n  errorMsg:              \/\/\u4ea4\u6613\u5931\u8d25\u65f6\u7684\u8bf4\u660e\uff0c\u5b57\u7b26\u4e32\u7c7b\u578b    \n  payment:               \/\/\u5546\u54c1\u8d2d\u4e70\u4fe1\u606f\n  {\n    productId:           \/\/\u5546\u54c1ID\uff0c\u5b57\u7b26\u4e32\u7c7b\u578b\n    quantity:            \/\/\u8d2d\u4e70\u6570\u91cf\uff0c\u6570\u5b57\u7c7b\u578b\n    applicationUsername: \/\/\u7528\u6237\u4fe1\u606f\uff0c\u5b57\u7b26\u4e32\u7c7b\u578b\n  },\n  downloads:             \/\/\u6709\u4e0b\u8f7d\u5185\u5bb9\u65f6\u7684\u4e0b\u8f7d\u4fe1\u606f\u5217\u8868\n  [{    \n    state:               \/\/\u4e0b\u8f7d\u72b6\u6001\uff0c\u8be6\u89c1\u4e0b\u8f7d\u72b6\u6001\u5e38\u91cf\uff0c\u6570\u5b57\u7c7b\u578b\n    transactionId:       \/\/\u4e0b\u8f7d\u5185\u5bb9\u6240\u5c5e\u4ea4\u6613id\uff0c\u5b57\u7b26\u4e32\u7c7b\u578b\n    contentId:           \/\/\u4e0b\u8f7d\u5185\u5bb9id\uff0c\u5b57\u7b26\u4e32\u7c7b\u578b\n    progress:            \/\/\u4e0b\u8f7d\u8fdb\u5ea6\uff0c\u53d6\u503c\u8303\u56f40~1\uff0c\u6570\u5b57\u7c7b\u578b\n    contentLength:       \/\/\u6587\u4ef6\u5185\u5bb9\u5927\u5c0f\uff0c\u6570\u5b57\u7c7b\u578b\n    timeRemaining:       \/\/\u4e0b\u8f7d\u5269\u4f59\u65f6\u95f4\uff0c-1\u65f6\u8868\u793a\u672a\u77e5\uff0c\u6570\u5b57\u7c7b\u578b\n    contentVersion:      \/\/\u4e0b\u8f7d\u5185\u5bb9\u7684\u7248\u672c\uff0c\u5b57\u7b26\u4e32\u7c7b\u578b\n    contentURL:          \/\/\u4e0b\u8f7d\u6210\u529f\u540e\u6587\u4ef6\u8def\u5f84\uff0c\u5b57\u7b26\u4e32\u7c7b\u578b\n    errorCode:           \/\/\u4e0b\u8f7d\u5931\u8d25\u65f6\u7684\u9519\u8bef\u7801\uff0c\u6570\u5b57\u7c7b\u578b\n    errorMsg:            \/\/\u4e0b\u8f7d\u5931\u8d25\u65f6\u7684\u9519\u8bef\u63cf\u8ff0\uff0c\u5b57\u7b26\u4e32\u7c7b\u578b\n  }]\n}]\n\nstate(transaction) \u4ea4\u6613\u72b6\u6001\u5e38\u91cf\u8bf4\u660e\n0: \u5df2\u52a0\u5165\u4ea4\u6613\u961f\u5217(Transaction is being added to the server queue.)\n1: \u4ea4\u6613\u5b8c\u6210(Transaction is in queue, user has been charged.  Client should complete the transaction.)\n2: \u4ea4\u6613\u5931\u8d25(Transaction was cancelled or failed before being added to the server queue.)\n3: \u6062\u590d\u8d2d\u4e70(Transaction was restored from user&#39;s purchase history.  Client should complete the transaction.)\n4: \u4ea4\u6613\u7b49\u5f85\u88ab\u786e\u8ba4(The transaction is in the queue, but its final status is pending external action.)\n    \nstate(download) \u4e0b\u8f7d\u72b6\u6001\u5e38\u91cf\u8bf4\u660e\n0: \u7b49\u5f85\u4e0b\u8f7d(Download is inactive, waiting to be downloaded)\n1: \u6b63\u5728\u4e0b\u8f7d(Download is actively downloading)\n2: \u6682\u505c\u4e0b\u8f7d(Download was paused by the user)\n3: \u4e0b\u8f7d\u5b8c\u6210(Download is finished, content is available)\n4: \u4e0b\u8f7d\u5931\u8d25(Download failed)\n5: \u53d6\u6d88\u4e0b\u8f7d(Download was cancelled)\n\n**\/\n\n}\n&lt;\/script&gt;\n&lt;!--\u6267\u884c\u6838\u5fc3\u4ee3\u7801\uff1b\n\/\/\u5982\u679c\u9700\u8981\u8fdb\u5165\u9875\u9762\u5c31\u6267\u884c\uff0c\u53bb\u6389\u70b9\u51fb\u4e8b\u4ef6\u5373\u53ef\uff1b--&gt;<\/code><\/pre><\/div>\n\n\n\n<p>\u6309\u94ae\u6267\u884cJS\u793a\u4f8b\u4ee3\u7801<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-html\" data-lang=\"HTML\"><code>&lt;button onclick=&quot;zhixing()&quot; &gt;\u6267\u884c&lt;\/button&gt;\n&lt;!-- \/\/\u5199\u4e00\u4e2a\u6309\u94ae\uff0c\u5b9a\u4e49\u70b9\u51fb\u6267\u884c\u4e8b\u4ef6\uff1b --&gt;\n&lt;script src=&quot;\u60a8\u7684\u670d\u52a1\u5668URL\/jsbridge-mini.js&quot;&gt;&lt;\/script&gt;\n&lt;!-- \/\/\u5728\u60a8\u7684\u670d\u52a1\u5668\u5f15\u5165\u4e00\u95e8JS\u5730\u5740\uff0c\u8bf7\u4e0b\u8f7djsbridge-mini.js\u4e0a\u4f20\u60a8\u81ea\u5df1\u7684\u670d\u52a1\u5668\u83b7\u53d6\u94fe\u63a5\uff1b --&gt;\n&lt;script type=&quot;text\/javascript&quot;&gt;\nfunction zhixing() {\n\n\n&lt;!--\u8fd9\u91cc\u53ef\u4ee5\u76f4\u63a5\u590d\u5236JS\u6838\u5fc3\u4ee3\u7801\u5230\u6b64{}\u62ec\u53f7\u5185--&gt;\njsBridge.iap.setTransanctionListener(function(succ, transactions) {\n  if (succ) {\n    var json = JSON.stringify(transactions);\n    jsBridge.setClipboardText(json);\n    \/\/transactions.forEach(function(x){jsBridge.iap.finishTransaction({transactionId: x.transactionId});})\n    alert(json);\n  } else {\n    alert(&quot;\u64cd\u4f5c\u5931\u8d25\\n&quot; + JSON.stringify(transactions));\n  }\n});\nalert(&quot;\u5df2\u8bbe\u7f6e\u76d1\u542c\u5668&quot;);\n\n\/**\ntransactions \u8fd4\u56de\u4ea4\u6613\u4fe1\u606f\u6570\u7ec4\n[{\n  state:                 \/\/\u4ea4\u6613\u72b6\u6001\uff0c\u8be6\u89c1\u4ea4\u6613\u72b6\u6001\u5e38\u91cf\uff0c\u6570\u5b57\u7c7b\u578b    \n  transactionId:         \/\/\u4ea4\u6613id\uff0c\u5b57\u7b26\u4e32\u7c7b\u578b    \n  originalTransactionId: \/\/\u539f\u59cb\u4ea4\u6613id\uff0c\u53ea\u5728state\u4e3a\u6062\u590d\u8d2d\u4e70\u65f6\u6709\u6548\uff0c\u5b57\u7b26\u4e32\u7c7b\u578b\n  transactionDate:       \/\/\u4ea4\u6613\u65f6\u95f4\uff0cUNIX \u65f6\u95f4\u6233\uff08\u79d2\uff09\n  receipt:               \/\/\u4ea4\u6613\u51ed\u8bc1\uff0c\u7ecf\u8fc7base64\u7f16\u7801\uff0c\u7528\u4e8e\u9a8c\u8bc1\u4ea4\u6613\u662f\u5426\u5408\u6cd5\u548c\u6709\u6548\uff0c\u907f\u514d\u56e0\u8d8a\u72f1\u7834\u89e3\u5185\u8d2d\u540e\u9020\u6210\u635f\u5931\uff0c\u53ea\u5728state\u4e3a\u8d2d\u4e70\u6210\u529f\u65f6\u6709\u6548\uff0c\u5b57\u7b26\u4e32\u7c7b\u578b\n  errorCode:             \/\/\u4ea4\u6613\u5931\u8d25\u65f6\u7684\u9519\u8bef\u7801\uff0c\u6570\u5b57\u7c7b\u578b    \n  errorMsg:              \/\/\u4ea4\u6613\u5931\u8d25\u65f6\u7684\u8bf4\u660e\uff0c\u5b57\u7b26\u4e32\u7c7b\u578b    \n  payment:               \/\/\u5546\u54c1\u8d2d\u4e70\u4fe1\u606f\n  {\n    productId:           \/\/\u5546\u54c1ID\uff0c\u5b57\u7b26\u4e32\u7c7b\u578b\n    quantity:            \/\/\u8d2d\u4e70\u6570\u91cf\uff0c\u6570\u5b57\u7c7b\u578b\n    applicationUsername: \/\/\u7528\u6237\u4fe1\u606f\uff0c\u5b57\u7b26\u4e32\u7c7b\u578b\n  },\n  downloads:             \/\/\u6709\u4e0b\u8f7d\u5185\u5bb9\u65f6\u7684\u4e0b\u8f7d\u4fe1\u606f\u5217\u8868\n  [{    \n    state:               \/\/\u4e0b\u8f7d\u72b6\u6001\uff0c\u8be6\u89c1\u4e0b\u8f7d\u72b6\u6001\u5e38\u91cf\uff0c\u6570\u5b57\u7c7b\u578b\n    transactionId:       \/\/\u4e0b\u8f7d\u5185\u5bb9\u6240\u5c5e\u4ea4\u6613id\uff0c\u5b57\u7b26\u4e32\u7c7b\u578b\n    contentId:           \/\/\u4e0b\u8f7d\u5185\u5bb9id\uff0c\u5b57\u7b26\u4e32\u7c7b\u578b\n    progress:            \/\/\u4e0b\u8f7d\u8fdb\u5ea6\uff0c\u53d6\u503c\u8303\u56f40~1\uff0c\u6570\u5b57\u7c7b\u578b\n    contentLength:       \/\/\u6587\u4ef6\u5185\u5bb9\u5927\u5c0f\uff0c\u6570\u5b57\u7c7b\u578b\n    timeRemaining:       \/\/\u4e0b\u8f7d\u5269\u4f59\u65f6\u95f4\uff0c-1\u65f6\u8868\u793a\u672a\u77e5\uff0c\u6570\u5b57\u7c7b\u578b\n    contentVersion:      \/\/\u4e0b\u8f7d\u5185\u5bb9\u7684\u7248\u672c\uff0c\u5b57\u7b26\u4e32\u7c7b\u578b\n    contentURL:          \/\/\u4e0b\u8f7d\u6210\u529f\u540e\u6587\u4ef6\u8def\u5f84\uff0c\u5b57\u7b26\u4e32\u7c7b\u578b\n    errorCode:           \/\/\u4e0b\u8f7d\u5931\u8d25\u65f6\u7684\u9519\u8bef\u7801\uff0c\u6570\u5b57\u7c7b\u578b\n    errorMsg:            \/\/\u4e0b\u8f7d\u5931\u8d25\u65f6\u7684\u9519\u8bef\u63cf\u8ff0\uff0c\u5b57\u7b26\u4e32\u7c7b\u578b\n  }]\n}]\n\nstate(transaction) \u4ea4\u6613\u72b6\u6001\u5e38\u91cf\u8bf4\u660e\n0: \u5df2\u52a0\u5165\u4ea4\u6613\u961f\u5217(Transaction is being added to the server queue.)\n1: \u4ea4\u6613\u5b8c\u6210(Transaction is in queue, user has been charged.  Client should complete the transaction.)\n2: \u4ea4\u6613\u5931\u8d25(Transaction was cancelled or failed before being added to the server queue.)\n3: \u6062\u590d\u8d2d\u4e70(Transaction was restored from user&#39;s purchase history.  Client should complete the transaction.)\n4: \u4ea4\u6613\u7b49\u5f85\u88ab\u786e\u8ba4(The transaction is in the queue, but its final status is pending external action.)\n    \nstate(download) \u4e0b\u8f7d\u72b6\u6001\u5e38\u91cf\u8bf4\u660e\n0: \u7b49\u5f85\u4e0b\u8f7d(Download is inactive, waiting to be downloaded)\n1: \u6b63\u5728\u4e0b\u8f7d(Download is actively downloading)\n2: \u6682\u505c\u4e0b\u8f7d(Download was paused by the user)\n3: \u4e0b\u8f7d\u5b8c\u6210(Download is finished, content is available)\n4: \u4e0b\u8f7d\u5931\u8d25(Download failed)\n5: \u53d6\u6d88\u4e0b\u8f7d(Download was cancelled)\n\n**\/\n\n}\n&lt;\/script&gt;\n&lt;!-- \/\/\u6267\u884c\u6838\u5fc3\u4ee3\u7801\uff1b\n\/\/\u5982\u679c\u9700\u8981\u8fdb\u5165\u9875\u9762\u5c31\u6267\u884c\uff0c\u53bb\u6389\u70b9\u51fb\u4e8b\u4ef6\u5373\u53ef\uff1b --&gt;<\/code><\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>setTransanctionListener\u00a0\u8bbe\u7f6e\u4ea4\u6613\u76d1\u542c\u5668 APP\u5f00\u53d1\u63a5\u5165\u82f9\u679c\u5185\u8d2dIOS\u5185\u8d2d\u5f00\u53d1\u6559\u7a0b<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[650,16],"tags":[472,6985,4178,482,6984,322,2282],"special":[399],"attr":[],"class_list":{"0":"post-14616","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"hentry","6":"category-app30","7":"category-iosinfo","8":"tag-apple","10":"tag-app","11":"tag-iosneigou","12":"tag-ios","13":"tag-ioskaifa","14":"tag-2282","15":"special-appkfgj","16":"entry"},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/posts\/14616","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/comments?post=14616"}],"version-history":[{"count":1,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/posts\/14616\/revisions"}],"predecessor-version":[{"id":14617,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/posts\/14616\/revisions\/14617"}],"wp:attachment":[{"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/media?parent=14616"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/categories?post=14616"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/tags?post=14616"},{"taxonomy":"special","embeddable":true,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/special?post=14616"},{"taxonomy":"attr","embeddable":true,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/attr?post=14616"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}