Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you get the payKey from a transactionId?

I've been using PayPals IPN to receive and process payments, storing the transactionId as a reference.

The time has come to be able to refund payments through the system I'm developing and here lies the struggle.

When using entering a transactionId into the payKey field on the GetPaymentDetails.php sample in an updated PHP SDK, with correct authentication details and application id, I get:

Error ID: 580022
Domain: PLATFORM
Severity: Error
Category: Application
Message: Invalid request parameter: payKey with value [REMOVED (transactionId)]
Parameter: Array

This is understandable, as it is expecting a payKey. Now, I can change the $pdRequest->payKey = $payKey; to $pdRequest->transactionId = $payKey; as per the specification. This should now send the transactionId as a transactionId and work, but I get this in response:

Error ID: 520002
Domain: PLATFORM
Severity: Error
Category: Application
Message: Internal Error

Ok, so something is broken. I suspect they do not allow transactionId to be used as a reference now and haven't updated their documentation (typical). The reason I suspect this is that the original SDK I used included a field for transactionId, as well as trackingId and another identifier. But now the updated SDK only asks for the payKey.

Now I'm stuck. I've collected thousands of live transactionIds. Do you know how I can get a payKey for each transaction, or fix the original problem.

Thanks

More Info:

Here are the HTTP headers sent:

X-PAYPAL-SECURITY-SIGNATURE: [removed]
X-PAYPAL-SECURITY-USERID: [removed]
X-PAYPAL-SECURITY-PASSWORD: [removed]
X-PAYPAL-APPLICATION-ID: [removed]
X-PAYPAL-REQUEST-SOURCE: PHP_SOAP_SDK_V1.4
X-PAYPAL-DEVICE-IPADDRESS: 127.0.0.1
X-PAYPAL-MESSAGE-PROTOCOL: SOAP11
X-PAYPAL-REQUEST-SOURCE: PHP_SOAP_SDK_V1.4

And here is the content

<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"     xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
 <soap:Body><PaymentDetailsRequest>
    <requestEnvelope>
        <errorLanguage>en_US</errorLanguage>
    </requestEnvelope>
    <transactionId>[removed]</transactionId>
</PaymentDetailsRequest></soap:Body>
</soap:Envelope>

To

https://svcs.paypal.com/AdaptivePayments/PaymentDetails
like image 844
Matt Votsikas Avatar asked Apr 01 '13 11:04

Matt Votsikas


People also ask

Where can I found my transaction ID?

It usually appears on the receipt or proof of purchase when a transaction is run. The specific character length of a transaction ID will vary depending on who issues it, but it usually appears as a 12-18 digit code.

How can I use my transaction ID?

As already briefly mentioned above, a transaction ID is a set of digits used to associate particular payments with a specific merchant or a customer. You can use it to analyze the status of a specific transaction made via a payment system or for search purposes in the payment logs.

Where do I find my PayPal transaction ID?

Find my PayPal transaction ID Log into your PayPal account. Click Activity near the top of the page to see your most recent account activities. Search for required transaction. Click the transaction to bring up payment details including your transaction ID (t's a 17-character string made up of both letters and numbers)

Is it okay to show transaction ID?

Transaction ID is definitely safe. The user will even receive an email with the transaction ID as a reference. Also, I'm pretty sure Payment ID is added to the redirect URL when the payment has been made. So they are both available for the user.


1 Answers

i have one suggestion:

i suppose you have all the transaction IDs saved in your DB,

loop for all the records, get the transaction ids, get the paykey by transaction id and update the relevant orders,

then you can have the transaction and paykey values, together for a single record.

like image 112
Muhammad Avatar answered Oct 01 '22 17:10

Muhammad