PHP simplified Adyen library
, (*1)
Description
This library is a simplified library to work with the adyen-php-api-library, (*2)
Getting Started
Make sure you have an Adyen account. You can make an account here. Configure a payment skin under your settings with all needed payment options., (*3)
DISCLAIMER
The ownership of the content of the Adyen API Library remains with Bitworkz. The content of the Adyen Library may only be used in connection with the services of Adyen and subject to the applicable license (MIT, the “License”), a copy of which is included in the library.
Unless required by applicable law or agreed to in writing, the library is offered and/or distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. Bitworkz does not warrant that the library or any content will be available uninterrupted or error free, that defects will be corrected, or that the library or its supporting systems are free of viruses or bugs. Please refer to the License for the specific language governing permissions and limitations under the License., (*4)
Documentation
http://adyen.github.io/adyen-php-api-library/, (*5)
Installation
You can use Composer or simply Download the Release, (*6)
Composer
The preferred method is via composer. Follow the
installation instructions if you do not already have
composer installed., (*7)
Once composer is installed, execute the following command in your project root to install this library:, (*8)
composer require bitworkz/adyen
Examples
List all available payment methods:, (*9)
$adyen = new Adyen();
$adyen
->setAmount('10')
->setCountryCode('BE')
->setCurrency('EUR')
->setEnvironment('test')
->setHmacCode('[HMAC-of-your-skin]')
->setLocale('nl_BE')
->setMerchant('[your-merchant-code]')
->setMerchantReference('Get payment methods')
->setSkinCode('[your-skin-code]');
$adyenPaymentMethods = $adyen->listPaymentMethods();
Make a payment with credit card:, (*10)
$adyen = new Adyen();
$adyen
->setWsUser('[your-ws-user]')
->setWsPassword('[your-ws-user-password]')
->setAmount('10')
->setCurrency('EUR')
->setMerchant('[your-merchant-code]')
->setClientEmail('[client-email]')
->setClientReference('Client123')
->setPaymentReference('Order123')
->setEncryptedData('[encrypted-payment-data]')
->setAuthUrl('https://pal-test.adyen.com/pal/servlet/Payment/v25/authorise')
;
$paymentResult = $adyen->pay();
Information about encrypting the form data can be found here, (*11)
Generate a payment form for bank transfer payment method:, (*12)
$adyen = new Adyen();
$adyen
->setAmount('10')
->setCurrency('EUR')
->setHmacCode('[your-skins-hmac-code]')
->setLocale('nl_BE')
->setMerchant('[your-merchant-code]')
->setClientEmail('[client-email]')
->setClientReference('client123')
->setResultUrl('http://www.url-to-return-after-payment.com')
->setBrandCode('directEbanking')
->setMerchantReference('order123')
->setSkinCode('[your-skin-code]')
;
$paymentForm = $adyen->generatePaymentForm();
Make a refund, (*13)
$adyen = new Adyen();
$adyen
->setMerchant('[your-merchant-code]')
->setWsUser('[your-ws-user]')
->setWsPassword('[your-ws-user-password]')
->setEnvironment('test')
->setAmount('10')
->setCurrency('EUR')
->setPayId('[adyen-payment-id]')
->setMerchantReference('order123')
->setRefundUrl('https://pal-test.adyen.com/pal/Payment.wsdl')
;
$result = $adyen->refund();