{"id":64595,"date":"2026-01-17T09:00:00","date_gmt":"2026-01-22T02:00:00","guid":{"rendered":"https:\/\/jaybranding.com\/?p=64595"},"modified":"2026-01-15T12:37:41","modified_gmt":"2026-01-15T05:37:41","slug":"tich-hop-shopeepay-api-tan-dung-loi-the-tu-san-tmdt-so-1-viet-nam","status":"publish","type":"post","link":"https:\/\/jaybranding.com\/en\/tich-hop-shopeepay-api-tan-dung-loi-the-tu-san-tmdt-so-1-viet-nam\/","title":{"rendered":"T\u00edch H\u1ee3p ShopeePay API: T\u1eadn D\u1ee5ng L\u1ee3i Th\u1ebf T\u1eeb S\u00e0n TM\u0110T S\u1ed1 1 Vi\u1ec7t Nam"},"content":{"rendered":"<p class=\"wp-block-paragraph\">N\u1ebfu b\u1ea1n l\u00e0 t\u00edn \u0111\u1ed3 mua s\u1eafm tr\u00ean Shopee, ch\u1eafc ch\u1eafn b\u1ea1n kh\u00f4ng l\u1ea1 g\u00ec <strong>ShopeePay<\/strong> (Ti\u1ec1n th\u00e2n l\u00e0 AirPay). V\u1edbi l\u1ee3i th\u1ebf \u0111\u1ed9c quy\u1ec1n n\u1eb1m trong h\u1ec7 sinh th\u00e1i Shopee &#8211; s\u00e0n th\u01b0\u01a1ng m\u1ea1i \u0111i\u1ec7n t\u1eed l\u1edbn nh\u1ea5t Vi\u1ec7t Nam, ShopeePay s\u1edf h\u1eefu l\u01b0\u1ee3ng ng\u01b0\u1eddi d\u00f9ng n\u0103ng \u0111\u1ed9ng (Active Users) c\u1ef1c k\u00ec l\u1edbn.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">T\u00edch h\u1ee3p ShopeePay kh\u00f4ng ch\u1ec9 gi\u00fap b\u1ea1n khai th\u00e1c \u0111\u01b0\u1ee3c t\u1ec7p kh\u00e1ch h\u00e0ng quen thu\u1ed9c v\u1edbi vi\u1ec7c mua s\u1eafm online, m\u00e0 c\u00f2n t\u1eadn d\u1ee5ng \u0111\u01b0\u1ee3c c\u00e1c ch\u01b0\u01a1ng tr\u00ecnh khuy\u1ebfn m\u00e3i (Voucher) m\u00e0 Shopee th\u01b0\u1eddng xuy\u00ean tung ra.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">1. T\u1ea1i Sao N\u00ean Th\u00eam ShopeePay V\u00e0o Website?<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Kh\u00e1ch h\u00e0ng &#8220;S\u0103n Sale&#8221;:<\/strong> Ng\u01b0\u1eddi d\u00f9ng ShopeePay r\u1ea5t nh\u1ea1y b\u00e9n v\u1edbi c\u00e1c ch\u01b0\u01a1ng tr\u00ecnh khuy\u1ebfn m\u00e3i. T\u00edch h\u1ee3p ShopeePay gi\u00fap b\u1ea1n t\u1ea1o ra c\u00e1c chi\u1ebfn d\u1ecbch Marketing hi\u1ec7u qu\u1ea3 h\u01a1n.<\/li>\n<li><strong>Thanh to\u00e1n 1 ch\u1ea1m:<\/strong> Tr\u1ea3i nghi\u1ec7m thanh to\u00e1n tr\u00ean Mobile c\u1ef1c m\u01b0\u1ee3t m\u00e0, chuy\u1ec3n \u0111\u1ed5i t\u1eeb Web sang App ShopeePay ch\u1ec9 trong 1 gi\u00e2y.<\/li>\n<li><strong>H\u1ed7 tr\u1ee3 ShopeeFood:<\/strong> N\u1ebfu b\u1ea1n kinh doanh F&#038;B, ShopeePay l\u00e0 c\u1ed5ng thanh to\u00e1n kh\u00f4ng th\u1ec3 thi\u1ebfu.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">2. Quy Tr\u00ecnh \u0110\u0103ng K\u00fd Merchant ShopeePay<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u0110\u0103ng k\u00fd qua trang \u0111\u1ed1i t\u00e1c ShopeePay ho\u1eb7c li\u00ean h\u1ec7 JAYbranding.<\/li>\n<li>Chu\u1ea9n b\u1ecb h\u1ed3 s\u01a1 ph\u00e1p l\u00fd (Doanh nghi\u1ec7p\/H\u1ed9 kinh doanh).<\/li>\n<li>Nh\u1eadn email ch\u1ee9a th\u00f4ng tin t\u00edch h\u1ee3p:\n<ul>\n<li><code data-no-translation=\"\" data-no-auto-translation=\"\">Client ID<\/code> (App ID)<\/li>\n<li><code data-no-translation=\"\" data-no-auto-translation=\"\">Secret Key<\/code><\/li>\n<li><code data-no-translation=\"\" data-no-auto-translation=\"\">Merchant ID<\/code><\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">3. H\u01b0\u1edbng D\u1eabn T\u00edch H\u1ee3p K\u1ef9 Thu\u1eadt (ShopeePay API)<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">ShopeePay s\u1eed d\u1ee5ng chu\u1ea9n RESTful API v\u00e0 x\u00e1c th\u1ef1c b\u1eb1ng ch\u1eef k\u00fd <code data-no-translation=\"\" data-no-auto-translation=\"\">HMAC-SHA256<\/code>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">B\u01b0\u1edbc 1: T\u1ea1o Request Payment<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">B\u1ea1n c\u1ea7n g\u1eedi POST request \u0111\u1ebfn endpoint <code data-no-translation=\"\" data-no-auto-translation=\"\">\/v2\/payment\/create<\/code>.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code data-no-translation=\"\" data-no-auto-translation=\"\">\/\/ C\u1ea5u h\u00ecnh\n$clientId = \"YOUR_CLIENT_ID\";\n$secretKey = \"YOUR_SECRET_KEY\";\n$merchantId = \"YOUR_MERCHANT_ID\";\n$orderId = \"DH\" . time();\n$amount = 150000; \/\/ VND (kh\u00f4ng nh\u00e2n 100)\n$redirectUrl = \"https:\/\/yourwebsite.com\/shopeepay\/result\";\n$notifyUrl = \"https:\/\/yourwebsite.com\/shopeepay\/ipn\";\n\n\/\/ Payload JSON\n$requestBody = array(\n    'request_header' => array('merchant_id' => $merchantId),\n    'merchant_ref_id' => $orderId,\n    'payment_type' => 'Default',\n    'amount' => array('currency' => 'VND', 'value' => $amount),\n    'return_url' => $redirectUrl,\n    'notification_url' => $notifyUrl,\n    'additional_info' => 'Thanh toan don hang JAY Store'\n);\n$jsonBody = json_encode($requestBody);\n\n\/\/ T\u1ea1o Signature\n\/\/ C\u1ea5u tr\u00fac: base64(hmac-sha256(request_body, secret_key))\n$timestamp = time();\n$auth = base64_encode(hash_hmac('sha256', $jsonBody . $timestamp, $secretKey, true));\n\n\/\/ G\u1eedi CURL\n$ch = curl_init('https:\/\/api.shopeepay.vn\/v2\/payment\/create');\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array(\n    'Content-Type: application\/json',\n    'Authorization: ' . $auth,\n    'X-ShopeePay-Timestamp: ' . $timestamp\n));\ncurl_setopt($ch, CURLOPT_POST, 1);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, $jsonBody);\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$response = curl_exec($ch);\n$result = json_decode($response, true);\n\nif ($result['debug_msg'] == 'success') {\n    \/\/ Redirect kh\u00e1ch h\u00e0ng \u0111\u1ebfn link thanh to\u00e1n\n    $redirect_url_http = $result['redirect_url_http']; \/\/ Cho Web\n    $redirect_url_app = $result['redirect_url_app']; \/\/ Cho Mobile App (Deeplink)\n    \n    \/\/ Ki\u1ec3m tra User Agent \u0111\u1ec3 redirect \u0111\u00fang\n    if (isMobile()) {\n        header(\"Location: \" . $redirect_url_app);\n    } else {\n         header(\"Location: \" . $redirect_url_http);\n    }\n}<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">B\u01b0\u1edbc 2: X\u1eed l\u00fd IPN (Notification)<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">X\u1eed l\u00fd d\u1eef li\u1ec7u ShopeePay b\u1eafn v\u1ec1 <code data-no-translation=\"\" data-no-auto-translation=\"\">notifyUrl<\/code> \u0111\u1ec3 c\u1eadp nh\u1eadt tr\u1ea1ng th\u00e1i \u0111\u01a1n h\u00e0ng.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code data-no-translation=\"\" data-no-auto-translation=\"\">\/\/ File: ipn.php\n$rawInput = file_get_contents(\"php:\/\/input\");\n$headers = getallheaders();\n$receivedAuth = $headers['Authorization']; \/\/ Ch\u1eef k\u00fd t\u1eeb ShopeePay\n\n\/\/ Verify Signature\n\/\/ Logic verify t\u01b0\u01a1ng t\u1ef1 l\u00fac t\u1ea1o request nh\u01b0ng d\u00f9ng body nh\u1eadn \u0111\u01b0\u1ee3c\n$timestamp = $headers['X-ShopeePay-Timestamp'];\n$myAuth = base64_encode(hash_hmac('sha256', $rawInput . $timestamp, $secretKey, true));\n\nif ($myAuth === $receivedAuth) {\n    \/\/ Signature h\u1ee3p l\u1ec7\n    $data = json_decode($rawInput, true);\n    if ($data['status'] == 'Success') {\n        \/\/ C\u1eadp nh\u1eadt \u0111\u01a1n h\u00e0ng th\u00e0nh c\u00f4ng\n         http_response_code(200);\n    }\n} else {\n    http_response_code(401); \/\/ Unauthorized\n}<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">4. Nh\u1eefng L\u1ed7i Th\u01b0\u1eddng G\u1eb7p<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>L\u1ed7i 401 Unauthorized:<\/strong> Th\u01b0\u1eddng do t\u00ednh sai Signature ho\u1eb7c Timestamp qu\u00e1 l\u1ec7ch so v\u1edbi server ShopeePay (\u0111\u1ed3ng b\u1ed9 l\u1ea1i gi\u1edd server).<\/li>\n<li><strong>L\u1ed7i Redirect tr\u00ean Mobile:<\/strong> N\u1ebfu kh\u00e1ch h\u00e0ng kh\u00f4ng c\u00e0i App Shopee\/ShopeePay, deeplink s\u1ebd kh\u00f4ng m\u1edf \u0111\u01b0\u1ee3c. C\u1ea7n fallback (d\u1ef1 ph\u00f2ng) b\u1eb1ng c\u00e1ch chuy\u1ec3n h\u01b0\u1edbng sang Webview.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">5. D\u1ecbch V\u1ee5 C\u1ee7a JAYbranding<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">JAYbranding gi\u00fap b\u1ea1n t\u1ed1i \u01b0u h\u00f3a tr\u1ea3i nghi\u1ec7m thanh to\u00e1n ShopeePay:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u2705 <strong>Detect thi\u1ebft b\u1ecb th\u00f4ng minh:<\/strong> T\u1ef1 \u0111\u1ed9ng nh\u1eadn di\u1ec7n kh\u00e1ch d\u00f9ng iPhone hay Android \u0111\u1ec3 m\u1edf \u0111\u00fang App.<\/li>\n<li>\u2705 <strong>T\u00edch h\u1ee3p Voucher:<\/strong> H\u1ed7 tr\u1ee3 hi\u1ec3n th\u1ecb m\u00e3 gi\u1ea3m gi\u00e1 n\u1ebfu ShopeePay c\u00f3 ch\u01b0\u01a1ng tr\u00ecnh khuy\u1ebfn m\u00e3i.<\/li>\n<li>\u2705 <strong>B\u00e1o c\u00e1o doanh thu:<\/strong> T\u1ef1 \u0111\u1ed9ng t\u1ed5ng h\u1ee3p doanh thu t\u1eeb ShopeePay trong Admin Dashboard.<\/li>\n<\/ul>\n\n\n\n<p class=\"has-background wp-block-paragraph\" style=\"background-color:#f0f0f1;padding-top:20px;padding-right:20px;padding-bottom:20px;padding-left:20px;font-size:20px\"><strong>\ud83d\udcde T\u00edch h\u1ee3p ShopeePay &#8211; \u0110\u00f3n \u0111\u1ea7u xu h\u01b0\u1edbng mua s\u1eafm!<\/strong><br>Hotline: <a href=\"tel:0899991131\"><strong>0899991131<\/strong><\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">FAQ V\u1ec1 ShopeePay<\/h2>\n\n\n<p>[faqs]<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">ShopeePay c\u00f3 h\u1ed7 tr\u1ee3 tr\u1ea3 g\u00f3p kh\u00f4ng?<\/h4>\n\n\n<p class=\"wp-block-paragraph\">C\u00f3, th\u00f4ng qua SPayLater (Mua tr\u01b0\u1edbc tr\u1ea3 sau) t\u00edch h\u1ee3p s\u1eb5n trong v\u00ed.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Ph\u00ed giao d\u1ecbch ShopeePay l\u00e0 bao nhi\u00eau?<\/h4>\n\n\n<p class=\"wp-block-paragraph\">T\u01b0\u01a1ng \u0111\u01b0\u01a1ng c\u00e1c v\u00ed kh\u00e1c, kho\u1ea3ng 1.1% &#8211; 2.0%.<\/p>\n\n\n<p>[\/faqs]<\/p>","protected":false},"excerpt":{"rendered":"<p>N\u1ebfu b\u1ea1n l\u00e0 t\u00edn \u0111\u1ed3 mua s\u1eafm tr\u00ean Shopee, ch\u1eafc ch\u1eafn b\u1ea1n kh\u00f4ng l\u1ea1 g\u00ec ShopeePay (Ti\u1ec1n th\u00e2n l\u00e0 AirPay). V\u1edbi l\u1ee3i th\u1ebf \u0111\u1ed9c quy\u1ec1n n\u1eb1m trong h\u1ec7 sinh th\u00e1i Shopee &#8211; s\u00e0n th\u01b0\u01a1ng m\u1ea1i \u0111i\u1ec7n t\u1eed l\u1edbn nh\u1ea5t Vi\u1ec7t Nam, ShopeePay s\u1edf h\u1eefu l\u01b0\u1ee3ng ng\u01b0\u1eddi d\u00f9ng n\u0103ng \u0111\u1ed9ng (Active Users) c\u1ef1c k\u00ec l\u1edbn. T\u00edch [&hellip;]<\/p>","protected":false},"author":0,"featured_media":64596,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[1043,1046,1044,1042,1045],"class_list":["post-64595","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tin-tuc","tag-airpay-api","tag-code-php-shopeepay","tag-thanh-toan-shopee","tag-tich-hop-shopeepay","tag-vi-shopeepay"],"_links":{"self":[{"href":"https:\/\/jaybranding.com\/en\/wp-json\/wp\/v2\/posts\/64595","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jaybranding.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jaybranding.com\/en\/wp-json\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/jaybranding.com\/en\/wp-json\/wp\/v2\/comments?post=64595"}],"version-history":[{"count":1,"href":"https:\/\/jaybranding.com\/en\/wp-json\/wp\/v2\/posts\/64595\/revisions"}],"predecessor-version":[{"id":64622,"href":"https:\/\/jaybranding.com\/en\/wp-json\/wp\/v2\/posts\/64595\/revisions\/64622"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/jaybranding.com\/en\/wp-json\/wp\/v2\/media\/64596"}],"wp:attachment":[{"href":"https:\/\/jaybranding.com\/en\/wp-json\/wp\/v2\/media?parent=64595"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jaybranding.com\/en\/wp-json\/wp\/v2\/categories?post=64595"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jaybranding.com\/en\/wp-json\/wp\/v2\/tags?post=64595"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}