PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Mubashir Ali   PayPal Refund API   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: This is an example of PayPal Refund API
Class: PayPal Refund API
Refund part or all the amount of Paypal payment
Author: By
Last change:
Date: 12 years ago
Size: 1,794 bytes
 

Contents

Class file image Download
<?php
   
require_once('class.refund.php');

   
/**
     *
     * @author Mubashir Ali
     * saad_ali6@yahoo.com
     * @copyright GNU
     * @example example.php
     * @filesource class.refund.php
     * @version 1.0
     *
     * This PayPal API provides the functionality of Refunding Amount.
     * Credentials are omitted from here for privacy purpose. To use it credentials are compulsory to provide.
     */

    /*
     * Currency Types
     * ('USD', 'GBP', 'EUR', 'JPY', 'CAD', 'AUD')
     *
     * Refund Type
     * ('Partial', 'Full')
     *
     * Transaction ID
     * We can get the Transaction ID from IPN Response
     */

    /*
     * Partial Refund
     */
   
$aryData['transactionID'] = "xxxxxxxxxxxxxxxxx";
   
$aryData['refundType'] = "Partial"; //Partial or Full
   
$aryData['currencyCode'] = "USD";
   
$aryData['amount'] = 2.00;
   
$aryData['memo'] = "There Memo Detail entered for Partial Refund";
   
$aryData['invoiceID'] = "xxxxxxxxxx";

   
$ref = new PayPalRefund("sandbox");
   
$aryRes = $ref->refundAmount($aryData);

    if(
$aryRes['ACK'] == "Success")
        echo
"Amount Refunded Successfully";
    else
        echo
"Error Refunding Amount";

    echo
"<pre>";
   
print_r($aryRes);
    echo
"</pre>";

   
/*
     *
     * Successful Response
     *
     * REFUNDTRANSACTIONID
     * FEEREFUNDAMT
     * GROSSREFUNDAMT
     * NETREFUNDAMT
     * CURRENCYCODE
     * TIMESTAMP
     * CORRELATIONID
     * ACK
     * VERSION
     * BUILD
     */

    /*
     * Failed Refund Response
     *
     * TIMESTAMP
     * CORRELATIONID
     * ACK
     * VERSION
     * BUILD
     * L_ERRORCODE0
     * L_SHORTMESSAGE0
     * L_LONGMESSAGE0
     * L_SEVERITYCODE0
     */
?>