Paiement Paypal - Problème pour la création d'un Token

Par MozorStudio, il y a 9 ans


Bonjour,

J'ai suivi le tuto sur l'abonnement récurrent via Paypal et lorsque PayPal est censé me renvoyer un Token pour la transaction, je reçois "False"...

Avant toutes choses je tiens a préciser que j'utilise bien la version SandBox de paypal, que je dispose des bons identifiant / mot de passe / signature et que je prossède strictement de la même manière que le tutoriel.

Je pense que le problème peut venir de mon hébergement (mutualisé), peut-être n'accepte t-il pas les appels Curl ? (je suis chez OVH)

EDIT

J'ai essayé avec un autre serveur (autre que OVH) et là j'ai une réponse (négative mais j'en ai une ^^):

array(5) { ["ACK"]=> string(7) "Failure" ["L_ERRORCODE0"]=> string(5) "81002" ["L_SHORTMESSAGE0"]=> string(18) "Unspecified Method" ["L_LONGMESSAGE0"]=> string(33) "Method Specified is not Supported" ["L_SEVERITYCODE0"]=> string(5) "Error" }

EDIT 2

Pour ceux qui sont chez OVH, le problème vient OpenSSL qui est actuellement en 0.9 alors que Paypal nécessite la version 1.0 minimum.

7 réponses

celionor, il y a 9 ans

Tu as une réponse de la part de Paypal, donc l'extension "cURL" est bien activée.

celionor, il y a 9 ans

Autant pour moi, j'ai mal lu ton message au sujet de ton return false;
Tu peux nous montrer ton code ?

MozorStudio, il y a 9 ans

Oui, le voici

<?php class Paypal{ private $username; private $password; private $signature; private $sandbox; private $endpoint; public function __construct($username, $password, $signature, $sandbox = true){ $this->username = $username; $this->password = $password; $this->signature = $signature; $this->sandbox = $sandbox; $this->endpoint = "https://api-3t." . ($sandbox ? "sandbox" : "") . ".paypal.com/nvp"; } public function buy(){ $data = [ 'USER' => $this->username, 'PWD' => $this->password, 'SIGNATURE' => $this->signature, 'VERSION' => 86, 'METHOD' => "SetExpressCheckout", 'L_BILLINGTYPE0' => 'RecurringPayments', 'L_BILLINGAGREEMENTDESCRIPTION0' => 'Une description...', 'cancelUrl' => "https://localhost", 'returnUrl' => "https://localhost", ]; $curl = curl_init(); curl_setopt_array($curl, [ CURLOPT_URL => $this->endpoint, CURLOPT_RETURNTRANSFER => 1, CURLOPT_POST => 1, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_SSL_VERIFYHOST => false, CURLOPT_POSTFIELDS, http_build_query($data) ]); $response = curl_exec($curl); $responseArray = []; parse_str($response, $responseArray); curl_close($curl); } } define("PAYPAL_USERNAME", "******************"); define("PAYPAL_PASSWORD", "******************"); define("PAYPAL_SIGNATURE", "******************"); $paypal = new Paypal(PAYPAL_USERNAME, PAYPAL_PASSWORD, PAYPAL_SIGNATURE); $paypal->buy();
Giga300, il y a 9 ans
curl_setopt_array($curl, [ CURLOPT_URL => $this->endpoint, CURLOPT_RETURNTRANSFER => 1, CURLOPT_POST => 1, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_SSL_VERIFYHOST => false, CURLOPT_POSTFIELDS, http_build_query($data) ]);

après le CURLOPT_POSTSFIELDS ta mis une virgule au lieu d'un => donc tu donnes rien à Paypal d'ou le Method non supporté

MozorStudio, il y a 9 ans

Oh mon dieu ! c'est assez débile comme erreur je l'avoue. Un énorme merci à toi Giga craft ^^

ExtenZ93, il y a 9 ans

Bonjour à tous !

J'ai me permet de re-up ce topic car il est récent, j'ai un problème similaire je suis en train de tenter d'intégrer le paiement paypal sur l'un de mes sites, et je me retrouve avec une erreur :

"error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure"

Mon hébergement est effectivement un mutualisé de chez OVH avec OpenSSL 0.9 comment puis-je passer en OpenSSL 1.0 ? (si le problème vient de là...)

J'utilise cette class pour paypal : https://github.com/amirduran/duranius-paypal-rest-api-php-library

Merci d'avance pour votre réponse

EDIT : 20 minutes après (j'me fais encore les questions / réponses :/ ) pour ceux que ça intéresse :

https://www.ovh.com/ca/fr/g2149.modifier_lenvironnement_dexecution_de_mon_hebergement_web

There is the solution.

Giga300, il y a 9 ans

Ta un certificat SSL/TLS sur ton mutualisé ExtenZ93 ?