简体   繁体   中英

PayPal Sandbox Transaction Numbers but No Transactions

I'm using PayPal's Adaptive Payments API to pay people from my site. In the PayPal Sandbox (for testing of course), I'm getting PayPal Transaction numbers and dates back from the API calls, but when I check the test accounts, there is no change in money, and no recorded transaction(s).

If there is a transaction number, shouldn't there be a corresponding transaction? Why would I be getting a transaction number with no actual transaction occurring?

UPDATE: The following is my payment function that calls the 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;

Here is where I deal with the response envelope:

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

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

I realize I was using Correlation ID as my transaction number...not sure why, but that would account for the weirdness in the transaction number. But where do I get the transaction number on successful payment?

EDIT2: Thinking about it, though, I'm making it inside the if (payResponse.ack.ToString() == "SUCCESS") check, so doesn't this imply a successful payment?

I would need to see a sample of your API request and response to know more, but one example of how this could happen is if you're sending a Pay request with the ActionType set to CREATE. This would generate a pay key (which is what I think you must be referring to as a transaction ID in this case) but no money would be moved until you follow that up with a call to the ExecutePayment API.

That's just one example, though. Another reason could be that you're looking at the wrong sandbox account(s), which I've seen a lot of times quite frankly.

Again, it's tough to say without seeing your request.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM