Bonjour,
j'ai le script suivant pour les remboursement Paypal et j'aimerai quand le script me retourne la réponse mettre dans des variable les paramètres retournés, en GET ou en POST ça ne me retourne rien? et plus bas ce que Paypal me retourne, j'aimerai mettre dans une variable le REFUNDTRANSACTIONID:

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
$api_request = 'USER=sb-ph43mb1573904_api1.business.example.com'
                .  '&PWD=2H8CW3P9C5FTKZYU'
                .  '&SIGNATURE=Ahiik-MviymUik2ju1GqUXqTniYDAMmKwo1TUWZUOP99G4ZagtecMWEY'
                .  '&VERSION=204.0'
                .  '&METHOD=RefundTransaction'
                .  '&rm=2'
                .  '&REFUNDTYPE=Partial'//Full'Partial
                .  '&AMT='.$prix
                .  '&TransactionID='.$transaction_id;
 
                //.  '&AMT='. $prix;
 
 
 
 
    $ch = curl_init();
    curl_setopt( $ch, CURLOPT_URL, 'https://api-3t.sandbox.paypal.com/nvp' ); // For live transactions, change to 'https://api-3t.paypal.com/nvp'
    curl_setopt( $ch, CURLOPT_VERBOSE, 1 );
 
    // Uncomment these to turn off server and peer verification
    // curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, FALSE );
    // curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, FALSE );
    curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
    curl_setopt( $ch, CURLOPT_POST, 1 );
 
    // Set the API parameters for this transaction
    curl_setopt( $ch, CURLOPT_POSTFIELDS, $api_request );
 
    // Request response from PayPal
    $response = curl_exec( $ch );
    // print_r($response);
 
    // If no response was received from PayPal there is no point parsing the response
    if( ! $response )
        die( 'Calling PayPal to change_subscription_status failed: ' . curl_error( $ch ) . '(' . curl_errno( $ch ) . ')' );
 
    curl_close( $ch );
 
    // An associative array is more usable than a parameter string
    parse_str( $response, $parsed_response );
 
    return $parsed_response;
}
$response = get_transaction_details($idtransaction,$id,$prix);
echo "<pre>"; print_r($response); echo "</pre>";
$trans=$_POST['REFUNDTRANSACTIONID'];
$trans2=$_GET['REFUNDTRANSACTIONID'];
echo $trans;
echo $trans2;
echo 'ok';
retour Paypal
[REFUNDTRANSACTIONID] => 5NP60292E8322745P
[FEEREFUNDAMT] => 0.53
[GROSSREFUNDAMT] => 7.80
[NETREFUNDAMT] => 7.27
[CURRENCYCODE] => CHF
[TOTALREFUNDEDAMOUNT] => 7.80
[TIMESTAMP] => 2020-05-19T11:40:21Z
[CORRELATIONID] => 1f2550cf915e5
[ACK] => Success
[VERSION] => 204.0
[BUILD] => 54563116
[REFUNDSTATUS] => Instant
[PENDINGREASON] => None