payments_detail empty in payments reports - facebook

When requesting the detail payment report via https://paymentreports.facebook.com ( https://developers.facebook.com/docs/payments/developer_reports_api/ ) I always have an empty payment_detail:
SH,COMPANYID,payment_detail
CH,app_id,payment_type,product_type,payment_id,time_completed,recv_currency,recv_amount,fx_batch_id,fx_rate,settle_currency,reference_id,tax_country
SF,0
my request URL with important data left out: https://paymentreports.facebook.com/COMPANYID/report?date=2012-09-30&type=detail&access_token=ACCESSTOKEN
How can I get the payment_detail to contain data?(credits_detail has data)

The problem here was at the time Facebook local currency was not yet used. The reports were for Facebook Credits and thus that part was empty.

Related

How do I resolve a 400 bad request error using the paypal rest api?

I am currently testing credit card payments using the PayPal payments pro Rest API.
I keep getting the following error:
Exception in HttpConnection Execute: Invalid HTTP response The remote server returned an error: (400) Bad Request. --->
I created and activated my PayPal test account and as following:
Credit card
Credit card number:
ccnumber here
Credit card type:
Visa
Expiration date:
3/2019
When I enter the above information in my payment form and submit I keep getting the 400 bad request error.
I have gotton this to work before with the PayPAl joe shopper account but lost the test cc number.
I am 100% sure I have authenticated with the oauth2 credentials
What is the likely cause of this error?:
I am entering a random payer first name and last name .
Does the name have to exsist?
What could be causing the error
If anything goes wrong in the data given, paypal api will return a 400 - Bad request error.
When I got the error(PHP SDK), I caught the exception and $ex->getData() returned a json which contains the details about the bad request, in my case the currency code I given was wrong.
try {
$payment->create($apiContext);
} catch (PayPal\Exception\PPConnectionException $ex) {
var_dump(json_decode($ex->getData()));
exit(1);
}
Like others here have said, there are several things that can cause the (HTTP 400 - Bad Request).
In my case it was due to using the same invoice number. For temporary testing I just used the ShoppingCartID that I generated with a guid. You could also use a Random number generator as well. Ultimately you will need to generate an invoice number to the clients specifications.
-Good luck
I just had the same problem (HTTP 400 - Bad Request). The cause is a REST API request with "errors". In my case I had two causes:
I passed amount details to an Amount object but the sum of subtotal, shipping an tax was not equal to the amount total.
I passed amount currency values including a fracture, but passed not exactly two decimals but only one. Obviously the REST API is a bit touchy and accepts only either no or two decimals.
I passed an item_list in the Transaction object but the sum of the prices in the Item object was not equal to the subtotal given in the amount details.
I don't know a way of finding the actual cause of the error (if there is one).
In your case it could be the name of the payer that you add. Try without.
Edit:
I just tried out: It is indeed the payer info. I passed a payer_info with first and lastname and got HTTP 400 (without everything worked). I assume that payer_info must not be set by us but is set by PayPal when returning a Payment object.
Payer payer = new Payer { payment_method = "paypal", payer_info = new PayerInfo {
first_name = "Zaphod", last_name = "Beeblebrox"} }; // => HTTP 400 - Bad Request
firstly find out what exactly what Your error is
payment = PayPal::SDK::REST::DataTypes::Payment.new(...)
payment.create
# got Response[400]: Bad Request here
payment.error
# got {"name"=>"VALIDATION_ERROR", "details"=>[{"field"=>"transactions", "issue"=>"
then find out what Your issue here to get more info
https://developer.paypal.com/webapps/developer/docs/api/#validation-issues
I had the same issue. In my case it was Credit Card issue which might be over used. So I have taken new Credit card Number from this site Testing Credit card and replaced with the old one.
Here is Credit Card Information that I used
credit_card = new CreditCard()
{
billing_address = new Address()
{
city = "Johnstown",
country_code = "US",
line1 = "52 N Main ST",
postal_code = "43210",
state = "OH"
},
cvv2 = "874",
expire_month = 11,
expire_year = 2018,
first_name = "Joe",
last_name = "Shopper",
number = "4024007185826731", //New Credit card Number, Only Card type should match other details does not matter
type = "visa"
}
Note: All the Credit Card mentioned in PayPal site are not working, giving same issue for me. If it working for you then it's good otherwise use new testing Credit Card Number. Hope this will help someone.
Thank you! Enjoy Coding!
I too got struck with this issue, there might be many other possible root cause for this failure but then in my case all my passing argument is correct, but then it failed in sandbox environment, I just changed Payment option from PayPal Balance to Visa then it started working.
I recently had a 400 bad request error as well. In my case, I was processing a refund using RefundRequest, and it appears that PayPal recently changed the constraints on the "reason" field (although it isn't documented that I can find) so my lengthy descriptions of what was being returned were no longer acceptable. I found the error only because I saw another field where PayPal was now requiring that it be only single-byte alphanumeric characters. What actually helped though, was shortening the data I was putting through as a reason to simply "Returned items".
Obviously this is an old thread, and I'm sure the original problem was solved long ago, but if using some of the above methods to determine more information about an error don't yield results I would suggest submitting a request with the bare minimum of information until you can get it to go through. Then, start adding additional fields/information back to see if you can identify which field contains the information causing the bad request. That would have worked for my issue, at least.
Understand your errors
PayPal returns detailed data on every exception (except 500 INTERNAL_SERVER_ERROR), explaining what was the exact error you are seeing. You can retrieve that as follows:
Update your exception handling to catch PayPalConnectionException and print $ex->getData() as shown below:
try {
$payment->create($apiContext);
} catch (PayPal\Exception\PayPalConnectionException $ex) {
echo $ex->getCode(); // Prints the Error Code
echo $ex->getData(); // Prints the detailed error message
die($ex);
} catch (Exception $ex) {
die($ex);
}
It is due to the wrong currency or amount you have given.
I faced the issue in React JS
I was doing this. in the createOrder method.
purchase_units: [{
amount: {
currency_code: 'PHP',
value: totalAmount
}
}],
that was the issue. If i gave any currency other than USD i will get the 400 Error. So i removed the currency_code from here
And I moved the currency declaration into my component declaration.
like this.
options={{
clientId: " Your_ID " ,
currency: "PHP"
}}
Here you can give any currency you want. This solves my 400 Error
If you use Paypal Sandbox for testing Driver and on first try with buggy code it shows the client a 400 Bad request error.
Reason:- Paypal sent JWT auth and it was stored in the client's local storage.
Suggestion:- Try to clear the client's local storage cache (You only need to clear the Paypal Token).
This works for me, I hope it works for you :)

cannot get full shopping cart detail using GetExpressCheckoutDetails

I am currently testing an online store using a custom cart within paypal sandbox.
I am able to go trough all transcation steps properly
setExpressCheckout-> pay -> DoExpressCheckout.
During the DoExpressCheckout step I think it would be the good time to update my database with the order. For that I use the GetExpressCheckoutDetails function to retrieve the content of the transaction.
Sadly this function return everything paypal has to offer but miss the content of my cart. All i can get is the detail of one item. If the transaction involve multiple items i would only get the details of the first one.
Here is my code (mostly taken from paypal samples) :
$token =urlencode( $_REQUEST['token']);
$payerId=urlencode( $_REQUEST['PayerID']);
$getExpressCheckoutDetailsRequest = new GetExpressCheckoutDetailsRequestType($token);
$getExpressCheckoutReq = new GetExpressCheckoutDetailsReq();
$getExpressCheckoutReq->GetExpressCheckoutDetailsRequest = $getExpressCheckoutDetailsRequest;
$paypalService = new PayPalAPIInterfaceServiceService();
$getECResponse = $paypalService->GetExpressCheckoutDetails($getExpressCheckoutReq);
$details = $getECResponse->GetExpressCheckoutDetailsResponseDetails;
// $details->PaymentDetails->PaymentDetailsItem this array should hold all items details
// sadly it always have 1 element instead of the full content of my cart :(
$orderTotal = $details->PaymentDetails->OrderTotal;
$PaymentDetails= new PaymentDetailsType();
$PaymentDetails->OrderTotal = $orderTotal;
//
Some stuff with payment details
//
$DoECRequestDetails = new DoExpressCheckoutPaymentRequestDetailsType();
$DoECRequest = new DoExpressCheckoutPaymentRequestType();
$DoECRequest->DoExpressCheckoutPaymentRequestDetails = $DoECRequestDetails;
$DoECReq = new DoExpressCheckoutPaymentReq();
$DoECReq->DoExpressCheckoutPaymentRequest = $DoECRequest;
$DoECResponse = $paypalService->DoExpressCheckoutPayment($DoECReq);
Do i miss a step or call a bad function. Because i tried to print_r every variable i came across and the full content of my cart was nowhere to be found. I find this strange since the 'orderTotal' of the transaction match with my original cart. I could store my original order during the SetExpressCheckout step but since paypal already have those values i find it redundant.
As a last resort I did found the content of my cart using $paypalService->getLastRequest() but seriously this is the raw XML returned by paypal and the api should be parsing it properly :(.
Thanks for reading
I had this exact same issue - while the XML returned by PayPal is fine, their PHP SDK doesn't parse it properly, so you can only ever see the last item in GetExpressCheckout.
I've posted a fix for this problem in an issue on PayPal's GitHub, please check it out:
https://github.com/paypal/SDKs/issues/37

Paypal multiple items in URL

I have a Redirect to take the buyer to the Paypal cart. The URL it forwards them to is (formatted for readability):
https://www.paypal.com/cgi-bin/webscr?cmd=_xclick
&business=email#domain.com
&pal=BGUR9WCWZAL7G
&button_subtype=services
&no_note=1
&no_shipping=1
&rm=1
&return=http://127.0.0.1/store/thank-you
&cancel_return=http://127.0.0.1/store/payment-cancelled
&shipping=0.00
&custom=LoggedInUser|45
&currency_code=EUR
&item_name_1=Store 9 Item
&amount_1=12.00
&item_name_2=Something else
&amount_2=24.00
I can't use Post data for design reasons.
If I have it as a single item by passing &amount=1&item_name=5 Store Items it works fine, but I need to break it down into individual items if possible.
Is this do-able? I see this question:
Paying for multiple items (at once) via paypal
But it's for posting, not a url
You may want to try the cart upload method. See this page for more information.
It will basically turn out something like this:
https://www.paypal.com/cgi-bin/webscr?cmd=_cart
&business=email#domain.com
&pal=BGUR9WCWZAL7G
&button_subtype=services
&upload=1
&no_note=1
&rm=1
&return=http://127.0.0.1/store/thank-you
&cancel_return=http://127.0.0.1/store/payment-cancelled
&currency_code=EUR
&item_name_1=Store 9 Item
&amount_1=12.00
&quantity_1=1
&shipping_1=0.00
&item_name_2=Something else
&amount_2=24.00
&quantity_2=1
&shipping_2=0.00

Magento Get Last Order Id on Payment Info Block Email

See above is a picture of new order acknowledgement email of Magento.
On the website we're developing we use Fontis Australia extension (http://www.magentocommerce.com/magento-connect/fontis-australia.html) to implement BPay payment method. The extension works ok, except that on the order acknowledgement email, the Email ref always show 000000.
I try to look at it and see that the ref number generated need the order ID as input to generate the correct ref number.
The extension use this code to get the last order number on payment info block:
$order_id = Mage::getSingleton('checkout/session')->getLastRealOrderId();
I try to use and print the result from other controller, it shows the correct order number. But seems that for the payment info block on email, the order number info can't be retrieved. Actually the same block also called out on the checkout success page, and it shows correctly.
Can somebody suggest other way to get the last order id on payment info block on Magento Email?
In info template you can use $order = $this->getInfo()->getOrder(); to get Mage_Sales_Model_Order object. Then you can get current order id by $order->getData('increment_id').
But with this code, you get error in checkout process, because $this->getInfo() returns other model.
So dirty solution, that works for me without errors, is:
$info = $this->getInfo();
if ($info instanceof Mage_Sales_Model_Order_Payment) {
$order = $info->getOrder();
echo $order->getData('increment_id'));
}

Can I retrieve a users subscription info from paypal at any time?

I need to determine when a user's paypal subscription is set to end/renew. I know that the easiest way to do this would be to extrapolate it from the time when the initial subscr_signup gets sent through, based on the subscription interval value, but because I'm working with some 3rd party software, it's not possible (or at least, not ideal).
It seems to me that I ought to be able to send a query to paypal to get this info based on txn_id, but I can't find any documentation that implies that this is the case.
if you send a request with:
TRXTYPE = R -this is to tell it recurring profiles
ACTION = I - this is to tell it to make an inquiry
ORIGPROFILEID = XXX - this is the profile you want to look up
PAYMENTHISTORY = N - this will tell it not to return payment history
from there the array will return something like this:
RESULT[1]=0
RPREF[12]=XXXXX
PROFILEID[12]=XXX
STATUS[6]=ACTIVE
PROFILENAME[1]=0
START[8]=10182006
TERM[1]=0
NEXTPAYMENT[8]=10182009
PAYPERIOD[4]=QTER
TENDER[1]=C
AMT[5]=0.00
ACCT[16]=XXXXXXXXXXXXXXXX
EXPDATE[4]=0101
AGGREGATEAMT[6]=0.00
AGGREGATEOPTIONALAMT[5]=0.00
MAXFAILPAYMENTS[1]=0
NUMFAILPAYMENTS[1]=1
RETRYNUMDAYS[1]=4
NAME[11]=BLAHBLAH
ZIP[5]=12345
What you are looking for is the START, but pretty much all the items in the array are self explanitory.