Skip to main content

Recurring payments

Lots of shops want to accept payments in recurring intervals without the cardholder having to reenter his/her credit card information. This is ideal for dating services (to charge monthly fees) or mobile phone companies (to add talk time when a limit is exceeded). This logic is applicable in many instances – but in general it's a way for the merchant to store the cardholders' payment card information without having to be PCI certified (as ePay is).

At ePay, recurring payments are called subscriptions. The idea is to create a subscription with ePay. From this subscription several transactions can be made. Finally, when the cardholder terminates the subscription at the merchant, the subscription to ePay is deleted.

IP address

Add your IP address under API/Webservices -> Access in your ePay administration to complete recurring payments.

The subscription life cycle

The subscription goes through these steps:

Step 1

The card holder enters his/her credit card information, which is cleared up against the acquirer (via ePay). This is done through the ePay payment window. The parameter named subscription must be set to the value 1 and the parameter named subscriptiontype must be set to "recurring". This tells ePay that this transaction is to be made as a subscription and that ePay has to store the credit card information for creating recurring payments.



The parameter amount can be set to 0 when no initial payment should be made.

<script charset="UTF-8" src="" type="text/javascript"></script>
<script type="text/javascript">
paymentwindow = new PaymentWindow({
'amount': "10095",
'currency': "DKK",
'subscription': "1",
'subscriptiontype': "recurring"
<input onclick="javascript:" type="button" value="Go to payment">

Step 2

ePay stores the credit card information and returns a reference for the credit card to the merchant. This reference is named subscription ID. The parameter named subscriptionid has the value of this reference. It is returned as GET-parameter on the accepturl and the callbackurl.

Step 3

The value of the parameter must be stored in the merchant system with the other customer information. When it is time for the merchant to accept money from the card holder (e.g. the first day in a month), the following operations are made:

a. The merchant system calls the ePay web service function named authorize. Here the reference named subscriptionid is added as parameter in order to create a transaction on behalf of the credit card information stored in ePay.

PHP example

$epay_params = array();
$epay_params['merchantnumber'] = "ENTER YOUR MERCHANT NUMBER HERE";
$epay_params['subscriptionid'] = "ENTER THE SUBSCRIPTIONID RETURNED FROM EPAY HERE";
$epay_params['orderid'] = "1234";
$epay_params['amount'] = "9995";
$epay_params['currency'] = "208";
$epay_params['instantcapture'] = "0";
$epay_params['fraud'] = "0";
$epay_params['transactionid'] = "-1";
$epay_params['pbsresponse'] = "-1";
$epay_params['epayresponse'] = "-1";

$client = new SoapClient('');

$result = $client->authorize($epay_params);

if($result->authorizeResult == true)
$transactionid = $result->transactionid;
//Error - see pbsresponse and epayresponse

b. ePay replies on success with a unique reference to the transaction named transactionid.

c. The merchant system then captures the transaction by calling the ePay payment webservice with the transactionid as a parameter. Please notice that the parameter instantcapture can be set on step "a" which means that this step "c" can be skipped. Please notice: The instantcapture parameter can only be used if the merchant receives the product/service immediately.

$epay_params = array();

$epay_params['merchantnumber'] = "ENTER YOUR MERCHANT NUMBER HERE";
$epay_params['transactionid'] = "ENTER THE TRANSACTIONID HERE";
$epay_params['amount'] = "9995";
$epay_params['pbsResponse'] = "-1";
$epay_params['epayresponse'] = "-1";
$client = new SoapClient('');
$result = $client->capture($epay_params);
if($result->captureResult == true)
//Capture OK
//Error - see pbsResponse and epayresponse

Step 4

To terminate a subscription, the merchant system calls the web service function named deletesubscription on the subscription web service. All credit card information is deleted in ePay's system, and no more recurring payments can be made on the subscription.

When the card expires

When the credit card expires, the cardholder has to create a new subscription. Follow these steps:

  1. The merchant system calls the function deletesubscription on the subscription web service. The reference named subscriptionid is added as a parameter in order to tell ePay's system which subscription is to be deleted.

  2. The merchant system then deletes the reference to the subscription in its own system.

  3. The merchant system now tells the card holder to enter his/her credit card information in the payment window. Step number 1 in the section above is repeated to create a new subscription