{"id":31925,"date":"2023-10-31T11:51:07","date_gmt":"2023-04-17T17:57:59","guid":{"rendered":"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8node-js%e8%b0%83%e7%94%a8yahoo%e9%92%b1%e5%8c%85fastpay-api%e3%80%82\/"},"modified":"2024-05-04T06:51:55","modified_gmt":"2024-05-03T22:51:55","slug":"%e4%bd%bf%e7%94%a8node-js%e8%b0%83%e7%94%a8yahoo%e9%92%b1%e5%8c%85fastpay-api%e3%80%82","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8node-js%e8%b0%83%e7%94%a8yahoo%e9%92%b1%e5%8c%85fastpay-api%e3%80%82\/","title":{"rendered":"\u4f7f\u7528Node.js\u8c03\u7528Yahoo\u94b1\u5305Fastpay API"},"content":{"rendered":"<h1>\u7b80\u8ff0<\/h1>\n<p>\u4f7f\u7528\u4ee4\u724c\u8fdb\u884c\u5145\u503c\uff0c\u4f46\u6ca1\u6709\u4e3aNode.js\u63d0\u4f9bAPI\u5e93\u3002<br \/>\n\u53ea\u6709FastPay API\u5e93\u9002\u7528\u4e8ePHP\u3001Ruby\u548cPython\uff08\u622a\u81f32016\u5e742\u6708\uff09\u3002<\/p>\n<p>\u56e0\u6b64\uff0c\u6211\u53c2\u8003\u4e86cURL\u7684\u53c2\u6570\uff0c\u5728nodejs\u4e2d\u521b\u5efa\u4e86\u4eceAPI\u8c03\u7528\u7684\u5b9e\u73b0\u3002<\/p>\n<h1>\u51c6\u5907<\/h1>\n<h2>\u8868\u8fbe<\/h2>\n<ul class=\"post-ul\">\u4eca\u56de\u306fexpressjs\u3092\u4f7f\u3044\u307e\u3059\u3002express-generator\u3067\u30c6\u30f3\u30d7\u30ec\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/ul>\n<pre class=\"post-pre\"><code>npm install express-generator -g\r\n<\/code><\/pre>\n<h2>\u8bf7\u6c42<\/h2>\n<ul class=\"post-ul\">API\u3078POST\u3059\u308b\u306e\u306b\u3001request\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u4f7f\u3044\u307e\u3059\u3002<\/ul>\n<pre class=\"post-pre\"><code>npm install request \r\n<\/code><\/pre>\n<h1>\u5b9e\u65bd<\/h1>\n<p>FastPay.js\u7684\u64cd\u4f5c\uff1a\u662f\u5173\u4e8e\u76ee\u6807\u72b6\u6001\u7684\u5b9e\u73b0\uff08\u90e8\u5206\uff09\u3002\u5047\u8bbe\u8c03\u7528\u4e86router.post\u3002<\/p>\n<pre class=\"post-pre\"><code>router.post('fastpay_complete', function (req, res, next) {\r\n    var fastpayToken = req.body.fastpayToken;   \/\/ req.body\u3067\u6e21\u3055\u308c\u3066\u304d\u307e\u3059\r\n    var amount = req.body.amount;  \/\/  req.body.amount;\r\n    var yUser = 'yahooFastpay.secret';  \/\/ fastpay secret key\u3067\u3059\u3002\r\n    var fastpayApiUrl = 'https:\/\/fastpay.yahooapis.jp\/v1\/charges';\r\n    var fastpayApiProxy = '';  \/\/ \u30d7\u30ed\u30ad\u30b7\u304c\u3042\u308b\u5834\u5408\u306f\u8a2d\u5b9a\u3057\u307e\u3059\r\n\r\n    request({\r\n        method: 'POST',\r\n        proxy: fastpayApiProxy,\r\n        url: fastpayApiUrl,\r\n        auth: {\r\n            user: yUser,\r\n            pass: ''\r\n        },\r\n        form: {\r\n            amount: amount,\r\n            card: fastpayToken,\r\n            capture: false\r\n        },\r\n        json: true\r\n    }, function (error, response) {\r\n        if ( error ) {\r\n            console.log(error);\r\n        }\r\n        else {\r\n            if( resonse.body.error ){   \/\/ fastpay API\u304b\u3089\u306e\u30a8\u30e9\u30fc\u306e\u5834\u5408\r\n                \/\/HTTP\u30b9\u30c6\u30fc\u30bf\u30b9\u30b3\u30fc\u30c9\u3001Types\u3001Code\u306a\u3069\u3092\u898b\u3066\u51e6\u7406     \r\n            }\r\n            else{\r\n                \/\/ \u6b63\u5e38\u7cfb\u51e6\u7406\r\n            }\r\n        }\r\n    });\r\n\r\n});\r\n\r\n<\/code><\/pre>\n<h1>\u603b\u7ed3<\/h1>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u4e0a\u8a18\u306e\u3088\u3046\u306a\u5b9f\u88c5\u3067\u3001NodeJs(Express)\u3067\u4f7f\u3048\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\u9593\u9055\u3044\u306a\u3069\u3042\u308a\u307e\u3057\u305f\u3089\u3054\u6307\u6458\u304f\u3060\u3055\u3044\u3002<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u7b80\u8ff0 \u4f7f\u7528\u4ee4\u724c\u8fdb\u884c\u5145\u503c\uff0c\u4f46\u6ca1\u6709\u4e3aNode.js\u63d0\u4f9bAPI\u5e93\u3002 \u53ea\u6709FastPay API\u5e93\u9002\u7528\u4e8ePHP\u3001Rub [&hellip;]<\/p>\n","protected":false},"author":11,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-31925","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.5 (Yoast SEO v21.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u4f7f\u7528Node.js\u8c03\u7528Yahoo\u94b1\u5305Fastpay API - Blog - Silicon Cloud<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.silicloud.com\/zh\/blog\/\u4f7f\u7528node-js\u8c03\u7528yahoo\u94b1\u5305fastpay-api\u3002\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u4f7f\u7528Node.js\u8c03\u7528Yahoo\u94b1\u5305Fastpay API\" \/>\n<meta property=\"og:description\" content=\"\u7b80\u8ff0 \u4f7f\u7528\u4ee4\u724c\u8fdb\u884c\u5145\u503c\uff0c\u4f46\u6ca1\u6709\u4e3aNode.js\u63d0\u4f9bAPI\u5e93\u3002 \u53ea\u6709FastPay API\u5e93\u9002\u7528\u4e8ePHP\u3001Rub [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/zh\/blog\/\u4f7f\u7528node-js\u8c03\u7528yahoo\u94b1\u5305fastpay-api\u3002\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2023-04-17T17:57:59+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-05-03T22:51:55+00:00\" \/>\n<meta name=\"author\" content=\"\u65b0, \u97f5\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u65b0, \u97f5\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8node-js%e8%b0%83%e7%94%a8yahoo%e9%92%b1%e5%8c%85fastpay-api%e3%80%82\/\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8node-js%e8%b0%83%e7%94%a8yahoo%e9%92%b1%e5%8c%85fastpay-api%e3%80%82\/\",\"name\":\"\u4f7f\u7528Node.js\u8c03\u7528Yahoo\u94b1\u5305Fastpay API - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\"},\"datePublished\":\"2023-04-17T17:57:59+00:00\",\"dateModified\":\"2024-05-03T22:51:55+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/4ba4019495123db3038fd0809e6959c9\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8node-js%e8%b0%83%e7%94%a8yahoo%e9%92%b1%e5%8c%85fastpay-api%e3%80%82\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8node-js%e8%b0%83%e7%94%a8yahoo%e9%92%b1%e5%8c%85fastpay-api%e3%80%82\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8node-js%e8%b0%83%e7%94%a8yahoo%e9%92%b1%e5%8c%85fastpay-api%e3%80%82\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.silicloud.com\/zh\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u4f7f\u7528Node.js\u8c03\u7528Yahoo\u94b1\u5305Fastpay API\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/\",\"name\":\"Blog - Silicon Cloud\",\"description\":\"\",\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/4ba4019495123db3038fd0809e6959c9\",\"name\":\"\u65b0, \u97f5\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/d484b6c6e4ae82e8a9efea989e1d2af46d9b6ef128101e63b18f559fca0ae627?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/d484b6c6e4ae82e8a9efea989e1d2af46d9b6ef128101e63b18f559fca0ae627?s=96&d=mm&r=g\",\"caption\":\"\u65b0, \u97f5\"},\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/author\/yunxin\/\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8node-js%e8%b0%83%e7%94%a8yahoo%e9%92%b1%e5%8c%85fastpay-api%e3%80%82\/#local-main-organization-logo\",\"url\":\"\",\"contentUrl\":\"\",\"caption\":\"Blog - Silicon Cloud\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"\u4f7f\u7528Node.js\u8c03\u7528Yahoo\u94b1\u5305Fastpay API - Blog - Silicon Cloud","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.silicloud.com\/zh\/blog\/\u4f7f\u7528node-js\u8c03\u7528yahoo\u94b1\u5305fastpay-api\u3002\/","og_locale":"zh_CN","og_type":"article","og_title":"\u4f7f\u7528Node.js\u8c03\u7528Yahoo\u94b1\u5305Fastpay API","og_description":"\u7b80\u8ff0 \u4f7f\u7528\u4ee4\u724c\u8fdb\u884c\u5145\u503c\uff0c\u4f46\u6ca1\u6709\u4e3aNode.js\u63d0\u4f9bAPI\u5e93\u3002 \u53ea\u6709FastPay API\u5e93\u9002\u7528\u4e8ePHP\u3001Rub [&hellip;]","og_url":"https:\/\/www.silicloud.com\/zh\/blog\/\u4f7f\u7528node-js\u8c03\u7528yahoo\u94b1\u5305fastpay-api\u3002\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2023-04-17T17:57:59+00:00","article_modified_time":"2024-05-03T22:51:55+00:00","author":"\u65b0, \u97f5","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"\u65b0, \u97f5","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"1 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8node-js%e8%b0%83%e7%94%a8yahoo%e9%92%b1%e5%8c%85fastpay-api%e3%80%82\/","url":"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8node-js%e8%b0%83%e7%94%a8yahoo%e9%92%b1%e5%8c%85fastpay-api%e3%80%82\/","name":"\u4f7f\u7528Node.js\u8c03\u7528Yahoo\u94b1\u5305Fastpay API - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website"},"datePublished":"2023-04-17T17:57:59+00:00","dateModified":"2024-05-03T22:51:55+00:00","author":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/4ba4019495123db3038fd0809e6959c9"},"breadcrumb":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8node-js%e8%b0%83%e7%94%a8yahoo%e9%92%b1%e5%8c%85fastpay-api%e3%80%82\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8node-js%e8%b0%83%e7%94%a8yahoo%e9%92%b1%e5%8c%85fastpay-api%e3%80%82\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8node-js%e8%b0%83%e7%94%a8yahoo%e9%92%b1%e5%8c%85fastpay-api%e3%80%82\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.silicloud.com\/zh\/blog\/"},{"@type":"ListItem","position":2,"name":"\u4f7f\u7528Node.js\u8c03\u7528Yahoo\u94b1\u5305Fastpay API"}]},{"@type":"WebSite","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website","url":"https:\/\/www.silicloud.com\/zh\/blog\/","name":"Blog - Silicon Cloud","description":"","inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/4ba4019495123db3038fd0809e6959c9","name":"\u65b0, \u97f5","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/d484b6c6e4ae82e8a9efea989e1d2af46d9b6ef128101e63b18f559fca0ae627?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d484b6c6e4ae82e8a9efea989e1d2af46d9b6ef128101e63b18f559fca0ae627?s=96&d=mm&r=g","caption":"\u65b0, \u97f5"},"url":"https:\/\/www.silicloud.com\/zh\/blog\/author\/yunxin\/"},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8node-js%e8%b0%83%e7%94%a8yahoo%e9%92%b1%e5%8c%85fastpay-api%e3%80%82\/#local-main-organization-logo","url":"","contentUrl":"","caption":"Blog - Silicon Cloud"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/31925","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/users\/11"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/comments?post=31925"}],"version-history":[{"count":2,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/31925\/revisions"}],"predecessor-version":[{"id":96785,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/31925\/revisions\/96785"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/media?parent=31925"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/categories?post=31925"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/tags?post=31925"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}