web.php
Route::get('payments/shopier/callback', [HomeController::class, 'shopierCallback']);
Route::get('/payments/shopier/onay', [HomeController::class, 'ShopierSuccess'])->name('payments.shopier.ShopierSuccess');
Controller
$shopier = new Shopier($shopiercek->paymentsid, $shopiercek->paymentskey);
$urunid =$request->input('urunid');
$adsoyad = $request->input('adsoyad');
$mail = $request->input('mail');
$telefon = $request->input('telefon');
$urunfiyat = $request->input('urunfiyat');
$random_id = "11".rand(1,999).rand(1,88)*rand(1,50);
$urun = Urunler::where('id', $urunid)->firstOrFail();
$siparisler=new Siparisler;
$siparisler->urunid=$urunid;
$siparisler->adsoyad=$adsoyad;
$siparisler->mailadres=$mail;
$siparisler->telno=$telefon;
$siparisler->siparisfiyat=$urunfiyat;
$siparisler->paytrid=$random_id;
$siparisler->durum=0;
$siparisler->save();
$buyer = new Buyer([
'id' => 101,
'name' => $adsoyad,
'surname' => ' ',
'email' => $mail,
'phone' => $telefon
]);
$address = new Address([
'address' => 'xxxxxx',
'city' => 'xxxxx',
'country' => 'xxxx',
'postcode' => 'xxxx',
]);
$params = $shopier->getParams();
$params->setBuyer($buyer);
$params->setAddress($address);
$shopier->setOrderData($random_id, '1.0');
$shopier->setProductData($urun->urunadi, ProductType::DOWNLOADABLE_VIRTUAL);
$renderer = $shopier->createRenderer(AutoSubmitFormRenderer::class);
$shopier->goWith($renderer);```
public function shopierCallback(){
$shopiercek=Payment::find(2);
$post = $_POST;
$shopierResponse = ShopierResponse::fromPostData();
if (!$shopierResponse->hasValidSignature($shopiercek->paymentskey)) {
die('Ödemeniz alınamadı');
}
$siparisler=Siparisler::where('paytrid', $post['platform_order_id'])->first();
$siparisler->durum=1;
$siparisler->save();
return redirect()->route('payments.shopier.ShopierSuccess');
}
public function ShopierSuccess(Request $request){
$config=Config::find(1);
$mail=Mails::find(1);
$whatsapp=Whatsapp::find(1);
$headerfooters=HeaderFooters::find(1);
return view("payments/shopier/onay",compact('config','whatsapp','headerfooters','mail'));
}