Konu iyice dağıldı 😃
Ödemeyi manuel test ediyorum şuanda ödeme İyzico sistemine yansıyor fakat bana geri dönüş yaptığın da sadece Token geliyor başka hiç bir şey gelmiyor ben tam olarak nerede hata yapıyorum ?
Rotalarım
Route::post('create-checkout-session', [\App\Http\Controllers\PaymentController::class, 'store']);
Route::post('/payment/callback', [\App\Http\Controllers\PaymentController::class, 'callback']);
Controller
<?php
namespace App\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Iyzipay\Model\Address;
use Iyzipay\Model\BasketItem;
use Iyzipay\Model\BasketItemType;
use Iyzipay\Model\Buyer;
use Iyzipay\Model\CheckoutFormInitialize;
use Iyzipay\Model\Currency;
use Iyzipay\Model\Locale;
use Iyzipay\Model\PaymentCard;
use Iyzipay\Model\PaymentGroup;
use Iyzipay\Options;
use Iyzipay\Request\CreateCheckoutFormInitializeRequest;
class PaymentController extends Controller
{
//
public function callback(Request $request) {
$status = $request->all();
if ($status === 'success') {
dd('ödeme başarılı');
return view('payment.success');
} else {
dd($status);
return view('payment.fail');
}
}
public function store(Request $request2){
$options = new Options();
$options->setApiKey('sandbox-');
$options->setSecretKey('sandbox-');
$options->setBaseUrl('https://sandbox-api.iyzipay.com');
$request = new CreateCheckoutFormInitializeRequest();
$request->setLocale(Locale::TR);
$request->setConversationId("123456789");
$request->setPrice("0.3");
$request->setPaidPrice("50");
$request->setCurrency(Currency::TL);
$request->setBasketId("B67832");
$request->setPaymentGroup(PaymentGroup::PRODUCT);
$request->setCallbackUrl(url("/payment/callback"));
$request->setEnabledInstallments(array(2, 3, 6, 9));
$buyer = new Buyer();
$buyer->setId("BY789");
$buyer->setName("Sezer");
$buyer->setSurname("Esim");
$buyer->setGsmNumber("+905380000000");
$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 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 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 BasketItem();
$firstBasketItem->setId("BI0101");
$firstBasketItem->setName("Binocular");
$firstBasketItem->setCategory1("Collectibles");
$firstBasketItem->setCategory2("Accessories");
$firstBasketItem->setItemType(BasketItemType::PHYSICAL);
$firstBasketItem->setPrice("0.3");
$basketItems[0] = $firstBasketItem;
$request->setBasketItems($basketItems);
$checkoutFormInitialize = CheckoutFormInitialize::create($request, $options);
$paymentinput = $checkoutFormInitialize->getCheckoutFormContent();
return view('pricing.show',compact('paymentinput'));
}
}