Bonjour
j'ai créer une page php qui permet la payement avec paypal. j'ai créer le compte developper.paypal.
Le problème est avec ma fonction $curl=curl_unit(); il a pas voulu l'accepter.
-voila mon code. Pourriez vous m'aider s'il vous plait. merci
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
 
<html>
<head>
<?php
//paypal subscription
$paypal=new paypalsubscription(PAYPAL_USERNAME,PAYPAL_PASSWORD,PAYPAL_SIGNATURE);
$paypal->subscribe("20"); // je veux envoyer un montant de 20$
class paypalsubscription
{
 
	private $user = 'morched_89-facilitator_api1.hotmail.com';//'wizzign-facilitator_api1.gmail.com';
    private $pwd = 'QC5B2XZ4J449QU7K';//'68JL2T8WSUE6QTBZ';
    private $signature = 'AFcWxV21C7fd0v3bYYYRCpSSRl31Ap8vZ5jyBUKXY58Dl7ADiMT8Q9q8';//'AFcWxV21C7fd0v3bYYYRCpSSRl31A7Vm53t7ru8w8r86zYtuI-ljqAMY';
    public $endpoint = 'https://api-3t.sandbox.paypal.com/nvp';
    public $errors = array();
	private $endpoint;
	public function __construct($user=false, $pwd=false, $signature=false,$sandbox=true)//, $prod=false   // =false a supprimer
	{
		 $this->user=$user;
		$this->pwd=$pwd;
		$this->signature=$signature;
		$this->endpoint="https://api-3t.".($sandbox? "sandbox.": "")."paypal.com/nvp";
		$this->sandbox=$sandbox;
 
	}
 
 
 
public function subscribe()
{	
}
 
$curl=curl_init();
$data=['USER'=>$this.user, 'PWD'=>$this->pwd,'SIGNATURE'=>$this->signature,'METHOD'=>'SetExpressChekout','VERSION'=>86,
		'L_BILLINGTYPE0'=>'RecurringPayements',
		'L_BILLINGAGREEMENTDESCRIPTION'=>"payer",
		'PAYEMENTREQUEST_0_AMT'=>20,//price montant a envoyer
		'PAYEMENTREQUEST_0_TAXAMT'=>20*0.15,
		'PAYEMENTREQUEST_0_CURRENCYCODE'=>'CAD',
		//'http:www.yourdomain.com/cancel.html'=>'http://www.yourdomain.com/cancel.html'
		'cancelUrl'=>'http://localhost:8080/subscribe.php',
		'returnUrl'=>'http://localhost:8080/process.php'
 
]
$curl_setopt_array($curl,[
CURLOPT_URL=>$this->endpoint,
CURLOPT_RETURNTRANSFER=>1,
CURLOPT_POST=>1,
CURLOPT_POSTFIELDS=>http_build_query($data)
 
]);
$response=curl_exec($curl);
$responseArray=[];
parse_str($response,$responseArray);
$token=$responseArray['TOKEN']
$url="https://www.".($this->sandbox?"sandbox.":"")."paypal.com.cgi-bin/webscr?cmd=_express-chekout&token=$token";
header('location:'.$url);
//var_dump($responseArray);
 
 
 
 
 
}
 
 
?>
</head>
<body>
<form action="" method="post">
	<button class="btn">ffff</button>
</form>
</body>
</html>