{"id":2590,"date":"2025-05-12T14:26:21","date_gmt":"2025-05-12T06:26:21","guid":{"rendered":"https:\/\/www.deekpay.com\/?p=2590"},"modified":"2025-05-12T14:26:21","modified_gmt":"2025-05-12T06:26:21","slug":"%e5%a6%82%e4%bd%95%e7%94%a8php%e6%8e%a5%e5%85%a5%e8%b6%8a%e5%8d%97%e6%94%af%e4%bb%98%e7%bd%91%e5%85%b3%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/www.deekpay.com\/en\/2025\/05\/12\/%e5%a6%82%e4%bd%95%e7%94%a8php%e6%8e%a5%e5%85%a5%e8%b6%8a%e5%8d%97%e6%94%af%e4%bb%98%e7%bd%91%e5%85%b3%ef%bc%9f\/","title":{"rendered":"How to access Vietnam Payment Gateway with PHP?"},"content":{"rendered":"<h1>A guide to using PHP to access payment gateways in Vietnam<\/h1>\n<p>To access Vietnam payment gateways using PHP, you need to follow the steps below. I will use a few popular Vietnamese payment gateways as an example.<\/p>\n<h2>Common Vietnam Payment Gateway Options<\/h2>\n<ol>\n<li><strong>VNPay<\/strong> - One of the most popular local payment solutions<\/li>\n<li><strong>Momo<\/strong> - Mobile wallet payments<\/li>\n<li><strong>ZaloPay<\/strong> - Another popular e-wallet<\/li>\n<li><strong>OnePay<\/strong> - Visa\/MasterCard processors<\/li>\n<\/ol>\n<h2>VNPay Integration Example<\/h2>\n<h3>1. Preparatory work<\/h3>\n<ul>\n<li><a href=\"https:\/\/vnpay.vn\/\">Register for a VNPay merchant account<\/a><\/li>\n<li>Get Merchant ID (<code>vnp_TmnCode<\/code>) and the key (<code>vnp_HashSecret<\/code>)<\/li>\n<li>API documentation and endpoint URLs provided by VNPay<\/li>\n<\/ul>\n<h3>2. PHP integration code example<\/h3>\n<pre><code class=\"language-php\">&lt;?php<br>\r\n\/\/ config.php - VNPay\u914d\u7f6e\u53c2\u6570<br>\r\n$vnp_Url = &quot;https:\/\/sandbox.vnpayment.vn\/paymentv2\/vpcpay.html&quot;;<br>\r\n$vnp_Returnurl = &quot;https:\/\/yourdomain.com\/return_url.php&quot;; \/\/\u56de\u8c03URL<br>\r\n$vnp_TmnCode = &quot;YOUR_MERCHANT_CODE&quot;; \/\/\u5546\u6237\u53f7 <br>\r\n$secretKey = &quot;YOUR_SECRET_KEY&quot;; \/\/\u5b89\u5168\u5bc6\u94a5 <br>\r\n<br>\r\n\/\/ vnpay_create_payment.php -\u521b\u5efa\u4ed8\u6b3e\u8bf7\u6c42 <br>\r\nfunction createVNPayPayment($orderId, $amount, $orderInfo) {<br>\r\n    global $vnp_Url, $vnp_Returnurl, $vnp_TmnCode, $secretKey;<br>\r\n    <br>\r\n    date_default_timezone_set('Asia\/Ho_Chi_Minh');<br>\r\n    <br>\r\n    \/\/\u51c6\u5907\u53c2\u6570\u6570\u7ec4 <br>\r\n    $inputData = array(<br>\r\n        &quot;version&quot; =&gt; &quot;2&quot;,<br>\r\n        &quot;command&quot; =&gt; &quot;pay&quot;,<br>\r\n        'merchant' =&gt; 'VNPAY',<br>\r\n        'tmn_code' =&gt; trim($tmnCode),<br>\r\n        'create_date' =&gt; date('YmdHis'),<br>\r\n        'expire_date' =&gt; date('YmdHis', strtotime('+15 minutes')),<br>\r\n        <br>\r\n        \/\/\u8ba2\u5355\u4fe1\u606f <br>\r\n        'order_id' =&gt; time(),<br>\r\n        <br>\r\n         \/\/\u91d1\u989d(\u5355\u4f4d\u4e3aVND)<br>\r\n         'amount'=&gt; intval(str_replace(',','',$amount))*100,<br>\r\n         <br>\r\n         \/\/\u8ba2\u5355\u63cf\u8ff0  <br>\r\n         'order_desc'=&gt; urlencode($orderInfo),<br>\r\n         <br>\r\n          return_url=&gt; urlencode($return_url),   <br>\r\n          <br>\r\n           ip_address=&gt; $_SERVER['REMOTE_ADDR'],     <br>\r\n           <br>\r\n            currency=&gt;&quot;VND&quot;,      <br>\r\n            <br>\r\n             locale=&gt; ($lang == &quot;&quot;) ? vn : en,<br>\r\n              <br>\r\n              bank_code=&gt; &quot;&quot;,<br>\r\n                );<br>\r\n                <br>\r\n     ksort($inputData);<br>\r\n     <br>\r\n      query=&quot;&quot;;<br>\r\n      foreach ($inputData as key value){<br>\r\n          if(substr(key0)==&quot;_&quot;) continue;<br>\r\n          if(!empty(query)) query.= &amp;&quot;.key.&quot;=&quot;.$value; else query=key.&quot;=&quot;.$value;}<br>\r\n          <br>\r\n       secureHash=hash(&quot;sha256&quot;, secret_key.query);       <br>\r\n       <br>\r\n       inputData[&quot;secure_hash&quot;]=$secureHash;      <br>\r\n       <br>\r\n       paymentUrl=vpn_URL .&quot;?&quot;.http_build_query(input_data);      <br>\r\n       <br>\r\n       header(&quot;Location: &quot;.payment_url); exit();}<br>\r\n<\/code><\/pre>\n<h2>Momo Wallet Integration Example<\/h2>\n<pre><code class=\"language-php\">&lt;?php <br>\r\n\/\/ momo_config.php <br>\r\ndefine(\"PARTNER_CODE\", \"\");\/\/Your partner code from MoMo\").<br>\r\ndefine(\"ACCESS_KEY\",\"\"); \/\/\/Your access key from MoMo\").<br>\r\ndefine(\"SECRET_KEY\",\"\"); \/\/\/Your secret key from MoMo\").<br>\r\n<br>\r\nfunction execPostRequest(url data){<br>\r\n     ch curl_init();<br>\r\n     curl_setopt(ch CURLOPT_URL url).<br>\r\n     curl_setopt(ch CURLOPT_POST true).<br>\r\n     curl_setopt(ch CURLOPT_POSTFIELDS data).<br>\r\n     curl_setopt(ch CURLOPT_USERAGENT $_SERVER['HTTP_USER_AGENT']);<br>\r\n     curl_setopt(ch CURLOPT_RETURNTRANSFER true);<br>\r\n     <br>\r\n      result=curl_exec ch );curl_close ch ); return result;}<br>\r\n      <br>\r\n function createMomoPayment(orderId amount orderInfo callbackUrl redirectUrl){   <br>\r\n      endpoint = \"https:\/\/test-payment.momo.vn\/gw_payment\/transactionProcessor\";<br>\r\n      <br>\r\n       requestId time().\"\" ;\/\/unique id for each request<br>\r\n        <br>\r\n         rawHash = \"partnerCode=\" PARTNER CODE.<br>\r\n                  &amp;accessKey ACCESS KEY.<br>\r\n                  &amp;requestId request Id.<br>\r\n                  &amp;amount amount.<br>\r\n                  &amp;orderId order Id .<br>\r\n                   order info .<br>\r\n                   return Url callback Url .<br>\r\n                    notify Url callback Url .extra Data \"\";<br>\r\n                    <br>\r\n                     signature hash hmac sha256 raw Hash SECRET KEY)).<br>\r\n                     data array(<br>\r\n                         partner Code PARTNER CODE ,<br>\r\n                          access Key ACCESS KEY ,<br>\r\n                           request Id request Id ,<br>\r\n                            amount amount ,                              <br>\r\n                             order Id order ID ,                               <br>\r\n            <br>\r\n                              Order Info urldecode(order Info ),                                <br>\r\n            <br>\r\n                               Return URL redirect URL ,                                   <br>\r\n            <br>\r\n                                Notify URL call back URl ,                                       <br>\r\n            <br>\r\n                                 extra Data \"\",                                              <br>\r\n            <br>\r\n                                  Request Type capture MO wallet \",                                           <br>\r\n            <br>\r\n                                   Signature signature ).                                          <br>\r\n<br>\r\nJSON encode(data)).                                                                                  <br>\r\n<br>\r\nresponse exec Post Request(endpoint json encodedata)).                                                 <br>\r\n<br>\r\njson decode(response true);                                                                              <br>\r\n<br>\r\n<br>\r\nif isset(result pay UrL )) header Location result pay UrL ]); else echo Error creating payment ;}? &gt;}?<br>\r\n<\/code><\/pre>\n<h2>Zalo Pay integration example (similar structure)<\/h2>\n<pre><code class=\"language-php\"> <br>\r\nclass ZalopayHelper {    <br>\r\n<br>\r\nconst APP_ID your app id ;<br>\r\nconst KEY1 your key1 ;<br>\r\nconst EMBED DATA [\" merchantinfo\"=&gt; embeddata json encode([\" merchant name\"=&gt; Your Store Name ])];;<br>\r\n<br>\r\npublic static function CreateOrder( string description long price string callback url ){<br>\r\ndate default timezone set Asia Ho Chi Minh ).<br>\r\n<br>\r\ntimestamp round(microtime(true)*1000).<br>\r\n<br>\r\nparams [<br>\r\nappid self APP ID,<br>\r\napptransid date(Ymd). _. timestamp,# format yyMMdd timestamp e.g21092740765200<br>\r\n    <br>\r\n appuser Zalo Pay Demo m desc description,<br>\r\n<br>\r\n amoun tprice.<br>\r\n<br>\r\n item JSON encode([]),<br>\r\n<br>\r\n bankcode zalopayapp ,<br>\r\n<br>\r\ncallbackurl call back ur l ];.<br>\r\n<br>\r\nMac=self Compute Mac(params);<br>\r\n<br>\r\nparams[ mac]=Mac;<br>\r\n<br>\r\nresponse Http Helper post https sb openapi zalopay vn \/vp\/create params );<br>\r\n<br>\r\nreturn json decode response body ) ;<br>\r\n<br>\r\n}<br>\r\n<br>\r\nprivate static function Compute Mac(array params ):string {<br>\r\n<br>\r\norderedParams [].<br>\r\n<br>\r\nforeach ([ appid , apptransid , appuser amoun t apptime emb edda ta item ]as param){<br>\r\n<br>\r\nif isset params param]) ordered Params[]=$param.'='.$params[$param];}<br>\r\n<br>\r\nmessage implode(&amp; ordered Params ).<br>\r\n<br>\r\nreturn hash hmac sha256 message self::KEY one false );}}<br>\r\n<\/code><\/pre>\n<h2>One Pay International Card Processing (for credit cards)<\/h2>\n<pre><code class=\"language-php\"> <br>\r\nclass One PayInternational {<br>\r\n<br>\r\nprivate static endpoint sandbox onep ay international com api\/v two \/processor ;\u00c2<br>\r\n<br>\r\npublic static process Payment card Number expiry Month expiry Year cv vAmount currency Description ){<br>\r\ndate default timezone set Asia Ho Chi Minh ).<br>\r\nnonce bin hex random bytes sixteen )).<br>\r\n<br>\r\npost Fields [<br>\r\nnumber card Number ],<br>\r\nexp month expiry Month ],<br>\r\nexp year expiry Year ],cvv cv v],<br>\r\ncurrency str toupper currency ),<br>\r\namoun tround float val Amount *100 ),# in cents\/pence\/etc.<br>\r\n<br>\r\ndescription substr Description fifty ),<br>\r\nthree DSecure false ];<br>\r\n<br>\r\njson payload json encode post fields base sixty four encode nonce.json payload)).<br>\r\n<br>\r\nsignature base sixty four encode hash hmac sha two five six nonce.payload YOUR API SECRE Ttrue)).<br>\r\n<br>\r\nheaders [<br>\r\n<br>\r\nContent Type application\/json',<br>\r\n<br>\r\nAuthorisation Bearer.<br>\r\n<br>\r\nSignature.signature ];<br>\r\n<br>\r\nch init();<br>\r\n<br>\r\nset opt ch,CUR LOP TSSL VERIFYPEERfalse);<br>\r\n<br>\r\nset opt ch,CUR LOP THEADE R headers );<br>\r\n<br>\r\nset optch CUR LOP POSTtrue);<br>\r\n<br>\r\nset optch CUR LOP POS TFIELDS payload );.<br>\r\n<br>\r\nset optch CUR LOP RET UR NTR ANSFE Rtrue).<br>\r\n<br>\r\n<br>\r\nexec curlexe cch close (ch return response ;}}<br>\r\n<br>\r\n? &gt;\"<br>\r\n<\/code><\/pre>\n<p>Important Tip:<\/p>\n<p>All the above code is only the basic framework, the actual implementation should be noted:<br \/>\nSecurity measures such as input validation, error handling and logging must be in place.<br \/>\nProduction environments should use HTTPS and store sensitive data in a secure location.<br \/>\nAdjust parameter names and value formats according to the latest API documentation.<\/p>\n<p>It is recommended to test your implementation in the sandbox environment of each payment first.<\/p>\n<h1>Detailed guide to continue PHP access to Vietnam Payment Gateway<\/h1>\n<p>Below I'll go more in-depth on how to improve payment integration, including callback handling, security measures, and solutions to common problems.<\/p>\n<h2>1. VNPay callback processing implementation<\/h2>\n<p>When a user completes a payment, VNPay notifies your system in two ways:<\/p>\n<ul>\n<li><strong>browser redirection<\/strong>(return_url)<\/li>\n<li><strong>Server asynchronous notification<\/strong>(IPN - Instant Payment Notification)<\/li>\n<\/ul>\n<h3>return_url.php sample code<\/h3>\n<pre><code class=\"language-php\">&lt;?php<br>\r\n\/\/ config.php<br>\r\nrequire_once('config.php');<br>\r\n<br>\r\n\/\/ Get all GET parameters<br>\r\n$vnp_Params = $_GET;<br>\r\n$secureHash = $vnp_Params['vnp_SecureHash'];<br>\r\nunset($vnp_Params['vnp_SecureHash']);<br>\r\n<br>\r\n\/\/ Sort parameters alphabetically<br>\r\nksort($vnp_Params).<br>\r\n<br>\r\n\/\/ Generate a hash value for authentication<br>\r\n$hashData = \"\";<br>\r\nforeach ($vnp_Params as $key =&gt; $value) {<br>\r\n    if (substr($key, 0, 4) == \"vnp_\") {<br>\r\n        $hashData . = urlencode($key) . \"=\" . urlencode($value) . \"&amp;\";<br>\r\n    }<br>\r\n}<br>\r\n$hashData = rtrim($hashData, '&amp;');<br>\r\n<br>\r\n$secureSecret = $secretKey; \/\/ from config.php<br>\r\n$mySecureHash = hash_hmac('sha512', $hashData, $secureSecret);<br>\r\n<br>\r\nif ($mySecureHash === $secureHash) {<br>\r\n    if ($_GET['vnP_ResponseCode'] == '00') {<br>\r\n        \/\/ Payment success logic<br>\r\n        <br>\r\n        \/*<br>\r\n         * :: TODO. <br>\r\n         * :: - Update order status to paid <br>\r\n         * :: -- Recording of transaction information to the database <br>\r\n         * - vnP_TxnRef is your order ID (that you originally passed to VNPay)<br>\r\n         *\/<br>\r\n        <br>\r\n        echo \"Payment Success for order: \".$_GET['vnP_TxnRef'];<br>\r\n    } else {<br>\r\n        \/\/ Payment failed or cancelled by user<br>\r\n        <br>\r\n        \/*<br>\r\n         * :: TODO.<br>\r\n         * - Update order status to failed\/cancelled in your database  <br>\r\n         *\/<br>\r\n         <br>\r\n       echo \"Payment Failed\/Cancelled\";   <br>\r\n   }<br>\r\n} else {    <br>\r\n   die(\"Invalid signature\").   <br>\r\n}<br>\r\n<\/code><\/pre>\n<h3>IPN Handling Script (ipn_listener.php)<\/h3>\n<pre><code class=\"language-php\">&lt;?php  <br>\r\nrequire_once('config.php');  <br>\r\n<br>\r\nfile put contents ('ipn log.txt', print r($_POST true).\" \\n\", FILE APPEND );  <br>\r\n<br>\r\nif (!empty($_POST)) {      <br>\r\n     input Data=$ POST.     <br>\r\n      secure Hash=input Data ['vn p Secure Hash'];     <br>\r\n       unset(input Data ['vn p Secure Hash']);       <br>\r\n       <br>\r\n       ksort(input Data).        <br>\r\n       <br>\r\n       i=0;        <br>\r\n       <br>\r\n       hash Data=\"\";        <br>\r\n        <br>\r\nforeach (input Data as key value){            <br>\r\n     if substr(key04)==\"vn p\"){                <br>\r\n          if strlen(hash Dat a)&gt;0){                    <br>\r\n               hash Dat a.='&amp;'.url encode(key).' ='.url encode(value);                <br>\r\n           }else{                    <br>\r\n                hash Dat a.=url encode(key).' ='.url encode(value);                <br>\r\n            }            <br>\r\n      }        <br>\r\n}        <br>\r\n<br>\r\ncheck Sum=hash hmac sha512(h ash da ta secret Key );        <br>\r\n<br>\r\nif check Sum== secure Has h){            <br>\r\n     transaction Id=input Da ta ['vp Txn Ref'].             <br>\r\n      response Code=input Da ta ['vp Response Co de'];              <br>\r\n      <br>\r\n      \/* TODO.                 <br>\r\n         1 Validate the amount matches your expected amount                 <br>\r\n         2 Check this is not duplicate notification                 <br>\r\n         3 Update your database accordingly *\/              <br>\r\n          <br>\r\n           switch(response Co de){ case \"00\": \/* SUCCESS *\/ break ; default : \/* FAILURE *\/ break ; }}else{ http response code(403);\/\/Forbidden exit();}? &gt;<br>\r\n<\/code><\/pre>\n<h2>MoMo Wallet Advanced Integration Tips<\/h2>\n<h3>Webhook Authentication Example<\/h3>\n<pre><code class=\"language-php\"> <br>\r\nfunction verify MomoWeb hook(Request ){    <br>\r\n     partner Code request input('partner Code').    <br>\r\n      access Key request input('access Key');     <br>\r\n       request Id time().\"\" ;\/\/should match original     <br>\r\n        order Id request input('orderId');      <br>\r\n         <br>\r\namount req uest-&gt;input amoun t)).          <br>\r\norder Info urldecode(req uest-&gt;input desc ))).           <br>\r\nResponse Time req uest-&gt;input resp onse Time )))).           <br>\r\nmessage req uest-&gt;input mes sage )))).           <br>\r\ntrans Id req uest-&gt;input transId ))).           <br>\r\nerror Cod e re quest -&gt;in put errorCode )) ? :0.           <br>\r\n            <br>\r\nextra D ata \"\";\/\/custom data you passed initially now returned back unchanged                        <br>\r\nraw H ash = \"partnerCode={ partnerCo de}&amp;accessKey={ accessKe y}&amp;requestId={ reques tI d}&amp;amount={ amo unt}&amp;orderId={ ord erI d}\".\" &amp;orderInfo={ orde rIn fo}&amp;responseTime={ res pon seT ime}{ ext raD ata}\";\".                         <br>\r\n<br>\r\nsignatureFromMomo=req est &gt;i nput sig nature );                         <br>\r\n<br>\r\nourSignature=ha sh hm ac sha256 rawH ash SECRET KEY ).                         <br>\r\n<br>\r\nif our Signature!= signature From Momo || errorC ode ! =0){<br>\r\nlog info (\"Invalid MoMo webhook received\".json encodereq est all())).<br>\r\nabort(400, \"Bad Request\");}<br>\r\n<br>\r\n\/* Process successful payment here *\/<br>\r\n<br>\r\nreturn response json success truemessage OK ]200 headers Content Type application\/json ];}<br>\r\n<\/code><\/pre>\n<h2>Zalo Pay Refund Process Implementation<\/h2>\n<pre><code class=\"language-php\"> <br>\r\nclass ZalopayService{<br>\r\n<br>\r\nconst REFUND ENDPOINT https sb openapi zalopay vn \/vp\/refund ;<br>\r\n<br>\r\npublic static function process Refund(string zp Trans Token long refund Amount string description ){<br>\r\ntimestamp round microtime true)*1000 );<br>\r\n<br>\r\nparams [<br>\r\nappid self APP ID,<br>\r\nzptransid zpTransToken ,<br>\r\namoun t refundAmount ,<br>\r\ndescription substr description fifty ),<br>\r\ntimestamp timestamp ];<br>\r\n<br>\r\nMac=self Compute Mac params );<br>\r\n<br>\r\nparams mac]=Mac;<br>\r\n<br>\r\nresponse Http Helper post self REFUND ENDPOINT params );<br>\r\n<br>\r\nresult json decode response body true );<br>\r\n<br>\r\nif isset result return code])&amp;&amp; result return code]==1){<br>\r\n\/*<br>\r\nTODO:<br>\r\nUpdate your database to reflect refund status*\/<br>\r\nreturn true;}else{<br>\r\nLog error (&quot;ZaloPay refund failed&quot;.print r(resulttrue));<br>\r\nthrow new Exception Failed to process refund with Zalo Pay.);}}<br>\r\n<\/code><\/pre>\n<h2>3D Secure Integration for One Pay International Card Payments<\/h2>\n<p>For transactions that require 3D authentication:<\/p>\n<pre><code class=\"language-php\"><br>\r\nclass ThreeDSecureHandler {<br>\r\n<br>\r\npublic static function initiateThreeDSecure(array card Details float amount string currency ){<br>\r\none pay Client new One PayInternational();<br>\r\n<br>\r\nauth Response one pay Client create Auth Request card Details amount currency three DSEnabled=&gt;true]);.<br>\r\n<br>\r\nthree Ds Method Url auth Response three ds method url ? null.<br>\r\n<br>\r\nthree Ds Server Trans ID auth Response three ds server trans id ? null.<br>\r\n<br>\r\nsession put current payment session [ ... .cardDetails ,... authResponse ]);<br>\r\n<br>\r\nredirect Url route checkout.threeds challenge name ]).<br>\r\n<br>\r\nreturn view checkout.threeds initiate compact redirectUrl threeDsMethodUrl threeDsServerTransId amount currency cardDetails lastFour digits])) ;)<br>\r\n<br>\r\n}<br>\r\n<br>\r\npublic static function handle Challenge Completion(Request req ){<br>\r\nsession Get current payment session ;<br>\r\n<br>\r\none pay Client new OnePayInternational();<br>\r\n<br>\r\nfinalize Result one payClient complete Three DS Auth session get threeds server trans id ],req all());.<br>\r\n<br>\r\n\/* Verify MAC\/signature etc.*\/<br>\r\n<br>\r\nswitch finalize Result status]){<br>\r\ncase succeeded.<br>\r\nOrder Service mark Paid session get order id ]);;<br>\r\nbreak;<br>\r\ndefault.<br>\r\nOrder Service mark Failed(session get order id ]).<br>\r\nthrow new PaymentFailedException();<br>\r\n}}}<br>\r\n<\/code><\/pre>\n<h2>Security Best Practices<\/h2>\n<h3>Essential Security Measures.<\/h3>\n<p>1.<strong>Always validate callbacks<\/strong>: Never trust incoming requests without verifying signatures.<\/p>\n<p>2.<strong>Use HTTPS everywhere<\/strong>: Especially for callback URLs and when transmitting sensitive data.<\/p>\n<p>3.<strong>Implement CSRF protection<\/strong>:: On pages initiating payments.<\/p>\n<p>4.<strong>Sanitize all inputs<\/strong>: Prevent XSS\/SQL injection attacks.<\/p>\n<p>5.<strong>Log important events<\/strong>: But don't log full card details or sensitive tokens.<\/p>\n<p>6.<strong>Store minimal data<\/strong>: Don't store PAN\/CVV after processing completes successfully.<\/p>\n<p>7. Use up-to-date TLS versions (v1.2+).<\/p>\n<p>8.Regularly rotate API keys\/secrets especially after staff changes .<\/p>\n<p>9.Monitor for suspicious activity like multiple failed attempts .<\/p>\n<p>10.Keep PHP and dependencies patched against known vulnerabilities .<\/p>\n<h2>Troubleshooting Common Issues<\/h2>\n<table>\n<thead>\n<tr>\n<th>Issue phenomenon<\/th>\n<th>Possible Causes<\/th>\n<th>Solutions<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>Invalid\/Missing Signature Error<\/td>\n<td>Wrong hashing algorithm algorithm inconsistency<br \/>Parameter ordering issue<br \/>Encoding problem<\/td>\n<td>Double-check gateway docs document validation<br \/>Ensure exact same parameter ordering<br \/>Test with their sample values using test data to validate<\/td>\n<\/tr>\n<tr>\n<td>Callbacks not received<\/td>\n<td>Firewall blocking<br \/>URL incorrect<br \/>Temporary gateway outage service is temporarily unavailable.<\/td>\n<td>Whitelist gateway IPs whitelist settings<br \/>Verify URL in merchant dashboard merchant backend checking <br \/>Contact support Contact support team<\/td>\n<\/tr>\n<tr>\n<td>Payments stuck pending status always pending<\/td>\n<td>Asynchronous processing <br \/>Settlement batch timing Settlement batch timing difference <br \/>Suspected fraud suspected fraud review in progress Wait a reasonable amount of time to check the status of the transaction or contact customer service.<\/td>\n<td><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Remember that each Vietnamese payment provider may have specific requirements so always refer to their latest official documentation before going live with any integration.<\/p>","protected":false},"excerpt":{"rendered":"<p>Guide to use PHP to access Vietnam Payment Gateway To use PHP to access Vietnam Payment Gateway...<\/p>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[34],"tags":[],"class_list":["post-2590","post","type-post","status-publish","format-standard","hentry","category-34"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.9 (Yoast SEO v23.7) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u5982\u4f55\u7528PHP\u63a5\u5165\u8d8a\u5357\u652f\u4ed8\u7f51\u5173\uff1f - DEEKPAY-\u5370\u5ea6\u539f\u751f\u652f\u4ed8|\u5370\u5ea6UPI\u652f\u4ed8|\u5370\u5ea6\u4e09\u65b9\u56db\u65b9\u652f\u4ed8<\/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.deekpay.com\/en\/2025\/05\/12\/\u5982\u4f55\u7528php\u63a5\u5165\u8d8a\u5357\u652f\u4ed8\u7f51\u5173\uff1f\/\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u5982\u4f55\u7528PHP\u63a5\u5165\u8d8a\u5357\u652f\u4ed8\u7f51\u5173\uff1f\" \/>\n<meta property=\"og:description\" content=\"\u4f7f\u7528PHP\u63a5\u5165\u8d8a\u5357\u652f\u4ed8\u7f51\u5173\u7684\u6307\u5357 \u8981\u4f7f\u7528PHP\u63a5\u5165\u8d8a\u5357\u652f\u4ed8\u7f51&hellip;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.deekpay.com\/en\/2025\/05\/12\/\u5982\u4f55\u7528php\u63a5\u5165\u8d8a\u5357\u652f\u4ed8\u7f51\u5173\uff1f\/\" \/>\n<meta property=\"og:site_name\" content=\"DEEKPAY-\u5370\u5ea6\u539f\u751f\u652f\u4ed8|\u5370\u5ea6UPI\u652f\u4ed8|\u5370\u5ea6\u4e09\u65b9\u56db\u65b9\u652f\u4ed8\" \/>\n<meta property=\"article:published_time\" content=\"2025-05-12T06:26:21+00:00\" \/>\n<meta name=\"author\" content=\"deekpay\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"deekpay\" \/>\n\t<meta name=\"twitter:label2\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.deekpay.com\/en\/2025\/05\/12\/%e5%a6%82%e4%bd%95%e7%94%a8php%e6%8e%a5%e5%85%a5%e8%b6%8a%e5%8d%97%e6%94%af%e4%bb%98%e7%bd%91%e5%85%b3%ef%bc%9f\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.deekpay.com\/en\/2025\/05\/12\/%e5%a6%82%e4%bd%95%e7%94%a8php%e6%8e%a5%e5%85%a5%e8%b6%8a%e5%8d%97%e6%94%af%e4%bb%98%e7%bd%91%e5%85%b3%ef%bc%9f\/\"},\"author\":{\"name\":\"deekpay\",\"@id\":\"https:\/\/www.deekpay.com\/#\/schema\/person\/91e4e842fdd04f8c957a9f642506f51d\"},\"headline\":\"\u5982\u4f55\u7528PHP\u63a5\u5165\u8d8a\u5357\u652f\u4ed8\u7f51\u5173\uff1f\",\"datePublished\":\"2025-05-12T06:26:21+00:00\",\"dateModified\":\"2025-05-12T06:26:21+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.deekpay.com\/en\/2025\/05\/12\/%e5%a6%82%e4%bd%95%e7%94%a8php%e6%8e%a5%e5%85%a5%e8%b6%8a%e5%8d%97%e6%94%af%e4%bb%98%e7%bd%91%e5%85%b3%ef%bc%9f\/\"},\"wordCount\":237,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.deekpay.com\/#organization\"},\"articleSection\":[\"\u8d8a\u5357\u652f\u4ed8\"],\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.deekpay.com\/en\/2025\/05\/12\/%e5%a6%82%e4%bd%95%e7%94%a8php%e6%8e%a5%e5%85%a5%e8%b6%8a%e5%8d%97%e6%94%af%e4%bb%98%e7%bd%91%e5%85%b3%ef%bc%9f\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.deekpay.com\/en\/2025\/05\/12\/%e5%a6%82%e4%bd%95%e7%94%a8php%e6%8e%a5%e5%85%a5%e8%b6%8a%e5%8d%97%e6%94%af%e4%bb%98%e7%bd%91%e5%85%b3%ef%bc%9f\/\",\"url\":\"https:\/\/www.deekpay.com\/en\/2025\/05\/12\/%e5%a6%82%e4%bd%95%e7%94%a8php%e6%8e%a5%e5%85%a5%e8%b6%8a%e5%8d%97%e6%94%af%e4%bb%98%e7%bd%91%e5%85%b3%ef%bc%9f\/\",\"name\":\"\u5982\u4f55\u7528PHP\u63a5\u5165\u8d8a\u5357\u652f\u4ed8\u7f51\u5173\uff1f - DEEKPAY-\u5370\u5ea6\u539f\u751f\u652f\u4ed8|\u5370\u5ea6UPI\u652f\u4ed8|\u5370\u5ea6\u4e09\u65b9\u56db\u65b9\u652f\u4ed8\",\"isPartOf\":{\"@id\":\"https:\/\/www.deekpay.com\/#website\"},\"datePublished\":\"2025-05-12T06:26:21+00:00\",\"dateModified\":\"2025-05-12T06:26:21+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.deekpay.com\/en\/2025\/05\/12\/%e5%a6%82%e4%bd%95%e7%94%a8php%e6%8e%a5%e5%85%a5%e8%b6%8a%e5%8d%97%e6%94%af%e4%bb%98%e7%bd%91%e5%85%b3%ef%bc%9f\/#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.deekpay.com\/en\/2025\/05\/12\/%e5%a6%82%e4%bd%95%e7%94%a8php%e6%8e%a5%e5%85%a5%e8%b6%8a%e5%8d%97%e6%94%af%e4%bb%98%e7%bd%91%e5%85%b3%ef%bc%9f\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.deekpay.com\/en\/2025\/05\/12\/%e5%a6%82%e4%bd%95%e7%94%a8php%e6%8e%a5%e5%85%a5%e8%b6%8a%e5%8d%97%e6%94%af%e4%bb%98%e7%bd%91%e5%85%b3%ef%bc%9f\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.deekpay.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u5982\u4f55\u7528PHP\u63a5\u5165\u8d8a\u5357\u652f\u4ed8\u7f51\u5173\uff1f\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.deekpay.com\/#website\",\"url\":\"https:\/\/www.deekpay.com\/\",\"name\":\"DEEKPAY-\u5370\u5ea6\u539f\u751f\u652f\u4ed8|\u5370\u5ea6UPI\u652f\u4ed8|\u5370\u5ea6\u4e09\u65b9\u652f\u4ed8\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/www.deekpay.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.deekpay.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-GB\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.deekpay.com\/#organization\",\"name\":\"DEEKPAY-\u5370\u5ea6\u539f\u751f\u652f\u4ed8\u548cUPI\u652f\u4ed8\u670d\u52a1\u5546\",\"url\":\"https:\/\/www.deekpay.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/www.deekpay.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/deekpay.com\/wp-content\/uploads\/2024\/11\/LOGO-1.png\",\"contentUrl\":\"https:\/\/deekpay.com\/wp-content\/uploads\/2024\/11\/LOGO-1.png\",\"width\":649,\"height\":191,\"caption\":\"DEEKPAY-\u5370\u5ea6\u539f\u751f\u652f\u4ed8\u548cUPI\u652f\u4ed8\u670d\u52a1\u5546\"},\"image\":{\"@id\":\"https:\/\/www.deekpay.com\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.deekpay.com\/#\/schema\/person\/91e4e842fdd04f8c957a9f642506f51d\",\"name\":\"deekpay\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/www.deekpay.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/485e931d0b237ba5cfa6c7cea419d88f7e3258b4837d99943e099ff93b458f8c?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/485e931d0b237ba5cfa6c7cea419d88f7e3258b4837d99943e099ff93b458f8c?s=96&d=mm&r=g\",\"caption\":\"deekpay\"},\"sameAs\":[\"https:\/\/deekpay.com\"],\"url\":\"https:\/\/www.deekpay.com\/en\/author\/deekpay\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"\u5982\u4f55\u7528PHP\u63a5\u5165\u8d8a\u5357\u652f\u4ed8\u7f51\u5173\uff1f - DEEKPAY-\u5370\u5ea6\u539f\u751f\u652f\u4ed8|\u5370\u5ea6UPI\u652f\u4ed8|\u5370\u5ea6\u4e09\u65b9\u56db\u65b9\u652f\u4ed8","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.deekpay.com\/en\/2025\/05\/12\/\u5982\u4f55\u7528php\u63a5\u5165\u8d8a\u5357\u652f\u4ed8\u7f51\u5173\uff1f\/","og_locale":"en_GB","og_type":"article","og_title":"\u5982\u4f55\u7528PHP\u63a5\u5165\u8d8a\u5357\u652f\u4ed8\u7f51\u5173\uff1f","og_description":"\u4f7f\u7528PHP\u63a5\u5165\u8d8a\u5357\u652f\u4ed8\u7f51\u5173\u7684\u6307\u5357 \u8981\u4f7f\u7528PHP\u63a5\u5165\u8d8a\u5357\u652f\u4ed8\u7f51&hellip;","og_url":"https:\/\/www.deekpay.com\/en\/2025\/05\/12\/\u5982\u4f55\u7528php\u63a5\u5165\u8d8a\u5357\u652f\u4ed8\u7f51\u5173\uff1f\/","og_site_name":"DEEKPAY-\u5370\u5ea6\u539f\u751f\u652f\u4ed8|\u5370\u5ea6UPI\u652f\u4ed8|\u5370\u5ea6\u4e09\u65b9\u56db\u65b9\u652f\u4ed8","article_published_time":"2025-05-12T06:26:21+00:00","author":"deekpay","twitter_card":"summary_large_image","twitter_misc":{"Written by":"deekpay","Estimated reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.deekpay.com\/en\/2025\/05\/12\/%e5%a6%82%e4%bd%95%e7%94%a8php%e6%8e%a5%e5%85%a5%e8%b6%8a%e5%8d%97%e6%94%af%e4%bb%98%e7%bd%91%e5%85%b3%ef%bc%9f\/#article","isPartOf":{"@id":"https:\/\/www.deekpay.com\/en\/2025\/05\/12\/%e5%a6%82%e4%bd%95%e7%94%a8php%e6%8e%a5%e5%85%a5%e8%b6%8a%e5%8d%97%e6%94%af%e4%bb%98%e7%bd%91%e5%85%b3%ef%bc%9f\/"},"author":{"name":"deekpay","@id":"https:\/\/www.deekpay.com\/#\/schema\/person\/91e4e842fdd04f8c957a9f642506f51d"},"headline":"\u5982\u4f55\u7528PHP\u63a5\u5165\u8d8a\u5357\u652f\u4ed8\u7f51\u5173\uff1f","datePublished":"2025-05-12T06:26:21+00:00","dateModified":"2025-05-12T06:26:21+00:00","mainEntityOfPage":{"@id":"https:\/\/www.deekpay.com\/en\/2025\/05\/12\/%e5%a6%82%e4%bd%95%e7%94%a8php%e6%8e%a5%e5%85%a5%e8%b6%8a%e5%8d%97%e6%94%af%e4%bb%98%e7%bd%91%e5%85%b3%ef%bc%9f\/"},"wordCount":237,"commentCount":0,"publisher":{"@id":"https:\/\/www.deekpay.com\/#organization"},"articleSection":["\u8d8a\u5357\u652f\u4ed8"],"inLanguage":"en-GB","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.deekpay.com\/en\/2025\/05\/12\/%e5%a6%82%e4%bd%95%e7%94%a8php%e6%8e%a5%e5%85%a5%e8%b6%8a%e5%8d%97%e6%94%af%e4%bb%98%e7%bd%91%e5%85%b3%ef%bc%9f\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.deekpay.com\/en\/2025\/05\/12\/%e5%a6%82%e4%bd%95%e7%94%a8php%e6%8e%a5%e5%85%a5%e8%b6%8a%e5%8d%97%e6%94%af%e4%bb%98%e7%bd%91%e5%85%b3%ef%bc%9f\/","url":"https:\/\/www.deekpay.com\/en\/2025\/05\/12\/%e5%a6%82%e4%bd%95%e7%94%a8php%e6%8e%a5%e5%85%a5%e8%b6%8a%e5%8d%97%e6%94%af%e4%bb%98%e7%bd%91%e5%85%b3%ef%bc%9f\/","name":"\u5982\u4f55\u7528PHP\u63a5\u5165\u8d8a\u5357\u652f\u4ed8\u7f51\u5173\uff1f - DEEKPAY-\u5370\u5ea6\u539f\u751f\u652f\u4ed8|\u5370\u5ea6UPI\u652f\u4ed8|\u5370\u5ea6\u4e09\u65b9\u56db\u65b9\u652f\u4ed8","isPartOf":{"@id":"https:\/\/www.deekpay.com\/#website"},"datePublished":"2025-05-12T06:26:21+00:00","dateModified":"2025-05-12T06:26:21+00:00","breadcrumb":{"@id":"https:\/\/www.deekpay.com\/en\/2025\/05\/12\/%e5%a6%82%e4%bd%95%e7%94%a8php%e6%8e%a5%e5%85%a5%e8%b6%8a%e5%8d%97%e6%94%af%e4%bb%98%e7%bd%91%e5%85%b3%ef%bc%9f\/#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.deekpay.com\/en\/2025\/05\/12\/%e5%a6%82%e4%bd%95%e7%94%a8php%e6%8e%a5%e5%85%a5%e8%b6%8a%e5%8d%97%e6%94%af%e4%bb%98%e7%bd%91%e5%85%b3%ef%bc%9f\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.deekpay.com\/en\/2025\/05\/12\/%e5%a6%82%e4%bd%95%e7%94%a8php%e6%8e%a5%e5%85%a5%e8%b6%8a%e5%8d%97%e6%94%af%e4%bb%98%e7%bd%91%e5%85%b3%ef%bc%9f\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.deekpay.com\/"},{"@type":"ListItem","position":2,"name":"\u5982\u4f55\u7528PHP\u63a5\u5165\u8d8a\u5357\u652f\u4ed8\u7f51\u5173\uff1f"}]},{"@type":"WebSite","@id":"https:\/\/www.deekpay.com\/#website","url":"https:\/\/www.deekpay.com\/","name":"DEEKPAY-\u5370\u5ea6\u539f\u751f\u652f\u4ed8|\u5370\u5ea6UPI\u652f\u4ed8|\u5370\u5ea6\u4e09\u65b9\u652f\u4ed8","description":"","publisher":{"@id":"https:\/\/www.deekpay.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.deekpay.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-GB"},{"@type":"Organization","@id":"https:\/\/www.deekpay.com\/#organization","name":"DEEKPAY-\u5370\u5ea6\u539f\u751f\u652f\u4ed8\u548cUPI\u652f\u4ed8\u670d\u52a1\u5546","url":"https:\/\/www.deekpay.com\/","logo":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/www.deekpay.com\/#\/schema\/logo\/image\/","url":"https:\/\/deekpay.com\/wp-content\/uploads\/2024\/11\/LOGO-1.png","contentUrl":"https:\/\/deekpay.com\/wp-content\/uploads\/2024\/11\/LOGO-1.png","width":649,"height":191,"caption":"DEEKPAY-\u5370\u5ea6\u539f\u751f\u652f\u4ed8\u548cUPI\u652f\u4ed8\u670d\u52a1\u5546"},"image":{"@id":"https:\/\/www.deekpay.com\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.deekpay.com\/#\/schema\/person\/91e4e842fdd04f8c957a9f642506f51d","name":"deekpay","image":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/www.deekpay.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/485e931d0b237ba5cfa6c7cea419d88f7e3258b4837d99943e099ff93b458f8c?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/485e931d0b237ba5cfa6c7cea419d88f7e3258b4837d99943e099ff93b458f8c?s=96&d=mm&r=g","caption":"deekpay"},"sameAs":["https:\/\/deekpay.com"],"url":"https:\/\/www.deekpay.com\/en\/author\/deekpay\/"}]}},"_links":{"self":[{"href":"https:\/\/www.deekpay.com\/en\/wp-json\/wp\/v2\/posts\/2590","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.deekpay.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.deekpay.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.deekpay.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.deekpay.com\/en\/wp-json\/wp\/v2\/comments?post=2590"}],"version-history":[{"count":1,"href":"https:\/\/www.deekpay.com\/en\/wp-json\/wp\/v2\/posts\/2590\/revisions"}],"predecessor-version":[{"id":2591,"href":"https:\/\/www.deekpay.com\/en\/wp-json\/wp\/v2\/posts\/2590\/revisions\/2591"}],"wp:attachment":[{"href":"https:\/\/www.deekpay.com\/en\/wp-json\/wp\/v2\/media?parent=2590"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.deekpay.com\/en\/wp-json\/wp\/v2\/categories?post=2590"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.deekpay.com\/en\/wp-json\/wp\/v2\/tags?post=2590"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}