2014-04-28 5 views
0

J'ai intégré le paiement paypal dans mon projet.Paypal Option de remboursement par programme

Je voudrais inclure l'option de remboursement automatique.

require_once('includes/paypal.class.php'); 
require_once('includes/paypal.adaptive.class.php'); 

include('includes/config.php'); 

// Create PayPal object. 
$PayPalConfig = array(
    'Sandbox' => $sandbox, 
    'DeveloperAccountEmail' => $developer_account_email, 
    'ApplicationID' => $application_id, 
    'DeviceID' => $device_id, 
    'IPAddress' => $_SERVER['REMOTE_ADDR'], 
    'APIUsername' => $api_username, 
    'APIPassword' => $api_password, 
    'APISignature' => $api_signature, 
    'APISubject' => $api_subject 
); 

$PayPal = new PayPal_Adaptive($PayPalConfig); 

// Prepare request arrays 
$RefundFields = array(
    'CurrencyCode' => USD',            

    // Required. Must specify code used for original payment. You do not need to specify if you use a payKey to refund a completed transaction. 

    'PayKey' => '',            
    // Required. The key used to create the payment that you want to refund. 

    'TransactionID' => '7C0359353Y165821P', 

    // Required. The PayPal transaction ID associated with the payment that you want to refund. 

    'TrackingID' => ''           

    // Required. The tracking ID associated with the payment that you want to refund. 
       ); 

    $Receivers = array(); 
    $Receiver = array(
      'Email' => '[email protected]',    
      // A receiver's email address. 
      'Amount' => '100.00',         

    // Amount to be debited to the receiver's account. 
    'Primary' => '', 
    // Set to true to indicate a chained payment. Only one receiver can be a primary receiver. Omit this field, or set to false for simple and parallel payments. 

    'InvoiceID' => '', 


    'PaymentType' => 'GOODS'   

    // The transaction subtype for the payment. Allowable values are: GOODS, SERVICE 
); 

    array_push($Receivers, $Receiver); 

    $PayPalRequestData = array(
       'RefundFields' => $RefundFields, 
       'Receivers' => $Receivers 
       ); 

//print_r($PayPalRequestData);exit; 


$PayPalResult = $PayPal->Refund($PayPalRequestData); 


echo '<pre />'; 
print_r($PayPalResult); 

Ma sortie est:

2014-04-28T02: 54: 20,805 à 07: 00Failure55b35d9b576e810680030560022PLATFORMApplicationErrorApplicationThe en-tête X-PAYPAL-APPLICATION-ID contient un invalide valeurX-PAYPAL-APPLICATION-ID

+0

L'analyse de $ sandbox est-elle vraie? On dirait que l'évaluation est fausse, mais vous n'avez pas de valeur en direct définie pour l'ID d'application dans le fichier de configuration. D'une manière ou d'une autre, la valeur de votre ID d'application transmise dans l'en-tête est incorrecte. –

Répondre

0

Votre application a-t-elle été entièrement approuvée via PayPal?

Vous pouvez le vérifier de lien ci-dessous:

https://www.paypal-apps.com/user/my-account/applications

Vous pouvez utiliser ID d'application si elle a été entièrement approuvé par PayPal. Vous pouvez essayer ceci après la confirmation de l'URL ci-dessus.

Questions connexes