Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can refund using a Void if the transaction hasn't settled. For longer term transactions, like a month ago, you need to do a credit. Here is the void code:</p> <pre><code> using System; using PayPal.Payments.Common; using PayPal.Payments.Common.Utility; using PayPal.Payments.DataObjects; using PayPal.Payments.Transactions; namespace PayPal.Payments.Samples.CS.DataObjects.BasicTransactions { /// &lt;summary&gt; /// This class uses the Payflow SDK Data Objects to do a simple Void transaction. /// The request is sent as a Data Object and the response received is also a Data Object. /// &lt;/summary&gt; public class DOVoid { public DOVoid() { } public static void Main(string[] Args) { Console.WriteLine("------------------------------------------------------"); Console.WriteLine("Executing Sample from File: DOVoid.cs"); Console.WriteLine("------------------------------------------------------"); // Create the Data Objects. // Create the User data object with the required user details. //UserInfo User = new UserInfo("&lt;user&gt;", "&lt;vendor&gt;", "&lt;partner&gt;", "&lt;password&gt;"); UserInfo User = new UserInfo("xxx", Xxx", "paypal", "password"); // Create the Payflow Connection data object with the required connection details. // The PAYFLOW_HOST property is defined in the App config file. PayflowConnectionData Connection = new PayflowConnectionData(); /////////////////////////////////////////////////////////////////// // Create a new Void Transaction. // The ORIGID is the PNREF no. for a previous transaction. //VoidTransaction Trans = new VoidTransaction("&lt;ORIGINAL_PNREF&gt;", // User, Connection, PayflowUtility.RequestId); VoidTransaction Trans = new VoidTransaction("V35A0A3E6E0C", User, Connection, PayflowUtility.RequestId); // Submit the Transaction Response Resp = Trans.SubmitTransaction(); // Display the transaction response parameters. if (Resp != null) { // Get the Transaction Response parameters. TransactionResponse TrxnResponse = Resp.TransactionResponse; if (TrxnResponse != null) { Console.WriteLine("RESULT = " + TrxnResponse.Result); Console.WriteLine("PNREF = " + TrxnResponse.Pnref); Console.WriteLine("RESPMSG = " + TrxnResponse.RespMsg); Console.WriteLine("AUTHCODE = " + TrxnResponse.AuthCode); Console.WriteLine("AVSADDR = " + TrxnResponse.AVSAddr); Console.WriteLine("AVSZIP = " + TrxnResponse.AVSZip); Console.WriteLine("IAVS = " + TrxnResponse.IAVS); } // Get the Fraud Response parameters. FraudResponse FraudResp = Resp.FraudResponse; // Display Fraud Response parameter if (FraudResp != null) { Console.WriteLine("PREFPSMSG = " + FraudResp.PreFpsMsg); Console.WriteLine("POSTFPSMSG = " + FraudResp.PostFpsMsg); } // Display the response. Console.WriteLine(Environment.NewLine + PayflowUtility.GetStatus(Resp)); // Get the Transaction Context and check for any contained SDK specific errors (optional code). Context TransCtx = Resp.TransactionContext; if (TransCtx != null &amp;&amp; TransCtx.getErrorCount() &gt; 0) { Console.WriteLine(Environment.NewLine + "Transaction Errors = " + TransCtx.ToString()); } } Console.WriteLine("Press Enter to Exit ..."); Console.ReadLine(); } } } </code></pre> <p>Here is the credit code:</p> <pre><code> using System; using PayPal.Payments.Common; using PayPal.Payments.Common.Utility; using PayPal.Payments.DataObjects; using PayPal.Payments.Transactions; namespace PayPal.Payments.Samples.CS.DataObjects.BasicTransactions { /// &lt;summary&gt; /// This class uses the Payflow SDK Data Objects to do a simple independent Credit transaction. /// The request is sent as a Data Object and the response received is also a Data Object. /// &lt;/summary&gt; public class DOCredit { public DOCredit() { } public static void Main(string[] Args) { Console.WriteLine("------------------------------------------------------"); Console.WriteLine("Executing Sample from File: DOCredit.cs"); Console.WriteLine("------------------------------------------------------"); // Create the Data Objects. // Create the User data object with the required user details. UserInfo User = new UserInfo("xxx", "xxx", "paypal", "a12"); // Create the Payflow Connection data object with the required connection details. // The PAYFLOW_HOST property is defined in the App config file. PayflowConnectionData Connection = new PayflowConnectionData(); // Create a new Invoice data object with the Amount, Billing Address etc. details. Invoice Inv = new Invoice(); // Set Amount. Currency Amt = new Currency(new decimal(1)); Inv.Amt = Amt; Inv.PoNum = "PO12345"; Inv.InvNum = "INV12345"; // Set the Billing Address details. BillTo Bill = new BillTo(); Bill.Street = "123 Main St."; Bill.Zip = "12345"; Inv.BillTo = Bill; // Create a new Payment Device - Credit Card data object. // The input parameters are Credit Card Number and Expiration Date of the Credit Card. CreditCard CC = new CreditCard("5105105105105100", "0112"); // Create a new Tender - Card Tender data object. CardTender Card = new CardTender(CC); /////////////////////////////////////////////////////////////////// // Create a new Credit Transaction. // Following is an example of a independent credit type of transaction. CreditTransaction Trans = new CreditTransaction(User, Connection, Inv, Card, PayflowUtility.RequestId); // Submit the Transaction Response Resp = Trans.SubmitTransaction(); // Display the transaction response parameters. if (Resp != null) { // Get the Transaction Response parameters. TransactionResponse TrxnResponse = Resp.TransactionResponse; if (TrxnResponse != null) { Console.WriteLine("RESULT = " + TrxnResponse.Result); Console.WriteLine("PNREF = " + TrxnResponse.Pnref); Console.WriteLine("RESPMSG = " + TrxnResponse.RespMsg); Console.WriteLine("AUTHCODE = " + TrxnResponse.AuthCode); Console.WriteLine("AVSADDR = " + TrxnResponse.AVSAddr); Console.WriteLine("AVSZIP = " + TrxnResponse.AVSZip); Console.WriteLine("IAVS = " + TrxnResponse.IAVS); Console.WriteLine("CVV2MATCH = " + TrxnResponse.CVV2Match); // If value is true, then the Request ID has not been changed and the original response // of the original transction is returned. Console.WriteLine("DUPLICATE = " + TrxnResponse.Duplicate); } // Get the Fraud Response parameters. FraudResponse FraudResp = Resp.FraudResponse; // Display Fraud Response parameter if (FraudResp != null) { Console.WriteLine("PREFPSMSG = " + FraudResp.PreFpsMsg); Console.WriteLine("POSTFPSMSG = " + FraudResp.PostFpsMsg); } // Display the response. Console.WriteLine(Environment.NewLine + PayflowUtility.GetStatus(Resp)); // Get the Transaction Context and check for any contained SDK specific errors (optional code). Context TransCtx = Resp.TransactionContext; if (TransCtx != null &amp;&amp; TransCtx.getErrorCount() &gt; 0) { Console.WriteLine(Environment.NewLine + "Transaction Errors = " + TransCtx.ToString()); } } Console.WriteLine("Press Enter to Exit ..."); Console.ReadLine(); } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload