{"id":2275,"date":"2017-06-01T18:02:16","date_gmt":"2017-06-01T10:02:16","guid":{"rendered":"http:\/\/blog.hoyo.idv.tw\/?p=2275"},"modified":"2018-07-24T10:16:25","modified_gmt":"2018-07-24T02:16:25","slug":"%e4%b8%b2%e6%8e%a5-paypal","status":"publish","type":"post","link":"https:\/\/blog.hoyo.idv.tw\/?p=2275","title":{"rendered":"\u4e32\u63a5 PayPal"},"content":{"rendered":"<p>\u6d41\u7a0b<\/p>\n<ol>\n<li>\u7533\u8acb\u5e33\u865f<\/li>\n<li>\u5230 <a href=\"https:\/\/developer.paypal.com\/developer\/\" target=\"_blank\">PayPal Developer<\/a> \u958b\u901a\u958b\u767c\u5e33\u865f<\/li>\n<li>\u6c99\u76d2\u6e2c\u8a66\u7db2\u5740\u52a0\u4e0a <strong>sandbox<\/strong> \u5373\u53ef<br \/>\nhttps:\/\/www.sandbox.paypal.com<br \/>\nhttps:\/\/ipnpb.sandbox.paypal.com<\/li>\n<li><a href=\"https:\/\/www.paypal.com\/tw\/cgi-bin\/webscr?cmd=p\/pdn\/article_pdn_intro-outside\" target=\"_blank\">\u91dd\u5c0d\u958b\u767c\u4eba\u54e1\u7684 PayPal \u548c IPN\uff08\u4ea4\u6613\u72c0\u614b\u66f4\u65b0\uff09\u4ecb\u7d39<br \/>\n<\/a><\/li>\n<\/ol>\n<p>--<\/p>\n<h2>\u958b\u555f IPN (\u4ea4\u6613\u72c0\u614b\u66f4\u65b0\u3001\u5373\u6642\u4ed8\u6b3e\u901a\u77e5)<\/h2>\n<p>\u500b\u4eba\u6a94\u6848 \u2192 \u6211\u7684\u92b7\u552e\u5de5\u5177 \u2192\u00a0\u4ea4\u6613\u72c0\u614b\u66f4\u65b0<\/p>\n<p><a href=\"http:\/\/blog.hoyo.idv.tw\/wp-content\/uploads\/2016\/01\/Image-236.png\" target=\"_blank\" data-rel=\"lightbox-image-0\" data-rl_title=\"\" data-rl_caption=\"\" title=\"\"><img loading=\"lazy\" class=\"alignnone size-medium wp-image-2762\" src=\"http:\/\/blog.hoyo.idv.tw\/wp-content\/uploads\/2016\/01\/Image-236-300x197.png\" alt=\"Image 236\" width=\"300\" height=\"197\" srcset=\"https:\/\/blog.hoyo.idv.tw\/wp-content\/uploads\/2016\/01\/Image-236-300x197.png 300w, https:\/\/blog.hoyo.idv.tw\/wp-content\/uploads\/2016\/01\/Image-236-457x300.png 457w, https:\/\/blog.hoyo.idv.tw\/wp-content\/uploads\/2016\/01\/Image-236.png 783w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>--<\/p>\n<h2>\u81ea\u8a02\u4ed8\u6b3e<\/h2>\n<ul>\n<li><a href=\"https:\/\/www.paypal.com\/tw\/cgi-bin\/webscr?cmd=p\/pdn\/article_pdn_intro-outside\" target=\"_blank\">\u91dd\u5c0d\u958b\u767c\u4eba\u54e1\u7684 PayPal \u548c IPN\uff08\u4ea4\u6613\u72c0\u614b\u66f4\u65b0\uff09\u4ecb\u7d39<\/a>\u00a0\u5167\u6709\u81ea\u8a02\u4ed8\u8cbb\u8868\u55ae\u7bc4\u4f8b<\/li>\n<li><a href=\"https:\/\/developer.paypal.com\/docs\/classic\/paypal-payments-standard\/integration-guide\/formbasics\/\" target=\"_blank\">HTML Form Basics for PayPal Payments Standard<\/a><\/li>\n<li><\/li>\n<\/ul>\n<pre class=\"lang:default decode:true\">&lt;form action=\"https:\/\/www.paypal.com\/cgi-bin\/webscr\" method=\"post\"&gt;\r\n    &lt;input type=\"hidden\" name=\"cmd\" value=\"_xclick\"&gt;\r\n    &lt;input type=\"hidden\" name=\"business\" value=\"alanb@alanb.com\"&gt;\r\n    &lt;input type=\"hidden\" name=\"item_name\" value=\"doodad from alanb.com\"&gt;\r\n    &lt;input type=\"hidden\" name=\"amount\" value=\"4.99\"&gt;\r\n    &lt;input type=\"hidden\" name=\"return\" value=\"http:\/\/alanb.com\/doodads\/thanks.html\"&gt;\r\n    &lt;input type=\"hidden\" name=\"cancel_return\" value=\"http:\/\/alanb.com\/doodads\/canceled.html\"&gt;\r\n    &lt;input type=\"image\" border=\"0\" name=\"submit\" src=\"http:\/\/images.paypal.com\/images\/x-click-but5.gif\" alt=\"\u8acb\u4f7f\u7528 PayPal \u4ed8\u6b3e \uff0d \u5feb\u6377\u3001\u514d\u8cbb\u548c\u5b89\u5168\u7684\u4ed8\u6b3e\u65b9\u5f0f\uff01\"&gt;\r\n&lt;\/form&gt;<\/pre>\n<p>&nbsp;<\/p>\n<ul>\n<li>business :<\/li>\n<li>amount :<\/li>\n<li>return :<\/li>\n<li>cancel_return :<\/li>\n<\/ul>\n<p><strong>\u4e00\u500b\u5be6\u969b\u6848\u4f8b<\/strong><\/p>\n<pre class=\"lang:php decode:true\">$Form = '\r\n&lt;!DOCTYPE html&gt;\r\n&lt;html&gt;\r\n&lt;head&gt;\r\n    &lt;meta charset=\"utf-8\"&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n    &lt;form id=\"idForm\" action=\"https:\/\/www.sandbox.paypal.com\/cgi-bin\/webscr\" method=\"post\" target=\"_self\"&gt;\r\n        &lt;input type=\"hidden\" name=\"cmd\" value=\"_xclick\"&gt;\r\n        &lt;input type=\"hidden\" name=\"business\" value=\"pc-facilitator@hoyo.idv.tw\"&gt;\r\n        &lt;INPUT TYPE=\"hidden\" name=\"charset\" value=\"utf-8\"&gt;\r\n        &lt;INPUT TYPE=\"hidden\" name=\"lc\" value=\"zh_TW\"&gt;\r\n        &lt;INPUT TYPE=\"hidden\" NAME=\"currency_code\" value=\"TWD\"&gt;\r\n        &lt;input type=\"hidden\" name=\"custom\" value=\"'. $Orders_id .':'. $token .'\"&gt;\r\n        &lt;input type=\"hidden\" name=\"item_name\" value=\"'. $ProductName .'\"&gt;\r\n        \r\n        &lt;input type=\"hidden\" name=\"amount\" value=\"'. $price .'\"&gt;\r\n        &lt;input type=\"hidden\" name=\"notify_url\" value=\"'. PapPal_NotifyURL .'\"&gt;\r\n        &lt;input type=\"hidden\" name=\"return\" value=\"'. PapPal_ReturnURL .'\"&gt;\r\n        &lt;input type=\"hidden\" name=\"cancel_return\" value=\"'. PayPal_CancelReturnURL .'\"&gt;\r\n    &lt;\/form&gt;\r\n    &lt;script type=\"text\/javascript\"&gt;document.getElementById(\"idForm\").submit();&lt;\/script&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n';\r\n\r\necho $Form;<\/pre>\n<ul>\n<li>notify_url: \u8a2d\u5b9a IPN \u8fd4\u56de\u7db2\u5740<\/li>\n<li>return: \u6210\u529f\u4ed8\u6b3e\u8fd4\u56de\u7db2\u5740<\/li>\n<li>cancel_return: \u53d6\u6d88\u4ea4\u6613\u8fd4\u56de\u7db2\u5740<\/li>\n<\/ul>\n<p>--<\/p>\n<h2>IPN<\/h2>\n<ul>\n<li><a href=\"https:\/\/developer.paypal.com\/docs\/classic\/ipn\/integration-guide\/IPNIntro\/\" target=\"_blank\">Introducing IPN<\/a><\/li>\n<li><\/li>\n<\/ul>\n<p>\u5c07\u63a5\u6536\u7684 IPN $_POST \u8f49\u6210\u9663\u5217<\/p>\n<pre class=\"lang:default decode:true\">Array\r\n(\r\n    [mc_gross] =&gt; 1000\r\n    [protection_eligibility] =&gt; Ineligible\r\n    [address_status] =&gt; confirmed\r\n    [payer_id] =&gt; 8G7HV3SJCPXAQ\r\n    [address_street] =&gt; 71566176 Sky E137 S\r\n    [payment_date] =&gt; 22:00:29 May 31, 2017 PDT\r\n    [payment_status] =&gt; Pending\r\n    [charset] =&gt; windows-1252\r\n    [address_zip] =&gt; W185744\r\n    [first_name] =&gt; \u001a\u001a\r\n    [address_country_code] =&gt; HK\r\n    [address_name] =&gt; \u001a \u001a\u001a\r\n    [notify_version] =&gt; 3.8\r\n    [custom] =&gt; :\r\n    [payer_status] =&gt; verified\r\n    [business] =&gt; pc-facilitator@hoyo.idv.tw\r\n    [address_country] =&gt; Hong Kong\r\n    [address_city] =&gt; Posta\r\n    [quantity] =&gt; 1\r\n    [verify_sign] =&gt; AOH.JxXLRThnyE4tyiz8f.cTKbR2AH5k6c0WNm5135Ot-LokNPpc1yzK\r\n    [payer_email] =&gt; pc@hoyo.idv.tw\r\n    [txn_id] =&gt; 2FA122351Y010023B\r\n    [payment_type] =&gt; instant\r\n    [last_name] =&gt; \u001a\r\n    [address_state] =&gt; Libisia\r\n    [receiver_email] =&gt; pc-facilitator@hoyo.idv.tw\r\n    [receiver_id] =&gt; WJVDVGB4S5DES\r\n    [pending_reason] =&gt; multi_currency\r\n    [txn_type] =&gt; web_accept\r\n    [item_name] =&gt; \u001a\u001a 1250 \u001a\r\n    [mc_currency] =&gt; TWD\r\n    [item_number] =&gt; \r\n    [residence_country] =&gt; HK\r\n    [test_ipn] =&gt; 1\r\n    [transaction_subject] =&gt; \r\n    [payment_gross] =&gt; \r\n    [ipn_track_id] =&gt; a72c1c50acff4\r\n)<\/pre>\n<p>--<\/p>\n<h2>\u9a57\u8b49 IPN \u662f\u5426\u5c6c\u5be6<\/h2>\n<ul>\n<li>https:\/\/ipnpb.paypal.com\/cgi-bin\/webscr?cmd=_notify-validate&amp;<\/li>\n<\/ul>\n<p>VERIFIED \u6709\u6548\uff0cINVALID \u7121\u6548<\/p>\n<p>--<\/p>\n<h2>REST API<\/h2>\n<ul>\n<li data-wpview-marker=\"https%3A%2F%2Fdeveloper.paypal.com%2Fdocs%2Fapi%2F\"><a href=\"https:\/\/developer.paypal.com\/docs\/api\/\" target=\"_blank\">REST API Reference<\/a><\/li>\n<\/ul>\n<p>--<\/p>\n<h2>\u8f14\u52a9\u8cc7\u6e90<\/h2>\n<ul>\n<li><a href=\"https:\/\/www.paypal.com\/us\/webapps\/mpp\/logo-center\" target=\"_blank\">PayPal Verified Logos, Icons, Images - PayPal Logo Center<\/a>\u00a0PayPal Logo<\/li>\n<li><\/li>\n<\/ul>\n<p>--<\/p>\n<div class=\"pvc_clear\"><\/div>\n<p class=\"pvc_stats all \" data-element-id=\"2275\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> &nbsp;5,133&nbsp;total views<\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u6d41\u7a0b \u7533\u8acb\u5e33\u865f \u5230 PayPa...<\/p>\n<div class=\"pvc_clear\"><\/div>\n<p class=\"pvc_stats all \" data-element-id=\"2275\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> &nbsp;5,133&nbsp;total views<\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[287],"tags":[181,53],"_links":{"self":[{"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=\/wp\/v2\/posts\/2275"}],"collection":[{"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2275"}],"version-history":[{"count":17,"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=\/wp\/v2\/posts\/2275\/revisions"}],"predecessor-version":[{"id":3788,"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=\/wp\/v2\/posts\/2275\/revisions\/3788"}],"wp:attachment":[{"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2275"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2275"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2275"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}