Anda dapat mendaftar akun iyzico di https://iyzico.com
PHP 7.4 dan yang lebih baru.
TLS minimum v1.2 akan didukung setelah Maret 2018. Harap tingkatkan versi openssl Anda ke minimum 1.0.1. Jika Anda memiliki pertanyaan, silakan buka terbitan di Github atau hubungi kami di [email protected].
Anda dapat menginstal binding melalui Composer. Jalankan perintah berikut:
composer require iyzico/iyzipay-php
Untuk menggunakan binding, gunakan autoload Composer:
require_once ( ' vendor/autoload.php ' );
Jika Anda tidak ingin menggunakan Composer, Anda dapat mendownload rilis terbaru. Kemudian, untuk menggunakan binding, sertakan file IyzipayBootstrap.php
.
require_once ( ' /path/to/iyzipay-php/IyzipayBootstrap.php ' );
$ 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 protected] " );
$ 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 );
Lihat sampel lain di bawah direktori sampel.
Instal dependensi:
composer install
Kartu uji yang dapat digunakan untuk mensimulasikan pembayaran yang berhasil :
Nomor Kartu | Bank | Jenis Kartu |
---|---|---|
5890040000000016 | Akbank | Kartu Master (Debit) |
5526080000000006 | Akbank | Kartu Master (Kredit) |
4766620000000001 | Denizbank | Visa (Debit) |
4603450000000000 | Bank Deniz | Visa (Kredit) |
4729150000000005 | Bonus Denizbank | Visa (Kredit) |
4987490000000002 | bank keuangan | Visa (Debit) |
5311570000000005 | bank keuangan | Kartu Master (Kredit) |
9792020000000001 | bank keuangan | Troy (Debit) |
9792030000000000 | bank keuangan | Troy (Kredit) |
5170410000000004 | Garanti Bankasi | Kartu Master (Debit) |
5400360000000003 | Garanti Bankasi | Kartu Master (Kredit) |
374427000000003 | Garanti Bankasi | American Express |
4475050000000003 | Bank Halk | Visa (Debit) |
5528790000000008 | Bank Halk | Kartu Master (Kredit) |
4059030000000009 | Bank HSBC | Visa (Debit) |
5504720000000003 | Bank HSBC | Kartu Master (Kredit) |
5892830000000000 | Türkiye İş Bankasi | Kartu Master (Debit) |
4543590000000006 | Türkiye İş Bankasi | Visa (Kredit) |
4910050000000006 | Vakıfbank | Visa (Debit) |
4157920000000002 | Vakıfbank | Visa (Kredit) |
5168880000000002 | Yapı dan Kredi Bankası | Kartu Master (Debit) |
5451030000000000 | Yapı dan Kredi Bankası | Kartu Master (Kredit) |
Kartu ujian lintas batas :
Nomor Kartu | Negara |
---|---|
4054180000000007 | Non-Turki (Debit) |
5400010000000004 | Non-Turki (Kredit) |
Kartu uji untuk mendapatkan kode kesalahan tertentu:
Nomor Kartu | Keterangan |
---|---|
5406670000000009 | Berhasil tetapi tidak dapat dibatalkan, dikembalikan, atau dikirim autentikasi |
411111111111129 | Dana tidak mencukupi |
4129111111111111 | Jangan menghormati |
4128111111111112 | Transaksi tidak valid |
4127111111111113 | Kartu hilang |
4126111111111114 | Kartu curian |
4125111111111115 | Kartu kadaluarsa |
4124111111111116 | Cvc2 tidak valid |
4123111111111117 | Tidak diizinkan untuk pemegang kartu |
412211111111118 | Tidak diizinkan ke terminal |
4121111111111119 | Tersangka penipuan |
4120111111111110 | Kartu penjemputan |
413011111111118 | Kesalahan umum |
413111111111117 | Berhasil tetapi mdStatus adalah 0 |
4141111111111115 | Berhasil tetapi mdStatus adalah 4 |
4151111111111112 | Inisialisasi 3dsecure gagal |
Akun Mock APM yang dapat digunakan untuk mensimulasikan pembayaran dengan metode pembayaran alternatif:
Nama Pemilik Rekening | Keterangan |
---|---|
kesuksesan | Pembayaran berhasil setelah inisialisasi berhasil |
gagal-setelah-init | Pembayaran gagal setelah inisialisasi berhasil |
kesalahan | Gagal inisialisasi |
Instal dependensi seperti yang disebutkan di atas (yang akan menyelesaikan PHPUnit), lalu Anda dapat menjalankan test suite:
./vendor/bin/phpunit
Atau untuk menjalankan file pengujian individual:
./vendor/bin/phpunit tests/Iyzipay/Tests/Model/PaymentTest.php
File pengujian sedang menguji...