iyzico / iyzipay-php
iyzipay api php client
Installs: 624 394
Dependents: 24
Suggesters: 0
Security: 0
Stars: 301
Watchers: 70
Forks: 89
Open Issues: 7
Requires
- php: >=7.4.0
- ext-curl: *
Requires (Dev)
- phpunit/phpunit: ~9.6
- satooshi/php-coveralls: ~0.6.1
- dev-master
- v2.0.57
- v2.0.56
- v2.0.55
- v2.0.54
- v2.0.53
- v2.0.52
- v2.0.51
- v2.0.50
- v2.0.49
- v2.0.48
- v2.0.47
- v2.0.46
- v2.0.45
- v2.0.43
- v2.0.42
- v2.0.40
- v2.0.39
- v2.0.38
- v2.0.37
- v2.0.36
- v2.0.35
- v2.0.34
- v2.0.33
- v2.0.30
- v2.0.29
- v2.0.28
- v2.0.27
- v2.0.26
- v2.0.25
- v2.0.24
- v2.0.23
- v2.0.22
- v2.0.21
- v2.0.20
- v2.0.19
- v2.0.18
- v2.0.17
- v2.0.16
- v2.0.15
- v1.0.12
- v1.0.11
- v1.0.9
- v1.0.8
- v1.0.7
- v1.0.6
- v1.0.5
- v1.0.4
- v1.0.3
- v1.0.2
- v1.0.1
- dev-reportingPaymentIdSupport
- dev-ok-complete
- dev-ok-fixes
- dev-feature-shippingAmountExcluded
- dev-ok-pull-requests
- dev-pecco_was_removed
- dev-update_readme_file
- dev-ramazanyetis-patch-1
- dev-feature-plusInstallmentUsage
- dev-feyzullahdemir-patch-1
- dev-gitlab-ci-test
- dev-subscription-card-update
This package is not auto-updated.
Last update: 2024-11-14 13:11:41 UTC
README
You can sign up for an iyzico account at https://iyzico.com
Requirements
PHP 7.4 and later.
Note
Minimum TLS v1.2 will be supported after March 2018. Please upgrade your openssl version to minimum 1.0.1. If you have any questions, please open an issue on Github or contact us at integration@iyzico.com.
Installation
Composer
You can install the bindings via Composer. Run the following command:
composer require iyzico/iyzipay-php
To use the bindings, use Composer's autoload:
require_once('vendor/autoload.php');
Manual Installation
If you do not wish to use Composer, you can download the latest release. Then, to use the bindings, include the IyzipayBootstrap.php
file.
require_once('/path/to/iyzipay-php/IyzipayBootstrap.php');
Usage
$options = new \Iyzipay\Options(); $options->setApiKey("your api key"); $options->setSecretKey("your secret key"); $options->setBaseUrl("https://sandbox-api.iyzipay.com"); $request = new \Iyzipay\Request\CreatePaymentRequest(); $request->setLocale(\Iyzipay\Model\Locale::TR); $request->setConversationId("123456789"); $request->setPrice("1"); $request->setPaidPrice("1.2"); $request->setCurrency(\Iyzipay\Model\Currency::TL); $request->setInstallment(1); $request->setBasketId("B67832"); $request->setPaymentChannel(\Iyzipay\Model\PaymentChannel::WEB); $request->setPaymentGroup(\Iyzipay\Model\PaymentGroup::PRODUCT); $paymentCard = new \Iyzipay\Model\PaymentCard(); $paymentCard->setCardHolderName("John Doe"); $paymentCard->setCardNumber("5528790000000008"); $paymentCard->setExpireMonth("12"); $paymentCard->setExpireYear("2030"); $paymentCard->setCvc("123"); $paymentCard->setRegisterCard(0); $request->setPaymentCard($paymentCard); $buyer = new \Iyzipay\Model\Buyer(); $buyer->setId("BY789"); $buyer->setName("John"); $buyer->setSurname("Doe"); $buyer->setGsmNumber("+905350000000"); $buyer->setEmail("email@email.com"); $buyer->setIdentityNumber("74300864791"); $buyer->setLastLoginDate("2015-10-05 12:43:35"); $buyer->setRegistrationDate("2013-04-21 15:12:09"); $buyer->setRegistrationAddress("Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1"); $buyer->setIp("85.34.78.112"); $buyer->setCity("Istanbul"); $buyer->setCountry("Turkey"); $buyer->setZipCode("34732"); $request->setBuyer($buyer); $shippingAddress = new \Iyzipay\Model\Address(); $shippingAddress->setContactName("Jane Doe"); $shippingAddress->setCity("Istanbul"); $shippingAddress->setCountry("Turkey"); $shippingAddress->setAddress("Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1"); $shippingAddress->setZipCode("34742"); $request->setShippingAddress($shippingAddress); $billingAddress = new \Iyzipay\Model\Address(); $billingAddress->setContactName("Jane Doe"); $billingAddress->setCity("Istanbul"); $billingAddress->setCountry("Turkey"); $billingAddress->setAddress("Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1"); $billingAddress->setZipCode("34742"); $request->setBillingAddress($billingAddress); $basketItems = array(); $firstBasketItem = new \Iyzipay\Model\BasketItem(); $firstBasketItem->setId("BI101"); $firstBasketItem->setName("Binocular"); $firstBasketItem->setCategory1("Collectibles"); $firstBasketItem->setCategory2("Accessories"); $firstBasketItem->setItemType(\Iyzipay\Model\BasketItemType::PHYSICAL); $firstBasketItem->setPrice("0.3"); $basketItems[0] = $firstBasketItem; $secondBasketItem = new \Iyzipay\Model\BasketItem(); $secondBasketItem->setId("BI102"); $secondBasketItem->setName("Game code"); $secondBasketItem->setCategory1("Game"); $secondBasketItem->setCategory2("Online Game Items"); $secondBasketItem->setItemType(\Iyzipay\Model\BasketItemType::VIRTUAL); $secondBasketItem->setPrice("0.5"); $basketItems[1] = $secondBasketItem; $thirdBasketItem = new \Iyzipay\Model\BasketItem(); $thirdBasketItem->setId("BI103"); $thirdBasketItem->setName("Usb"); $thirdBasketItem->setCategory1("Electronics"); $thirdBasketItem->setCategory2("Usb / Cable"); $thirdBasketItem->setItemType(\Iyzipay\Model\BasketItemType::PHYSICAL); $thirdBasketItem->setPrice("0.2"); $basketItems[2] = $thirdBasketItem; $request->setBasketItems($basketItems); $payment = \Iyzipay\Model\Payment::create($request, $options);
See other samples under samples directory.
Development
Install dependencies:
composer install
Mock test cards
Test cards that can be used to simulate a successful payment:
Cross border test cards:
Test cards to get specific error codes:
Mock APM Accounts
Mock APM Accounts that can be used to simulate a payment with alternative payment method:
Testing
Install dependencies as mentioned above (which will resolve PHPUnit), then you can run the test suite:
./vendor/bin/phpunit
Or to run an individual test file:
./vendor/bin/phpunit tests/Iyzipay/Tests/Model/PaymentTest.php
Test file is testing...