Creating a recurring contract

A recurring contract is created along with a payment request, similar to a regular payment request, except the below fields to be provided in the payment session HPP form or in the API request. A recurring contract with your shopper is created with this initial transaction. 

  • The details are only stored, and the recurringDetailReference is created, if the payment is successful.
  • Shoppers are uniquely identified using the shopperReference parameter. It is important that shoppers are securely logged in on your site and that the shopperReference parameter cannot be modified by the shopper.
Name Type Required Description
shopperEmail String (error) Shopper's email address.
shopperReference String (tick) Shopper's reference for the payment transaction.
recurring Class (tick)

A container for the type of recurring contract to be retrieved.

Recurring contains the following child:

  • contract
contract String (tick)

The type of recurring contract to be used.

Types:

  • ONECLICK
    • The shopper opts to store their card details for future use. The shopper is present for the subsequent transaction, for cards the security code (CVC/CVV) is required.
  • RECURRING
    • Payment details are stored for future use. For cards, the security code (CVC/CVV) is not required for subsequent payments. This is used for shopper not present transactions.
  •  ONECLICK, RECURRING
    • Payment details are stored for future use. This allows the use of the stored payment details regardless of whether the shopper is on your site or not.

The following code examples show the creation of recurring contracts together with a payment request in JSON, FORM, and SOAP.

{
    "card" : {
        "number" : "4111111111111111",
        "expiryMonth" : "8",
        "expiryYear" : "2018",
        "cvc" : "737",
        "holderName" : "John Smith"
    },
    
    "amount" : {
        "value" : 2000,
        "currency" : "EUR"
    },
    
    "reference" : "Your Reference Here",
    "merchantAccount" : "TestMerchant",
    "shopperEmail" : "s.hopper@test.com",
    "shopperIP" : "61.294.12.12",
    "shopperReference" : "Simon Hopper",
    
    "recurring" : {
        "contract" : "RECURRING,ONECLICK"
    }
}
<?xml version="1.0"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema- instance">
  <soap:Body>
    <ns1:authorise xmlns:ns1="http://payment.services.adyen.com">
      <ns1:paymentRequest>
        <amount xmlns="http://payment.services.adyen.com">
          <currency xmlns="http://common.services.adyen.com">EUR</currency>
          <value xmlns="http://common.services.adyen.com">2000</value>
        </amount>
        <card xmlns="http://payment.services.adyen.com">
          <cvc>737</cvc>
          <expiryMonth>08</expiryMonth>
          <expiryYear>2018</expiryYear>
          <holderName>Adyen Test</holderName>
          <number>4111111111111111</number>
        </card>
        <merchantAccount xmlns="http://payment.services.adyen.com" >SupportAdyenTest</merchantAccount>
        <reference xmlns="http://payment.services.adyen.com">Your Reference Here</reference>
        <shopperEmail xmlns="http://payment.services.adyen.com">s.hopper@test.com</shopperEmail>
        <shopperIP xmlns="http://payment.services.adyen.com">61.294.12.12</shopperIP>
        <shopperReference xmlns="http://payment.services.adyen.com">Simon Hopper</shopperReference>
        <recurring>
          <contract>RECURRING,ONECLICK</contract>
        </recurring>
      </ns1:paymentRequest>
    </ns1:authorise>
  </soap:Body>
</soap:Envelope>
merchantAccount=TestMerchant&amount.value=2000&amount.currency=EUR&card.expiryYear=2018&card.cvc=737&card.number=4111111111111111&card.holderName=John+Smith&card.expiryMonth=08&reference=Your+Reference+Here&shopperReference=Simon+Hopper&shopperEmail=s.hopper%40test.com&shopperIP=61.294.12.12&recurring.contract=RECURRING,ONECLICK

Name Type Required Description
shopperEmail String (tick) Shopper's email address.
shopperReference String (tick) Shopper's reference for the payment transaction.
recurringContract String (tick)

The type of recurring contract to be used.

Types:

  • ONECLICK
    • The shopper opts to store their card details for future use. The shopper is present for the subsequent transaction, for cards the security code (CVC/CVV) is required.
  • RECURRING
    • Payment details are stored for future use. For cards, the security code (CVC/CVV) is not required for subsequent payments.
  •  ONECLICK, RECURRING
    • Payment details are stored for future use. This allows the use of the stored payment details regardless of whether the shopper is on your site or not.
<input type="hidden" name="shopperEmail" value="gras.shopper@somewhere.org" />
<input type="hidden" name="shopperReference" value="grasshopper52" />
<input type="hidden" name="recurringContract" value="RECURRING" />

When you are ready to process a subsequent payment, set the value of the selectedRecurringDetailReference to either:

  • The recurringDetailReference returned from the list of all stored recurring details based on the shopperReference provided during the recurring contract. Or

  • The word LATEST, which uses the most recently stored recurring detail.

On AUTHORISATION you receive a notification with success=”true”.