PayPal ignores response to instant update callback - paypal

PayPal is ignoring the response to my instant update callback.
I'm on sandbox
I'm getting the callback
I'm returning the exact example result in the documentation
...and PayPal continues to show my default shipping fee
Here's what I return from the callback (the example response at the end of this page):
METHOD=CallbackResponse&OFFERINSURANCEOPTION=true&L_SHIPPINGOPTIONNAME0=UPS Next Day Air&L_SHIPPINGOPTIONAMOUNT0=20.00&L_TAXAMT0=2.20&L_INSURANCEAMOUNT0=1.51&L_SHIPPINGOPTIONISDEFAULT0=false&L_SHIPPINGOPTIONNAME1=UPS Express 2 Days&L_SHIPPINGOPTIONAMOUNT1=10.00&L_TAXAMT1=2.00&L_INSURANCEAMOUNT1=1.35&L_SHIPPINGOPTIONISDEFAULT1=true&L_SHIPPINGOPTIONNAME2=UPS Ground2 to 7 Days&L_SHIPPINGOPTIONAMOUNT2=9.99&L_TAXAMT2=1.99&L_INSURANCEAMOUNT2=1.28&L_SHIPPINGOPTIONISDEFAULT2=false
I've also tried a much simpler response with no change in effect:
L_SHIPPINGOPTIONAMOUNT0=20.00&OFFERINSURANCEOPTION=false&L_SHIPPINGOPTIONISDEFAULT0=true&L_SHIPPINGOPTIONNAME0=Standard+Domestic&METHOD=CallbackResponse
What could I possibly be doing wrong? I see the callback in my server log. This is baffling.

It seems like in the response from the above url one parameter is missing which is "L_SHIPPINGOPTIONLABEL0=somenamehere" .
Try updating your callback script to send the above variable also in the response to the PayPal and see if that works for you .

For everyone interested, here is the documentation of the "Callback Response Message". I was also searching for the documentation because of a missing parameter.
https://developer.paypal.com/docs/classic/api/merchant/Callback_API_Operation_NVP/

Related

PayPal IPN notification missing/renamed parameters

In rare cases I'm getting IPN notifications with the parameters renamed. For example, rather receiving a message containing the expected parameter:
option_name1=<my value here>
instead I receive a message with:
option_name1_1=<my value here>
And quite obviously my code does not look for a parameter with the extra _1 on the end.
Why does this happen and can I get PayPal to retry the IPN notification with the correct parameter name?
Thanks!
Thanks to #EJP - looks like PayPal is mistakenly treating the transaction like it is a shopping cart with multiple items.
I've added checks in my IPN handler code to deal with the extra fields with the _1 appended to them (even though I'd never expect them to be there).

What is the name of the post variable what is sending from paypal webhooks?

Paypal webhooks send me a post variable, but whats the name from that?
I can't found anything.
The posted variables depend on the event triggered. To actually see the post sent by PayPal , Follow the below steps :
1. Go to developer.paypal.com--> Dashboard and login .
2. In left move to "WebHooks Simulator" and put your url you want to receive the post to after selecting the event type and it will show you the data posted after clicking on submit .
You will see something like below :
When a webhook is sent, it sends headers as well as a payload. That documentation is spread between the two links below. What's not explained very well is the actual contents of the "resource" field. If for example the webhook is for a sale event type, then the contents of resource is the same as getting the info from GET /v1/payments/sale/
First link explains the main payload. Second link explains the headers.
https://developer.paypal.com/docs/api/#retrieve-a-webhook-event
https://developer.paypal.com/docs/integration/direct/rest-webhooks-overview/
$bodyReceived = file_get_contents('php://input');

Verify cancel_return parameters

When I click the cancel link in PayPal and am redirected to my cancel_url, it is passed the following parameters (some values removed).
cmd=_flow&
myAllTextSubmitID=&
miniPager=&
currentSession=&
pageState=login&
currentDispatch=&
email_recovery=false&
password_recovery=false&
login_email=&
login_password=&
private_device_checkbox_flag=on&
SESSION=&
CONTEXT=&
cmd=_flow&
id=&
close_external_flow=false&
external_close_account_payment_flow=payment_flow&
cancel_return=&
auth=&
form_charset=UTF-8&
external_remember_me_read_cookie_ids=&
flow_name=xpt%2FCheckout%2Fwps%2FLogin&
fso=
Is there any way to verify that this is a legitimate cancelation similar to how IPN verify works?
None of this looks like PayPal data. It looks like you're passing that stuff to yourself in the cancel URL, or via your original form. In which case you can pass yourself a ticket that only you can generate and verify. There's no need from Paypal's point of view to provide a verification, as no transaction has occurred.

Credits: Error occurs *sometimes*

I created a Facebook app and integrated Credits. However, about every second time I call the credits API, I get the following error:
There Was a Problem Processing Your Payment / Sorry, but we're having trouble processing your payment. You have not been charged for this transaction. Please try again later.
Everything on my end looks good. On success, the callback is called 3 times:
payments_get_items
payments_status_update, status "placed"
payments_status_update, status "settled"
When it fails and the above error dialog is shown, I can see that only the first call is performed (payments_get_items).
I can see that the response back to Facebook is the same in both cases:
{ "content":[ { "item_id":"1", "title":"[title]", "description":"[description]", "image_url":"[url]", "product_url":"[url]", "price":30 } ], "method":"payments_get_items" }
Has anyone experienced this or can imagine what the reason for the behaviour is?
Thank you!
Bw
I just had similar issue.
Error message is generic and it doesn't give you exact cause of the problem.
In my case the problem was that my image url was misspelled so check your payments_get_items response very carefully.
Beside checking image url validity also check that length of your title and description is ok.
check "Developers response" section on this url for info on boundaries :
https://developers.facebook.com/docs/payments/callback/#payments_get_items
BTW, I think they mistakenly marked product url as required, however you can put same value as for image url just to be sure.

Credits callback script not called (error 1383046)

I have a problem getting facebook to call my credits callback script. I've setup a company and the callback url. I used the example script for it. But nonetheless I always get this error when I try to access the payment window using the JS sdk.
var obj = {
method: 'pay',
order_info: order_info,
purchase_type: 'item'
// dev_purchase_params: {'oscif': true}
};
FB.ui(obj, getCashCB);
Error:
There Was a Problem Processing Your Payment
Sorry, but we're having trouble processing your payment. You have not been charged for this transaction. Please try again.
error code from console: 1383046
meaning:
1383046 AppInvalidDecodedResponse The application return value was invalid after json_decoding the return value.
No matter if I'm in sandbox mode, set the callback url to something completely different.
The callback script is never called.
I've searched far and long for anybody else with this problem, but found nothing meaningful. There was something about the server accepting curl requests from facebook but I don't know what that means or how to test for it.
Solved! Whilst looking for the cause I noticed that this error can pop up from a lot of things. But this case is rather specific:
Because the facebook app is still in development, we hid it behind a .htaccess file. So when you visit the site, you login, and the app loads etc. BUT this doesn't work for the credits callback file. Since the request then comes from facebook, it would have to login with user:pass. I tried putting that in the callback URL, but that doesn't seem to work.
So I only need to put the callback file somewhere where you can reach it without .htaccess and Tadaaa it works!
Basically this happens when Facebook doesn't understand the response it gets from calling your payment callback URL. Thew most likely reasons are:
The callback URL is wrong
Facebook gets an error response because the server or some app-level firewall won't let it access the URL (Jon's problem)
Facebook gets an error response because the callback script runs into an exception.
The callback script's response is malformed.