Is a payments callback URL required with Facebook local currency flow? - facebook

While implementing and testing local currency payment flow for my app I got an error with the pay dialog.
error_code = 1383044
error_message = "no callback url"
I have been reading the How-To at https://developers.facebook.com/docs/howtos/payments/ and the impression I got was that the payments callback was optional. However this error message seems to imply that it is required. Is setting up a payments callback a must for local currency payments?
(also, as a side question, are real time updates different from the payments callback? https://developers.facebook.com/docs/howtos/payments/fulfillment/#rtu)

No, the payments callback URL is not required, as long as you are using static pricing. Dynamic pricing does require the payments callback.
It turns out that I had a bug in my Open Graph object template that caused Facebook's Open Graph parser to not recognize the price data for the product I was testing. Since there was no price data, Facebook treated the item as a dynamically priced item. (https://developers.facebook.com/docs/howtos/payments/definingproducts/#pricing_dynamic)

Related

PayPal Adaptive Payments return URL parameters

I'm using PayPal Adaptive Payments (a deprecated integration method) with PHP.
When calling the "Pay" request, I always used to set the return URL to:
https://my-website/my-return-page.php?payKey=${payKey}
Then, when the payment is succesful, PayPal should redirect the user to something like:
https://my-website/my-return-page.php?payKey=AP-ABCDEF123456
But now, the PayPal API is throwing an error:
The URL https://my-website/my-return-page.php?payKey=${payKey} is malformed
There was no change in our end, it just stopped working.
I need the payKey in the return URL, so I can check the paymentDetails.
adding &payKey=${payKey}
Oh, based on the answer you linked you were sending that actual text as-is and PayPal was dynamically replacing that with the value.
It doesn't seem that syntax is supported anymore; it's not documented.
What I would recommend is generate your own unique ID, and pass that as ?id=abcde12345. Then when you first get the payKey from the initial Pay API response, associate this payKey with your own id (e.g. abcde12345). It could be the same as the TrackingID or Invoice ID, if you happen to use either parameter/feature of Adaptive Payments.
Then, the return should have ?id=abcde12345 and you can look up the payKey and proceed from there with paymentDetails.
You can also report this change in behavior with Adaptive Payments as a PayPal bug, but since it's a very old and deprecated product that's likely to be sunset at some point, I'm not sure how much traction re-implementing an undocumented feature would have, so the above workaround of your own id seems like a better plan.

How do I include the currency conversion block in Paypal Express Checkout

I have attached a screenshot of an example Paypal Express Checkout payment page which include some currency conversion information (indicated with a blue arrow). I am trying to replicate this implementation of Paypal Express Checkout on my own app. What parameters or settings are used to set whether to show this information or not? It is not clear in the documentation. Note: I am using Classic APIs
Only PayPal Adaptive Payment have Currency Conversion API.
Express checkout does not have.
If you really want to use PayPal Currency Conversion, you can still use this API. But, additionally you need to send "APP-ID" in your request. For Sandbox APP-Id is constant which isAPP-80W284485P519543T.for live, you need to create a APP from apps.paypal.com to get the APP-ID and then send the request.

Paypal custom variable solution using php

I'm trying to using paypal as payment for my site.
My site only sell a virtual currency, like "Diamond" in Online game.
So after reading i starting to use Express Checkout for Digital Goods, Is that right ? or i must other payment method ?
Then my question is when using Express Checkout for Digital Goods, how to pass custom variable ?
Let say i want to pay user_id, diamond_id, and some other variable from my database to the paypal api. It seem like paypal don't support custom variable to pass on the api call. I want after user complete the payment, then Paypal notify my server that the payment is complete by user_id and some other variable that i pass, so easy for me to know the detail.
after searching i find some solution,
First solution is to store "TOKEN"(Generated from "SetExpressCheckout" Method) and my custom variable which is belong to the TOKEN in the database, Then after payment complete paypal will notify my server the same TOKEN saved before. So i will query based on the TOKEN.
Second Solution is using get style in RETURNURL variable http://www.mysite.com/successpayment.php?user_id=13&diamond_id=88 So i will easy to grab the GET variable.
Which solution is right ? Is there any solution ? and how to secure the payment confirmation, i mean if someone know and hack my returnurl.
Thanks in advance
There are two parts to be able to successfully identify your order in the whole process:
To identify your order when the user is redirected back via the success or cancel URL, just pass the order id via the query string of the URL.
To identify your order when Paypal sends notifications about the transaction and associated events (refunds, reversals, disputes etc.) via IPN: Paypal does support a pass-through variable, which allows you to associate IPNs to the order record in your DB.
For express checkout you set PAYMENTREQUEST_0_INVNUM in the SetExpressCheckout call
In case you are creating a recurring profile, the parameter is named PROFILEREFERENCE in the CreateRecurringPaymentsProfile call
When you receive an IPN the invoice is passed as 'invoice' or 'rp_invoice_id' respectively
(My general advice, though: use Paypal only if you really have to)

Retrieving Billing Type in PayPal Express Checkout for recurring payments

I'm setting up a payment engine for a custom framework using PayPal Express Checkout. One of the business requirements is adding support for recurring payments. I've found documentation on how to implement this at https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_ECRecurringPayments
The thing I don't quite understand is how to retrieve the value of BillingType from the API after I've set it via SetExpressCheckout to "RecurringPayments". It doesn't seem to appear anywhere in the response data I get back from neither GetExpressCheckoutDetails nor DoExpressCheckoutPayment. I need this to know whether I need to create a recurring payments profile or not. So as far as I can tell my only option is to store the value of BillingType in my database and query it again after DoExpressCheckoutPayment. This works for me but I find it odd that this data would not be returned at all by the API. Am I missing something? Or is there another way of correctly implementing recurring payments?
Not all data you send in a request is returned in a response. You already have what you're passing to them...there's really no need for them to pass it back.
You could use session variables to save the data instead of the database, or you could log all of your API requests and refer to those logs when you need to see what you sent, but again, your application is what's telling PayPal whether or not the payment should include billing agreement information...not the other way around.

PayPal SetExpressCheckout vs. payment buttons

What is the benefit of calling PayPal API SetExpressCheckout method to get a payment link and forwarding a customer there instead of using payment buttons?
The PayPal buttons can be modified by the visitor's browser client. It is just basic HTML. All of the variables to place the order can be manipulated by the customer. For instance, it takes 3 seconds to change the order total from $900 to $1.
Using the API, you tell PayPal to create an incomplete transaction for a certain amount, with certain information, that can then be referenced/completed later and there is no way (short of expert hacking) to change the order. Instead of trusting the visitor's browser, PayPal trusts your server.