{"title":"Email with direct payment instructions","category":"default","creationDate":1776961627,"content":"<div class=\"sc-notice warning\"><div>\n<p><strong>Hosted Payment Pages are no longer available<\/strong><\/p>\n<p>To accept payments through an Adyen-hosted page, use our <a href=\"\/pt\/online-payments\/build-your-integration\/sessions-flow?platform=Web&amp;integration=Hosted%2BCheckout\">Hosted Checkout<\/a>.<\/p>\n<p>This page is for the classic Hosted Payment Pages (HPP) integration, which has reached end-of-life.  We are no longer processing transactions though HPP.<\/p>\n<\/div><\/div>\n<p>If you want to communicate to your customers directly with offers, you can include a direct link to the payment page in every email \u2013 with descriptions, payment amount, etc. already pre-filled.<\/p>\n<p>This means that you can generate payment links without Adyen's\u00a0intervention, even when sending out thousands of emails to your customers. \u00a0For example, if you have an offer for a cooking set as depicted below. You send out a mail to your customers and they get the following message in their mailbox:\u00a0<br \/>\n<img alt=\"\" src=\"\/user\/pages\/docs\/02.online-payments\/60.classic-integrations\/04.hosted-payment-pages\/15.email-with-direct-payment-instructions\/email-example.png\" \/><br \/>\nBy clicking the\u00a0<strong>Pay Now!<\/strong>\u00a0button, the shopper is immediately sent to the (one-page) payment screen, where all order details are already filled in. Shopper only needs to\u00a0enter their payment details.<\/p>\n<h3 id=\"when-to-use\">When to use<\/h3>\n<ul>\n<li>Marketing actions to your existing customer base<\/li>\n<li>If you have seen shoppers abandon the ordering processing<\/li>\n<\/ul>\n<p>When constructing the email your system builds a link to our payment page just as would happen in your webshop. The example below shows what such links look like:<\/p>\n<pre><code>https:\/\/test.adyen.com\/hpp\/pay.shtml?paymentAmount=8650&amp;currencyCode=EUR&amp;shipBeforeDate=2009-09-23&amp;merchantReference=TMRef1234&amp;skinCode=aF563qQs&amp;merchantAccount=YOUR_MERCHANT_ACCOUNT&amp;sessionValidity=2009-09-17T11%3A38%3A55Z&amp;merchantSig=62unnLF...ubZc%3D-&amp;shopperLocale=en_GB&amp;orderData=H4sIAAAAA.....OQBQDxrK1skQEAAA%3D%3D<\/code><\/pre>\n<div class=\"sc-notice note\"><div>\n<p>Due to restrictions of most Internet browsers, the GET URL is limited to a maximum of 1024 characters. You also need to properly\u00a0<code>urlencode<\/code>\u00a0the URL.<\/p>\n<p>Make sure that the sessionValidity value is in set sometime in the future to allow the shopper time to pay for the product since this is communicated offline (via email).<\/p>\n<\/div><\/div>\n<p>The following sample demonstrates generating a payment URL for a HPP payment form.<\/p>\n<pre><code class=\"language-php\">&lt;?php\n\/**\n* These account details can be found in CA TEST environment: https:\/\/ca-test.adyen.com\/ca\/ca\/login.shtml\n*  $skinCode:        the skin to be used\n*  $merchantAccount: the merchant account we want to process this payment with.\n*  $hmacKey:         the shared HMAC key.\n*\/\n\n    $skinCode        = \"yzrqpR13\"; \/\/ your skinCode\n    $merchantAccount = \"YOUR_MERCHANT_ACCOUNT\"; \/\/ your merchantAccount\n    $hmacKey         = \"BDF9B2857654743441D2EE15FB3EEEF2159227FE0D114C2CD31772D2785977DC\"; \/\/ your HMAC Key\n\n\/**\n* Setting the default timezone for the sessionValidity.\n*\/\n\n    date_default_timezone_set('Europe\/Amsterdam');\n\n\/**\n* Payment-specific details. Note that many more fields can be added to the paymentRequest object.\n* Please see the API Reference in the Adyen documentation for more information.\n*\/\n\n    $paymentDetailsParams = array(\n      \"merchantReference\" =&gt; \"Generated_payment_link\", \/\/ your merchant reference\n      \"merchantAccount\"   =&gt;  $merchantAccount,\n      \"currencyCode\"      =&gt; \"EUR\",\n      \"shopperReference\"  =&gt; \"YOUR_UNIQUE_SHOPPER_ID_IOfW3k9G2PvXFu2j\", \/\/ Customer ID\n      \"paymentAmount\"     =&gt; \"1234\", \/\/ paymentAmount is in minor units (e.g. 1000 = 10.00)\n      \"sessionValidity\"   =&gt; date('Y-m-d\\TH:i:s', strtotime(\"+ 2 days\")), \/\/Allows the session to be active for 2 days\n      \"skinCode\"          =&gt; $skinCode\n      );\n\n\/**\n* The following functions generate a payment URL based on the paymentRequest object.\n*\/\n\n    \/\/ The character escape function\n    $escapeval = function($val) {\n     return str_replace(':','\\\\:',str_replace('\\\\','\\\\\\\\',$val));\n    };\n\n    \/\/ Sort the array by key using SORT_STRING order\n    ksort($paymentDetailsParams, SORT_STRING);\n\n    \/\/ Generate the signing data string\n    $paymentDetailsSignData = implode(\":\", array_map($escapeval,\n                                                                array_merge( array_keys($paymentDetailsParams),\n                                                                             array_values($paymentDetailsParams)\n                                                                           )\n                                                    )\n                                      );\n    \/\/ base64-encode the binary result of the HMAC computation\n    $merchantSig = base64_encode(hash_hmac('sha256',$paymentDetailsSignData,pack(\"H*\" , $hmacKey),true));\n        $paymentDetailsParams[\"merchantSig\"] = $merchantSig;\n\n    \/\/ Generate URL\n    $paymentUrl = \"https:\/\/test.adyen.com\/hpp\/pay.shtml?\";\n    $parameterCount = 0;\n    foreach($paymentDetailsParams as $key =&gt; $value)\n    {\n      if($parameterCount == 0)\n        {\n          $paymentUrl .= $key.\"=\".urlencode($value);\n          $parameterCount++;\n        }\n        else{\n          $paymentUrl .= \"&amp;\".$key.\"=\".urlencode($value);\n        }\n    }\n    echo htmlentities($paymentUrl);\n?&gt;<\/code><\/pre>","url":"https:\/\/docs.adyen.com\/pt\/online-payments\/classic-integrations\/hosted-payment-pages\/email-with-direct-payment-instructions","articleFields":{"id":"24217218","type":"page","_expandable":{"operations":""},"status":"current","last_edit_on":"01-05-2019 10:37","parameters":{"anchor_new":"<a href=\"\/online-payments\">Online payments<\/a>","parent_page":"classic Hosted Payment Pages (HPP)"}},"algolia":{"url":"https:\/\/docs.adyen.com\/pt\/online-payments\/classic-integrations\/hosted-payment-pages\/email-with-direct-payment-instructions","title":"Email with direct payment instructions","content":"\nHosted Payment Pages are no longer available\nTo accept payments through an Adyen-hosted page, use our Hosted Checkout.\nThis page is for the classic Hosted Payment Pages (HPP) integration, which has reached end-of-life.  We are no longer processing transactions though HPP.\n\nIf you want to communicate to your customers directly with offers, you can include a direct link to the payment page in every email \u2013 with descriptions, payment amount, etc. already pre-filled.\nThis means that you can generate payment links without Adyen's\u00a0intervention, even when sending out thousands of emails to your customers. \u00a0For example, if you have an offer for a cooking set as depicted below. You send out a mail to your customers and they get the following message in their mailbox:\u00a0\n\nBy clicking the\u00a0Pay Now!\u00a0button, the shopper is immediately sent to the (one-page) payment screen, where all order details are already filled in. Shopper only needs to\u00a0enter their payment details.\nWhen to use\n\nMarketing actions to your existing customer base\nIf you have seen shoppers abandon the ordering processing\n\nWhen constructing the email your system builds a link to our payment page just as would happen in your webshop. The example below shows what such links look like:\nhttps:\/\/test.adyen.com\/hpp\/pay.shtml?paymentAmount=8650&amp;currencyCode=EUR&amp;shipBeforeDate=2009-09-23&amp;merchantReference=TMRef1234&amp;skinCode=aF563qQs&amp;merchantAccount=YOUR_MERCHANT_ACCOUNT&amp;sessionValidity=2009-09-17T11%3A38%3A55Z&amp;merchantSig=62unnLF...ubZc%3D-&amp;shopperLocale=en_GB&amp;orderData=H4sIAAAAA.....OQBQDxrK1skQEAAA%3D%3D\n\nDue to restrictions of most Internet browsers, the GET URL is limited to a maximum of 1024 characters. You also need to properly\u00a0urlencode\u00a0the URL.\nMake sure that the sessionValidity value is in set sometime in the future to allow the shopper time to pay for the product since this is communicated offline (via email).\n\nThe following sample demonstrates generating a payment URL for a HPP payment form.\n&lt;?php\n\/**\n* These account details can be found in CA TEST environment: https:\/\/ca-test.adyen.com\/ca\/ca\/login.shtml\n*  $skinCode:        the skin to be used\n*  $merchantAccount: the merchant account we want to process this payment with.\n*  $hmacKey:         the shared HMAC key.\n*\/\n\n    $skinCode        = \"yzrqpR13\"; \/\/ your skinCode\n    $merchantAccount = \"YOUR_MERCHANT_ACCOUNT\"; \/\/ your merchantAccount\n    $hmacKey         = \"BDF9B2857654743441D2EE15FB3EEEF2159227FE0D114C2CD31772D2785977DC\"; \/\/ your HMAC Key\n\n\/**\n* Setting the default timezone for the sessionValidity.\n*\/\n\n    date_default_timezone_set('Europe\/Amsterdam');\n\n\/**\n* Payment-specific details. Note that many more fields can be added to the paymentRequest object.\n* Please see the API Reference in the Adyen documentation for more information.\n*\/\n\n    $paymentDetailsParams = array(\n      \"merchantReference\" =&gt; \"Generated_payment_link\", \/\/ your merchant reference\n      \"merchantAccount\"   =&gt;  $merchantAccount,\n      \"currencyCode\"      =&gt; \"EUR\",\n      \"shopperReference\"  =&gt; \"YOUR_UNIQUE_SHOPPER_ID_IOfW3k9G2PvXFu2j\", \/\/ Customer ID\n      \"paymentAmount\"     =&gt; \"1234\", \/\/ paymentAmount is in minor units (e.g. 1000 = 10.00)\n      \"sessionValidity\"   =&gt; date('Y-m-d\\TH:i:s', strtotime(\"+ 2 days\")), \/\/Allows the session to be active for 2 days\n      \"skinCode\"          =&gt; $skinCode\n      );\n\n\/**\n* The following functions generate a payment URL based on the paymentRequest object.\n*\/\n\n    \/\/ The character escape function\n    $escapeval = function($val) {\n     return str_replace(':','\\\\:',str_replace('\\\\','\\\\\\\\',$val));\n    };\n\n    \/\/ Sort the array by key using SORT_STRING order\n    ksort($paymentDetailsParams, SORT_STRING);\n\n    \/\/ Generate the signing data string\n    $paymentDetailsSignData = implode(\":\", array_map($escapeval,\n                                                                array_merge( array_keys($paymentDetailsParams),\n                                                                             array_values($paymentDetailsParams)\n                                                                           )\n                                                    )\n                                      );\n    \/\/ base64-encode the binary result of the HMAC computation\n    $merchantSig = base64_encode(hash_hmac('sha256',$paymentDetailsSignData,pack(\"H*\" , $hmacKey),true));\n        $paymentDetailsParams[\"merchantSig\"] = $merchantSig;\n\n    \/\/ Generate URL\n    $paymentUrl = \"https:\/\/test.adyen.com\/hpp\/pay.shtml?\";\n    $parameterCount = 0;\n    foreach($paymentDetailsParams as $key =&gt; $value)\n    {\n      if($parameterCount == 0)\n        {\n          $paymentUrl .= $key.\"=\".urlencode($value);\n          $parameterCount++;\n        }\n        else{\n          $paymentUrl .= \"&amp;\".$key.\"=\".urlencode($value);\n        }\n    }\n    echo htmlentities($paymentUrl);\n?&gt;","type":"page","locale":"pt","boost":16,"hierarchy":{"lvl0":"Home","lvl1":"Online payments","lvl2":"Classic integrations for Ecommerce","lvl3":"Hosted Payment Pages","lvl4":"Email with direct payment instructions"},"hierarchy_url":{"lvl0":"https:\/\/docs.adyen.com\/pt","lvl1":"https:\/\/docs.adyen.com\/pt\/online-payments","lvl2":"https:\/\/docs.adyen.com\/pt\/online-payments\/classic-integrations","lvl3":"https:\/\/docs.adyen.com\/pt\/online-payments\/classic-integrations\/hosted-payment-pages","lvl4":"\/pt\/online-payments\/classic-integrations\/hosted-payment-pages\/email-with-direct-payment-instructions"},"levels":5,"category":"Online Payments","category_color":"green","tags":["Email","direct","payment","instructions"]},"articleFiles":{"email-example.png":"<img alt=\"\" src=\"https:\/\/docs.adyen.com\/user\/pages\/docs\/02.online-payments\/60.classic-integrations\/04.hosted-payment-pages\/15.email-with-direct-payment-instructions\/email-example.png\" \/>"}}
