Classic-integration icon

Email with direct payment instructions

Hosted Payment Pages are no longer available

To accept payments through an Adyen-hosted page, use our Hosted Checkout.

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.

If you want to communicate to your customers directly with offers, you can include a direct link to the payment page in every email – with descriptions, payment amount, etc. already pre-filled.

This means that you can generate payment links without Adyen's intervention, even when sending out thousands of emails to your customers.  For 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: 

By clicking the Pay Now! button, the shopper is immediately sent to the (one-page) payment screen, where all order details are already filled in. Shopper only needs to enter their payment details.

When to use

  • Marketing actions to your existing customer base
  • If you have seen shoppers abandon the ordering processing

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:

https://test.adyen.com/hpp/pay.shtml?paymentAmount=8650&currencyCode=EUR&shipBeforeDate=2009-09-23&merchantReference=TMRef1234&skinCode=aF563qQs&merchantAccount=YOUR_MERCHANT_ACCOUNT&sessionValidity=2009-09-17T11%3A38%3A55Z&merchantSig=62unnLF...ubZc%3D-&shopperLocale=en_GB&orderData=H4sIAAAAA.....OQBQDxrK1skQEAAA%3D%3D

Due to restrictions of most Internet browsers, the GET URL is limited to a maximum of 1024 characters. You also need to properly urlencode the URL.

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).

The following sample demonstrates generating a payment URL for a HPP payment form.

<?php
/**
* These account details can be found in CA TEST environment: https://ca-test.adyen.com/ca/ca/login.shtml
*  $skinCode:        the skin to be used
*  $merchantAccount: the merchant account we want to process this payment with.
*  $hmacKey:         the shared HMAC key.
*/

    $skinCode        = "yzrqpR13"; // your skinCode
    $merchantAccount = "YOUR_MERCHANT_ACCOUNT"; // your merchantAccount
    $hmacKey         = "BDF9B2857654743441D2EE15FB3EEEF2159227FE0D114C2CD31772D2785977DC"; // your HMAC Key

/**
* Setting the default timezone for the sessionValidity.
*/

    date_default_timezone_set('Europe/Amsterdam');

/**
* Payment-specific details. Note that many more fields can be added to the paymentRequest object.
* Please see the API Reference in the Adyen documentation for more information.
*/

    $paymentDetailsParams = array(
      "merchantReference" => "Generated_payment_link", // your merchant reference
      "merchantAccount"   =>  $merchantAccount,
      "currencyCode"      => "EUR",
      "shopperReference"  => "YOUR_UNIQUE_SHOPPER_ID_IOfW3k9G2PvXFu2j", // Customer ID
      "paymentAmount"     => "1234", // paymentAmount is in minor units (e.g. 1000 = 10.00)
      "sessionValidity"   => date('Y-m-d\TH:i:s', strtotime("+ 2 days")), //Allows the session to be active for 2 days
      "skinCode"          => $skinCode
      );

/**
* The following functions generate a payment URL based on the paymentRequest object.
*/

    // The character escape function
    $escapeval = function($val) {
     return str_replace(':','\\:',str_replace('\\','\\\\',$val));
    };

    // Sort the array by key using SORT_STRING order
    ksort($paymentDetailsParams, SORT_STRING);

    // Generate the signing data string
    $paymentDetailsSignData = implode(":", array_map($escapeval,
                                                                array_merge( array_keys($paymentDetailsParams),
                                                                             array_values($paymentDetailsParams)
                                                                           )
                                                    )
                                      );
    // base64-encode the binary result of the HMAC computation
    $merchantSig = base64_encode(hash_hmac('sha256',$paymentDetailsSignData,pack("H*" , $hmacKey),true));
        $paymentDetailsParams["merchantSig"] = $merchantSig;

    // Generate URL
    $paymentUrl = "https://test.adyen.com/hpp/pay.shtml?";
    $parameterCount = 0;
    foreach($paymentDetailsParams as $key => $value)
    {
      if($parameterCount == 0)
        {
          $paymentUrl .= $key."=".urlencode($value);
          $parameterCount++;
        }
        else{
          $paymentUrl .= "&".$key."=".urlencode($value);
        }
    }
    echo htmlentities($paymentUrl);
?>