3
有没有人知道如何根据pnref或其他参数通过调用paypal返回退款(使用payflow API时)。 谢谢 MaciekPayflow退款
有没有人知道如何根据pnref或其他参数通过调用paypal返回退款(使用payflow API时)。 谢谢 MaciekPayflow退款
如果交易尚未结算,您可以使用无效退款。对于长期交易,就像一个月前一样,你需要做一笔信用。以下是无效代码:
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
{
/// <summary>
/// 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.
/// </summary>
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("<user>", "<vendor>", "<partner>", "<password>");
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("<ORIGINAL_PNREF>",
// 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 && TransCtx.getErrorCount() > 0)
{
Console.WriteLine(Environment.NewLine + "Transaction Errors = " + TransCtx.ToString());
}
}
Console.WriteLine("Press Enter to Exit ...");
Console.ReadLine();
}
}
}
这里是信用代码:
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
{
/// <summary>
/// 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.
/// </summary>
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 && TransCtx.getErrorCount() > 0)
{
Console.WriteLine(Environment.NewLine + "Transaction Errors = " + TransCtx.ToString());
}
}
Console.WriteLine("Press Enter to Exit ...");
Console.ReadLine();
}
}
}
非常感谢约瑟夫。但是我还有一个问题,因为我不确定解决方案。当我在付款过程中首先进行授权呼叫“&TRXTYPE = A&AMT = 199.00&”时,我必须使用信用或无效,并且在此之后我再拨打另一个电话“TRXTYPE = D&AMT = 199.00&” - 因为稍后我想打电话基于ORIGID。此外哪些pnref选择退款 - 授权通话或延迟捕获的pnref。最好的问候,Maciek – user1401308 2012-07-08 08:08:49
不客气。您可以使用授权和捕获或授权与延迟捕获。开始时使用哪种付款并不重要。如果付款已被授权,则使用void。我认为你可以使用任何pnref,因为我相信它们是一样的。定制解决方案可将pnref保存到数据库,并可通过订单ID进行引用。如果您仍有问题,请在您的帖子中添加一些代码。 – 2012-07-08 14:52:39
未来的读者注意:只要您指定了PNREF值,您就不需要指定信用卡号码(至少在我的经验中)。 – Josh1billion 2014-04-07 19:28:46