{
"status": "success",
"locale": "tr",
"systemTime": 1664928813907,
"price": 1271.186440678,
"paidPrice": 1500,
"installment": 1,
"paymentId": "18319995",
"fraudStatus": 1,
"merchantCommissionRate": 18,
"merchantCommissionRateAmount": 228.813559322,
"iyziCommissionRateAmount": 60,
"iyziCommissionFee": 0.25,
"cardType": "DEBIT_CARD",
"cardAssociation": "MASTER_CARD",
"cardFamily": "Neo",
"binNumber": "589004",
"lastFourDigits": "0016",
"currency": "TRY",
"itemTransactions": [
{
"itemId": "1",
"paymentTransactionId": "19527423",
"transactionStatus": 2,
"price": 1271.186440678,
"paidPrice": 1499.999999998,
"merchantCommissionRate": 18,
"merchantCommissionRateAmount": 228.81355932,
"iyziCommissionRateAmount": 60,
"iyziCommissionFee": 0.25,
"blockageRate": 0,
"blockageRateAmountMerchant": 0,
"blockageRateAmountSubMerchant": 0,
"blockageResolvedDate": "2022-10-13 00:00:00",
"subMerchantPrice": 0,
"subMerchantPayoutRate": 0,
"subMerchantPayoutAmount": 0,
"merchantPayoutAmount": 1439.749999998,
"convertedPayout": {
"paidPrice": 1500,
"iyziCommissionRateAmount": 60,
"iyziCommissionFee": 0.25,
"blockageRateAmountMerchant": 0,
"blockageRateAmountSubMerchant": 0,
"subMerchantPayoutAmount": 0,
"merchantPayoutAmount": 1439.75,
"iyziConversionRate": 0,
"iyziConversionRateAmount": 0,
"currency": "TRY"
}
}
],
"authCode": "079519",
"phase": "AUTH",
"hostReference": "mock00027iyzihostrfn"
}
$options = new \Iyzipay\Options();
$options->setApiKey(env('APIKEY'));
$options->setSecretKey(env('SECRETKEY'));
$options->setBaseUrl(env('URL'));
$iyzico_request = new \Iyzipay\Request\CreateCheckoutFormInitializeRequest();
$iyzico_request->setConversationId($payment->id);
$iyzico_request->setPrice($payment->amount / 1.18);
$iyzico_request->setPaidPrice($payment->amount);
$iyzico_request->setCurrency(\Iyzipay\Model\Currency::TL);
$iyzico_request->setCallbackUrl(env('IYZICO_CALLBACK') . '?order=' . $payment->id);
$iyzico_request->setEnabledInstallments([2, 3, 6, 9]);
$buyer = new \Iyzipay\Model\Buyer();
$buyer->setId($buyer->id);
$buyer->setName($buyer->name);
$buyer->setSurname($buyer->surname);
$buyer->setIdentityNumber($buyer->id);
$buyer->setCity($buyer->city);
$buyer->setCountry($buyer->country);
$buyer->setEmail($buyer->email);
$buyer->setIp($_SERVER['REMOTE_ADDR']);
$buyer->setRegistrationAddress($buyer->address);
$iyzico_request->setBuyer($buyer);
$billingAddress = new \Iyzipay\Model\Address();
$billingAddress->setContactName($buyer->name);
$billingAddress->setCity($buyer->city);
$billingAddress->setCountry($buyer->country);
$billingAddress->setAddress($buyer->address);
$iyzico_request->setBillingAddress($billingAddress);
$basketItems = [];
$firstBasketItem = new \Iyzipay\Model\BasketItem();
$firstBasketItem->setId('B67832');
$firstBasketItem->setName("Name of Item");
$firstBasketItem->setCategory1("Category of Product Name");
$firstBasketItem->setItemType(\Iyzipay\Model\BasketItemType::VIRTUAL);
$firstBasketItem->setPrice($payment->amount / 1.18);
$basketItems[0] = $firstBasketItem;
$iyzico_request->setBasketItems($basketItems);
$checkoutFormInitialize = \Iyzipay\Model\CheckoutFormInitialize::create($iyzico_request, $options);
<form>
<label for="cc-num">Credit Card Number</label>
<input type="text" id="cc-num" name="cc-num" autocomplete="cc-number" x-autocompletetype="cc-number" pattern="\d*">
<label for="cc-exp-month">Expiration Month</label>
<input type="number" id="cc-exp-month" name="cc-exp-month" autocomplete="cc-exp-month" x-autocompletetype="cc-exp-month">
<label for="cc-exp-year">Expiration Year</label>
<input type="number" id="cc-exp-year" name="cc-exp-year" autocomplete="cc-exp-year" x-autocompletetype="cc-exp-year">
<label for="cvv2">CVV</label>
<input type="text" id="cvv2" name="cvv2" autocomplete="cc-csc" max="9999">
</form>
function cc_format(value) {
var v = value.replace(/\s+/g, '').replace(/[^0-9]/gi, '')
var matches = v.match(/\d{4,16}/g);
var match = matches && matches[0] || ''
var parts = []
for (i=0, len=match.length; i<len; i+=4) {
parts.push(match.substring(i, i+4))
}
if (parts.length) {
return parts.join(' ')
} else {
return value
}
}
document.querySelector('[name=card_number]').addEventListener('input', function(e) {
this.value = cc_format(this.value);
});
$paymentCard->setCardNumber(Str::replace(' ', '', $request->cc_num));