0
我有一個外部paiement應用服務誰照顧我的購物應用paiements。兩種方式發佈形式
我有一個表單方法發佈到服務發送數據和服務valide支付交易。
<form method="POST" action="https://paiement.systempay.fr/vads-payment/">
...
<input type="submit" name="payer" value="Payer"/></form>
</form>
我想從我的支付控制器還張貼請求方法來更新我的項目誰支付
這裏我控制器的心願我想運行時的「大戶」也是用戶點擊
public function postCheckoutCreditCard(Request $request)
{
if(!Session::has('Cart')){
return view('shop.panier');
}
$oldCart = Session::get('Cart') ;
$cart = new Cart($oldCart);
$items = $cart->items;
if(Input::get('payer')) {
// on inject le nouveau statut de la licence
foreach ($items as $item) {
$item['item']->statut_licence_id = LicenceStatut::where('id', '4')->firstOrFail()->id;
$item['item']->valid_licence_id = LicenceValid::where('id', '1')->firstOrFail()->id;
$item['item']->save();
}
$order = new Order;
$prefix = 'F';
$date = Carbon::now();
$saison = Saison::where('dt_deb', '<', $date)->where('dt_fin', '>', $date)->value('lb_saison');
$saison_deb = substr($saison, 2, 2);
$saison_fin = substr($saison, -2);
$num_facture_exist = true;
while ($num_facture_exist) {
$num_facture = $prefix . $saison_deb . $saison_fin . substr(uniqid(rand(), true), 4, 4);
if (!Order::where('num_facture', '=', $num_facture)->exists()) {
$order->num_facture = $num_facture;
$num_facture_exist = false;
}
}
$order->structure_id = Structure::where(['id' => Auth::user()->structure->id])->firstOrFail()->id;
$order->cart = serialize($cart);
$order->date_achat = Carbon::now();
$order->payment_method = 'Carte de Crédit';
$order->etat_paiement = 'Facture Réglée';
$order->save();
Auth::user()->notify(new InvoicePaid($order));
$federation = Structure::where('id', '1')->first();
Mail::to($federation->adresse_email_structure)->send(new NouvelleCommande($order));
Session::forget('Cart');
return redirect('home')->with('status', "Votre paiement à été effectué avec sucess , votre numéro de facture : . $order->num_facture est disponible dans la rubrique Mes cotisation ");
}
}
我不知道如何做到這一點。有人可以幫助我嗎?在此先感謝
您確定要這麼做嗎?如果向外部服務付款失敗怎麼辦?通常,這些服務支持在完成處理請求時獲取回調URL。 – apokryfos
是的,這正是我要做的!我會問他們。但我確定那 –
有一個服務在外部應用程序中,當payement被接受時重定向到一個url你認爲如果我把url訪問到方法public function postCheckoutCreditCard(Request $ request)它會工作? –