alt

Important information

The API reference is now available here.
The deprecated API reference is available here.

Unzer

Migrate to Unzer PHP SDK

Migrate from old heidelpay PHP SDK to the new Unzer PHP SDK.

About the migration

The new Unzer PHP SDK works the same as the old heidelpay PHP SDK, except for changes in:

  • Class names
  • Method names
  • Payment type names
  • Deprecated code
  • UI components

Migrate to Unzer PHP SDK

To migrate to the new Unzer PHP SDK, you need to update the code in your project. To see the all PHP SDK migration changes, go here.

To migrate from the latest version of the old heidelpay PHP SDK to the new Unzer PHP SDK, implement the following changes (in any order).

Update your composer.json file

In your composer.json file:

  • Change heidelpay/heidelpay-php to unzerdev/php-sdk.

Replace class and method names

In your project, replace the names of classes and methods.

This table shows examples of changes that you need to make:

ElementOldNew
Namespace root for all classesheidelpayPHPUnzerSDK
Class namesHeidelpay
HeidelpayApiException
Unzer
UnzerApiException
Method namesgetHeidelpay
getHeidelpayObject
getUnzer
getUnzerObject
Environment service...\EnvironmentService::getMgwEnvironment...\EnvironmentService::getPAPIEnvironment
Environment variablesHEIDELPAY_MGW
HEIDELPAY_MGW_ENV
UNZER_PAPI
UNZER_PAPI_ENV
fetchDirectDebitInstallmentPlansfetchDirectDebitInstallmentPlansfetchInstallmentPlans
Constants in \UnzerSDK\Constants\ApiResponseCodesAPI_ERROR_IVF_REQUIRES_CUSTOMER
API_ERROR_IVF_REQUIRES_BASKET
API_ERROR_FACTORING_REQUIRES_CUSTOMER
API_ERROR_FACTORING_REQUIRES_BASKET

This example shows how these changes apply to your payment integration:

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

$paypal = new heidelpayPHP\Resources\PaymentTypes\Paypal();
$paypal = $heidelpay->createPaymentType($paypal);
$unzer = new UnzerSDK\Unzer('s-priv-xxxxxxxxxx');

$paypal = new UnzerSDK\Resources\PaymentTypes\Paypal();
$paypal = $unzer->createPaymentType($paypal);

Replace payment type names

Replace the following payment type names:

OldNew
InvoiceGuaranteedInvoiceSecured
InvoiceFactoringInvoiceSecured
SepaDirectDebitGuaranteedSepaDirectDebitSecured
HirePurchaseDirectDebitInstallmentSecured

Basket
To implement basket, use the UnzerSDK\Resources\Basket class.

Replace the deprecated code

In your project, replace any code marked as deprecated in the heidelpay PHP SDK.

The below list is based on the latest version of the old heidelpay PHP SDK:

Old methodNew method
heidelpayPHP\Resources\Basket::getAmountTotal...\Basket::getAmountTotalGross
heidelpayPHP\Resources\Basket::setAmountTotal...\Basket::setAmountTotalGross
heidelpayPHP\Resources\PaymentTypes\Card::getHolder...\Card::getCardHolder
heidelpayPHP\Resources\PaymentTypes\Card::setHolder...\Card::setCardHolder
heidelpayPHP\Resources\Customer::__constructUse CustomerFactory instead
heidelpayPHP\Resources\Payment::cancel
heidelpayPHP\Resources\Payment::cancelAllCharges
heidelpayPHP\Resources\Payment::cancelAuthorization
...\Payment::cancelAmount
Old constantNew constant
heidelpayPHP\Constants\ApiResponseCodes
::API_ERROR_AUTHORIZE_ALREADY_CANCELLED
UnzerSDK\Constants\ApiResponseCodes
API_ERROR_ALREADY_CANCELLED
heidelpayPHP\Constants\ApiResponseCodes
::API_ERROR_CHARGE_ALREADY_CHARGED_BACK
UnzerSDK\Constants\ApiResponseCodes
API_ERROR_ALREADY_CHARGED_BACK
heidelpayPHP\Constants\ApiResponseCodes
::API_ERROR_BASKET_ITEM_IMAGE_INVALID_EXTENSION
Removed
heidelpayPHP\Services\EnvironmentService
::ENV_VAR_NAME_DISABLE_TEST_LOGGING
ENV_VAR_NAME_VERBOSE_TEST_LOGGING
ATTENTION: This has the opposite effect.

Update your UI components

To update your UI components, go here.