Enable Recurring Payment

The SDK allows activation of recurring payment for the following payment types:

  • Card (Credit Card and Debit Card)
  • PayPal
  • Unzer Direct Debit Secured

You can learn more about the basics of recurring payments here.

To activate recurring for a payment type, you need to call activateRecurring and to pass along a returnUrl in the shop to witch the customer will be redirected after performing actions outside the shop (e.g. authorizing a PayPal payment).

When activating recurring, an object of type heidelpayPHP\Resources\Recurring is returned which has the property redirectUrl. If this URL is not empty you need to redirect the customer to it so he or she can authenticate the payment.

If all has been successful the method isRecurring of the payment type should return true.

// Activate Recurring for Card

$heidelpay = new \heidelpayPHP\Heidelpay('s-priv-xxxxxxxxxx');

$card = $heidelpay->fetchPaymentType('s-crd-9wmri5mdlqps');

/** @var heidelpayPHP\Resources\Recurring $recurring */
$recurring = $card->activateRecurring('https://dev.heidelpay.com');
// Check if Recurring is active

$heidelpay = new \heidelpayPHP\Heidelpay('s-priv-xxxxxxxxxx');

$card = $heidelpay->fetchPaymentType('s-crd-9wmri5mdlqps');

$recurringActive = $card->isRecurring();
Parametrer Type Description
returnUrl string The URL the API leads the customer to after he finished entering payment information outside of the shop (e.g. PayPal).
This needs to be set to a valid URL, no matter whether a redirect is necessary or not.
Required: Card with 3Dsecure and PayPal
Special treatment of Unzer Direct Debit
With Unzer Direct Debit recurring is activated automatically when a charge has been successful.