Browse Source

Système de paiement

Mise en place d'un système de paiement via Paypal.
master
keun 8 years ago
parent
commit
336dee7ad7
2 changed files with 17 additions and 1 deletions
  1. +15
    -1
      backend/controllers/PaiementController.php
  2. +2
    -0
      backend/views/paiement/index.php

+ 15
- 1
backend/controllers/PaiementController.php View File

'access' => [ 'access' => [
'class' => AccessControl::className(), 'class' => AccessControl::className(),
'rules' => [ 'rules' => [
[
'actions' => ['ipn'],
'allow' => true,
'roles' => ['?'],
],
[ [
'allow' => true, 'allow' => true,
'roles' => ['@'], 'roles' => ['@'],
public function actionIpn() public function actionIpn()
{ {
if (isset($_POST)) { if (isset($_POST)) {
$ipn = new PayPal_Ipn(true);
$ipn = new PayPal_Ipn(false);
if ($ipn->init()) if ($ipn->init())
{ {
/* Get any key/value */ /* Get any key/value */
/* /*
Add your code here Add your code here
*/ */
$message = '' ;

foreach($_POST as $key => $val) {
$message .= $key.' : '.$val."\n" ;
}

mail('guillaume.bourgeois13@laposte.net','Données IPN', $message) ;
} }
} }
/* Enable again if you use it */ /* Enable again if you use it */

+ 2
- 0
backend/views/paiement/index.php View File

<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" target="_top"> <form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick"> <input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="K96K2WLBSBDSA"> <input type="hidden" name="hosted_button_id" value="K96K2WLBSBDSA">
<input name="custom" value="<?php echo Yii::$app->user->identity->id; ?>" type="hidden" />
<input type="image" src="https://www.paypalobjects.com/fr_FR/FR/i/btn/btn_subscribeCC_LG.gif" border="0" name="submit" alt="PayPal, le réflexe sécurité pour payer en ligne"> <input type="image" src="https://www.paypalobjects.com/fr_FR/FR/i/btn/btn_subscribeCC_LG.gif" border="0" name="submit" alt="PayPal, le réflexe sécurité pour payer en ligne">
<img alt="" border="0" src="https://www.paypalobjects.com/fr_FR/i/scr/pixel.gif" width="1" height="1"> <img alt="" border="0" src="https://www.paypalobjects.com/fr_FR/i/scr/pixel.gif" width="1" height="1">
</form> </form>
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" target="_top"> <form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick"> <input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="USASPWAC39S4N"> <input type="hidden" name="hosted_button_id" value="USASPWAC39S4N">
<input name="custom" value="<?php echo Yii::$app->user->identity->id; ?>" type="hidden" />
<input type="image" src="https://www.sandbox.paypal.com/fr_FR/FR/i/btn/btn_subscribeCC_LG.gif" border="0" name="submit" alt="PayPal, le réflexe sécurité pour payer en ligne"> <input type="image" src="https://www.sandbox.paypal.com/fr_FR/FR/i/btn/btn_subscribeCC_LG.gif" border="0" name="submit" alt="PayPal, le réflexe sécurité pour payer en ligne">
<img alt="" border="0" src="https://www.sandbox.paypal.com/fr_FR/i/scr/pixel.gif" width="1" height="1"> <img alt="" border="0" src="https://www.sandbox.paypal.com/fr_FR/i/scr/pixel.gif" width="1" height="1">
</form> </form>

Loading…
Cancel
Save