I'm working on PayPal integration (Express Checkout) using SOAP API. After DoExpressCheckout call I call GetExpressCheckoutDetails. In docs I found that the checkout status can be one of the following
PaymentActionNotInitiated
PaymentActionFailed
PaymentActionInProgress
PaymentCompleted
But docs do not actually say what does each of them mean. I understand all but PaymentActionInProgress - how do I handle it? Does it mean that I'll receive IPN call from PayPal when it's completed? Also, can I simulate this response for testing?
Hello Alex Buynyachenko,
A value of PaymentActionNotInitiated occurs when you submit a GetExpressCheckoutDetails API call before the buyer logs into a PayPal account or when they log into their account, return to your website but have not completed the payment yet.
PaymentActionFailed occurs when you've tried to complete the payment but it failed for some reason. The error response information returned would have details on the failure.
PaymentActionInProgress this is returned when you submit the DoExpressCheckoutPayment API call but haven't received a response yet - you shouldn't encounter that one often.
PaymentCompleted is returned after you get a successful DoExpressCheckoutPayment response. I just tested submitting an Authorization to see if I would get "InProgress" or "Completed" and I received a "Completed" value back.
1. Step-1: when I run this below code then it returned [CHECKOUTSTATUS] => PaymentActionNotInitiated
$padata = '&TOKEN='.urlencode(_GET('token'));
$httpParsedResponseAr = $this->PPHttpPost('GetExpressCheckoutDetails', $padata, PPL_API_USER, PPL_API_PASSWORD, PPL_API_SIGNATURE, PPL_MODE);
2. Step-2: Second time when I run this below code then it returned me [CHECKOUTSTATUS] => PaymentActionCompleted
$httpResDoExpChkPay = $this->PPHttpPost('DoExpressCheckoutPayment', $padata);
I think it will help you to better understand.
Related
I'm making the following call using PayPal's PayFlow pro SDK.
SaleTransaction sTrans = new SaleTransaction( user, connection, inv, card, PayflowUtility.getRequestId() );
Response resp = sTrans.submitTransaction();
All error messages are returned in English.
Is it possible to pass a parameter to return response messages in another language?
If not, I'll use the returned error code and create some resource bundle messages per language.
Payflow responses are not localized.
In order to gracefully handle a refund request on a transaction that has already been refunded, I should have the possibility to check the exact error code returned by PayPal REST API in case of a POST https://api.sandbox.paypal.com/v1/payments/capture/{captureid}/refund request.
similarly to the classic API I thought (but I was wrong) that in this case an error 10009 could be returned (https://developer.paypal.com/docs/classic/api/errorcodes/).
Actually when I try to request a refund for a payment that has already been captured i got a 400 HTTP status and the JSON body below:
{
"name": "TRANSACTION_REFUSED",
"message": "The request was refused.This transaction has already been fully refunded",
"information_link": "https://developer.paypal.com/webapps/developer/docs/api/#TRANSACTION_REFUSED",
"debug_id": "e3f52374ef2e7"
}
I was wondering if there's a way to to look for this specific error other than inspecting the "message" value included in the JSON response.
Thanks,
Andrea
I believe you already got an answer from the PayPal-Java-SDK GitHub repository issue #148.
In case someone else has the same question, today, the HTTP response code is a general error code, and the message in the body is the best way to identify the cause. Please make a feature request to PayPal Technical Support so this enhancement can be considered for a future release.
I am currently using PayPal buttons in my application written in Scala (Play Framework).
Now I am trying to implement PayPal IPN instead of redirect.
According to PayPal document
https://developer.paypal.com/docs/classic/ipn/gs_IPN/
After the user finished the payment, the flow of events is:
PayPal posts a message to my application's listener with all sorts of variables.
My listener returns an empty HTTP 200 response.
My listener performs an HTTP POST to send the complete, unaltered notification back to PayPal.
PayPal sends a single word back - either VERIFIED or INVALID.
So, my controller's method should look like:
def payPalIpn() = Action { implicit request =>
.... Get all PayPal Variables .......
/* Send empty response with empty HTTP 200 response */
Ok("")
.... Make a POST request to PayPal site with all original PayPal's variables
}
Here is what I stumbled upon - How can I make a POST request after I return OK("")?
Is that even possible in Play?
Appreciate if someone can give me any idea.
Andrei.
This would be an excellent use case for an Akka Actor:
def payPalIpn() = Action { implicit request =>
.... Get all PayPal Variables .......
actorSystem.actorSelection("paypal-ipn-actor") ! ValidateIPN(request.body)
/* Send empty response with empty HTTP 200 response */
Ok("")
}
If I understand it correct, you want to make a POST request to PayPal in your action. For that you can use WS Client library from Play. Detailed tutorial is given at
https://www.playframework.com/documentation/2.4.x/ScalaWS
In my PayPal IPN response the custom parameter is empty.
I've tried the following post data:
METHOD=SetExpressCheckout&VERSION=121.0&USER=mark.vanhaaren1987-facilitator_api1.gmail.com&PWD=1411391015&SIGNATURE=AiPC9BjkCyDFQXbSkoZcgqH3hpacAa1vFAMOEAO1ZachEpl5mX2RGSRb&RETURNURL=https%3a%2f%2fdev-api.wedepa.com%2freturn%2freturn%3fwedepaid%3d32-303-true-e3c7a8f25359d0ad625c4389102aa0cabdfb172e&CANCELURL=https%3a%2f%2fdev-api.wedepa.com%2freturn%2freturn%3fwedepaid%3d32-303-true-e3c7a8f25359d0ad625c4389102aa0cabdfb172e&REQCONFIRMSHIPPING=0&LOCALECODE=&EMAIL=pending_accepted%2540klarna.com&LANDINGPAGE=Login&PAYMENTREQUEST_0_SHIPTONAME=Testperson-nl+Approved&PAYMENTREQUEST_0_SHIPTOSTREET=Neherkade+1XI&PAYMENTREQUEST_0_SHIPTOSTREET2=&PAYMENTREQUEST_0_SHIPTOCITY=Gravenhage&PAYMENTREQUEST_0_SHIPTOSTATE=&PAYMENTREQUEST_0_SHIPTOZIP=2521VA&PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE=NL&PAYMENTREQUEST_0_SHIPTOPHONENUM=0612345678&PAYMENTREQUEST_0_AMT=0.56&PAYMENTREQUEST_0_CURRENCYCODE=EUR&PAYMENTREQUEST_0_ITEMAMT=0.56&PAYMENTREQUEST_0_DESC=145000610&PAYMENTREQUEST_0_CUSTOM=303&PAYMENTREQUEST_0_INVNUM=145000610&PAYMENTREQUEST_0_PAYMENTACTION=Sale&PAYMENTREQUEST_0_PAYMENTREQUESTID=303
and
METHOD=SetExpressCheckout&VERSION=121.0&USER=mark.vanhaaren1987-facilitator_api1.gmail.com&PWD=1411391015&SIGNATURE=AiPC9BjkCyDFQXbSkoZcgqH3hpacAa1vFAMOEAO1ZachEpl5mX2RGSRb&RETURNURL=https%3a%2f%2fdev-api.wedepa.com%2freturn%2freturn%3fwedepaid%3d32-303-true-e3c7a8f25359d0ad625c4389102aa0cabdfb172e&CANCELURL=https%3a%2f%2fdev-api.wedepa.com%2freturn%2freturn%3fwedepaid%3d32-303-true-e3c7a8f25359d0ad625c4389102aa0cabdfb172e&REQCONFIRMSHIPPING=0&LOCALECODE=&EMAIL=pending_accepted%2540klarna.com&LANDINGPAGE=Login&PAYMENTREQUEST_0_SHIPTONAME=Testperson-nl+Approved&PAYMENTREQUEST_0_SHIPTOSTREET=Neherkade+1XI&PAYMENTREQUEST_0_SHIPTOSTREET2=&PAYMENTREQUEST_0_SHIPTOCITY=Gravenhage&PAYMENTREQUEST_0_SHIPTOSTATE=&PAYMENTREQUEST_0_SHIPTOZIP=2521VA&PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE=NL&PAYMENTREQUEST_0_SHIPTOPHONENUM=0612345678&PAYMENTREQUEST_0_AMT=0.56&PAYMENTREQUEST_0_CURRENCYCODE=EUR&PAYMENTREQUEST_0_ITEMAMT=0.56&PAYMENTREQUEST_0_DESC=145000610&CUSTOM=303&PAYMENTREQUEST_0_INVNUM=145000610&PAYMENTREQUEST_0_PAYMENTACTION=Sale&PAYMENTREQUEST_0_PAYMENTREQUESTID=303
But in both posts the custom parameter is empty in the IPN data:
mc_gross=0.56&protection_eligibility=Eligible&address_status=unconfirmed&payer_id=WVANQ6YXN3Z44&tax=0.00&address_street=Neherkade+1XI&payment_date=02%3A25%3A07+Apr+05%2C+2015+PDT&payment_status=Completed&charset=windows-1252&address_zip=2521VA&first_name=SandboxTest&mc_fee=0.37&address_country_code=NL&address_name=Testperson-nl+Approved¬ify_version=3.8&custom=&payer_status=verified&address_country=Netherlands&address_city=Gravenhage&quantity=1&verify_sign=AWOaXag9big7U1TLyuUBdjQukr3NAId64fyHo.KuCCvftrNBM1o3xHVd&payer_email=mark%40mvhaaren.com&txn_id=7XS68223YK9539538&payment_type=instant&last_name=Account&address_state=&receiver_email=mark.vanhaaren1987-facilitator%40gmail.com&payment_fee=&receiver_id=A3TRBFWRTUBBL&txn_type=express_checkout&item_name=&mc_currency=EUR&item_number=&residence_country=NL&test_ipn=1&handling_amount=0.00&transaction_subject=&payment_gross=&shipping=0.00&ipn_track_id=7f79e2488253
Can somebody see what I am doing wrong?
The PAYMENTREQUEST_0_CUSTOM parameter needs to be in your DoExpressCheckoutPayment call, more than it needs to be in your SetExpressCheckout call.
Noobish question: Are you supposed to respond to realtime updates (RTUs) somehow? Keep getting RTUs on the same dispute which FB has already refunded. So, should one echo something in the RTU callback? Just been through all the documentation I can find (again) and can't seem to find anything on response.
Yes, you need to return a 200. The content type or response body do not matter. Anything else results in Facebook retrying the callback until a 200 is received, so you'll get lots of spam