PayPal沙盒交易号但没有交易

时间:2015-02-25 19:42:58

标签: paypal

我正在使用PayPal的自适应付款API向我的网站付费。在PayPal沙箱中(当然是为了测试),我从API调用中获得了PayPal交易号和日期,但是当我检查测试账户时,没有钱的变化,也没有记录的交易。 / p>

如果有交易号,是否应该有相应的交易?为什么我会得到没有实际交易的交易号?

更新:以下是我调用PayPal API的付款功能:

ReceiverList receiverList = new ReceiverList { receiver = new List<Receiver>() };
Receiver receiver = new Receiver(amountToPay) { email = receiverEmail };
receiverList.receiver.Add(receiver);

RequestEnvelope requestEnvelope = new RequestEnvelope("en_US");
const string actionType = "PAY";
const string returnUrl = "https://devtools-paypal.com/guide/ap_implicit_payment/dotnet?success=true";
const string cancelUrl = "https://devtools-paypal.com/guide/ap_implicit_payment/dotnet?cancel=true";
const string currencyCode = "USD";

PayRequest payRequest = new PayRequest(
    requestEnvelope,
    actionType,
    cancelUrl,
    currencyCode,
    receiverList,
    returnUrl)
{
    senderEmail = "SENDER_EMAIL_HERE"
};


_payPalConfig = new Dictionary<string, string>
{
    {"mode", "sandbox"},
    {"account1.apiUsername", "USERNAME_HERE"},
    {"account1.apiPassword", "PASSWORD_HERE"},
    {"account1.apiSignature", "SIGNATURE_HERE"},
    {"account1.applicationId", "SANDBOX_APP_ID_HERE"}
};

AdaptivePaymentsService adaptivePaymentService = new AdaptivePaymentsService(_payPalConfig);
PayResponse payResponse = adaptivePaymentService.Pay(payRequest);

if (!payResponse.error.Any())
{
    PaymentDetailsRequest paymentDetailsRequest = new PaymentDetailsRequest(new RequestEnvelope("en_US"))
    {
        payKey = payResponse.payKey
    };

    adaptivePaymentService = new AdaptivePaymentsService(_payPalConfig);
    PaymentDetailsResponse paymentDetailsResponse =
        adaptivePaymentService.PaymentDetails(paymentDetailsRequest);

    return paymentDetailsResponse.responseEnvelope;
}
return payResponse.responseEnvelope;

以下是我处理回复信封的地方:

ResponseEnvelope payResponse = ppa.SendPayment(payPalUserEmail, commissionAmount);

if (payResponse.ack.ToString() == "SUCCESS")
{
    payment.PayPalTrxNumber = //??
    payment.PayPalTrxDate = DateTime.Parse(payResponse.timestamp);
}

我意识到我正在使用相关ID作为我的交易号...不确定原因,但这会解释交易号码的怪异性。但是,如果成功付款,我在哪里可以获得交易号?

EDIT2:但是,考虑一下,我是在if (payResponse.ack.ToString() == "SUCCESS")支票内进行的,所以这不意味着支付成功吗?

1 个答案:

答案 0 :(得分:0)

我需要查看您的API请求和响应的示例以了解更多信息,但是如果您发送的Action请求设置为CREATE,则会发生这种情况。这将产生一个支付密钥(在这种情况下,我认为你必须将其称为交易ID),但在您通过调用ExecutePayment API跟进之后,不会移动任何资金。

但这只是一个例子。另一个原因可能是你正在查看错误的沙盒帐户,我很多时候都非常坦率地看过这个帐号。

同样,如果没有看到你的要求,很难说。

相关问题