PayPal IPN response not getting a payKey or trackingId? - paypal

I'm trying to get the whole PayPal AdaptivePayments#Pay working, that part works. I pass a bunch of stuff in, get a paykey, which I pass to the approval url:
{returnUrl: urls[:return],
cancelUrl: urls[:cancel],
requestEnvelope: {errorLanguage: "en_GB"},
currencyCode: "GBP",
trackingId: self.id,
receiverList: {
receiver: [{email: Rails.configuration.site_paypal, amount: self.amount, primary: true},
{email: self.provider.paypal_email, amount: self.amount, primary: false}]
},
actionType: "PAY",
ipnNotificationUrl: urls[:ipn]}
The server comes back with everything correctly, I redirect to the url, it works, I get the payment in my PayPal sandbox account for Rails.configuration.site_paypal and in the IPN history I see the message but I have no way to identify it as it doesn't contain a paykey or trackingId :(
transaction_subject=
txn_type=web_accept
payment_date=10:06:09 Aug 17, 2012 PDT
last_name=Baldry
residence_country=GB
item_name=
payment_gross=
mc_currency=GBP
business=<Rails.configuration.site_paypal>
payment_type=instant
protection_eligibility=Ineligible
verify_sign=Asu0z613h-fyw8CNuZEjSsMXS58PAi46SzR3IvXXTX5JUizhF8vV4z25
payer_status=verified
test_ipn=1
tax=0.00
payer_email=<customer#email.com>
txn_id=9M582867K79935008
quantity=0
receiver_email=<Rails.configuration.site_paypal>
first_name=Michael
payer_id=M7U3UVA3E65VY
receiver_id=375R229JBE3TY
item_number=
payment_status=Completed
mc_gross=157.00
custom=
charset=windows-1252
notify_version=3.6
ipn_track_id=c9fcf587d770f
What am I doing wrong? Ripping my hair out...
Thanks

There are two types of IPN's
One is generated for the account that receives the money, based on their profile settings (It looks like that is the one you are getting)
The other is generated for the API caller (who may or may not be financially involved in the transaction). The API caller's IPN will include the PayKey.
If the API caller, and one of the receivers are the same, Make sure that you can either differentiate between the two IPN's you will receive, or that you have separate URL's for each. (The API callers is specified when making the API call, the receiver's is specified on the PayPal profile)

Related

PayPal Smart Button transaction not charging after 'approval'

After spending a full day on this dangerous thing, I can't understand how a transaction show APPROVED, I get an order ID, but there is no charge (not for buyer or receiver).
I am on live environment after tested on sandbox successfully.
So the code is long but basically on the server side we first create the transaction:
const request = new paypal.orders.OrdersCreateRequest();
request.prefer("return=representation");
request.requestBody({
intent: 'CAPTURE', //CAPTURE
purchase_units: [{
amount: {
currency_code: currency,
value: finalPrice
},
payee: {
email_address: payee
},
shipping: shipObj
}]
});
and later we approve the order with PayPal :
let request = new paypal.orders.OrdersGetRequest(orderID);
let order;
try {
order = await client.execute(request);
}
catch (err) {
console.error("error",err);
return res.sendStatus(500);
}
At this point i get order.result.status = APPROVED .
This is a live environment (the client and secret keys).
How can you send APPROVED to developer, and give an orderID but not charge ?
This is such a dangerous thing to do and can literally ruin businesses.
So then i found out there is a link to your order ID :
https://api.paypal.com/v2/checkout/orders/4PE63643WC652674S
If you look in this page you get this :
"message":"Authentication failed due to invalid authentication credentials or a missing Authorization header."
Now, only god knows what this means, and this is a failur message on an order ID page, which mean the orderID means nothing ??
So i also check the paypal link with my client-ID (should be identical to my client id in sdk right?) :
https://www.paypal.com/sdk/js?client-id=xxxxxxxxx&merchant-id=xxx#yyyy.com&disable-funding=credit,card&currency=USD
Which seems ok and contains the right email.
Seems like you may have solved the issue and that you were missing the capture step, which is a required step to commit the transaction and must always occur after approval.
Just to review the best ways to integrate, if you are doing so with API calls from a server, you'll want to set make two routes on your server, one for 'Set up Transaction' and one for 'Capture Transaction', documented here: https://developer.paypal.com/docs/checkout/reference/server-integration/
Then, the best JS customer approval flow to pair with those server-side routes is this: https://developer.paypal.com/demo/checkout/#/pattern/server

Paypal shopping cart AMOUNT_ERROR

I am having a issue with a paypal cart since the update around march (bit late but the site is not used yet and we just discovered it now).
I already checked this question but it did not solve the issue for a shopping cart (Paypal : hosted button payments fail with code=AMOUNT_ERROR)
We send a object that contains the request data through a plugin called neo.js, this works fine as far as we know.
This is our data we send to paypal as a js object.
{
amount_1: 10.01,
business: "noreply#domain.com",
cancel_return: "https://dev.domain.com",
charset: "utf-8",
cmd: "_cart",
currency_code: "US",
custom: "username",
item_name_1: "$10 item",
item_number_1: "1",
no_shipping: 1,
notify_url: "https://dev.domain.com/callback/paypal.php",
quantity_1: 1,
return: "https://dev.domain.com",
upload: 1
}
It has to do something with the amount, but using a , instead of . but that only gives a normal error message on screen that the format is incorrect.
We have tried multiple things including the dollar sign and making it a string but nothing seem to be working.
I reproduced the error and it is due to the wrong currency code passed.
You are passing "US" but the currency code (that is a parameter that refers to the AMOUNT as in the error returned) must be of 3 characters as you can see on PayPal guide: https://developer.paypal.com/webapps/developer/docs/classic/api/currency_codes/
Change it to "USD" instead and you will have a working checkout.

GetPrePaymentDisclosure returning Internal Error

I'd like to use this endpoint to display the calculated fees on my site before taking the user to the paypal site; however, when I query the endpoint with a valid payKey, I receive an internal error.
Endpoint: https://developer.paypal.com/docs/classic/api/adaptive-payments/GetPrePaymentDisclosure_API_Operation/
To generate the payKey, I'm POSTing to svcs.sandbox.paypal.com/AdapativePayments/Pay with the following request body:
{
"actionType":"PAY",
"currencyCode":"USD",
"feesPayer":"SENDER",
"requestEnvelope": { "errorLanguage": "en_US" },
"cancelUrl":"test.com/cancel",
"returnUrl":"test.com/return",
"receiverList": {
"receiver": [
{ "email": "someguy#email.com", "amount": "80.00" }
]
}
}
Any ideas as to what's going on?
Note: I had to edit out the valid URLs because I don't have enough reputation.
For GetPrePaymentDisclosure you must supply senderEmail in the PAY request for it to function.
This is because GetPrePaymentDisclosure is supposed to be used to determine the status of the transaction and see if it is covered by the Remittance Transfer Rule.
From the Documentation: This API is specific for merchants who must support the Consumer Financial Protection Bureau's Remittance Transfer Rule.
It does not work to determine the fees beforehand if it does not hit these rules. As all you will get back is [status] => NON_RTR with no information.
If you would like this functionality outside of RTR transactions you should submit a feature request on PayPal's Technical Support Site

PayPal Payflow: How to verify in one request, and then authorize in another without saving CC info?

I'm building a book store and I am building the checkout using PayPal Payflow . This is the checkout flow:
Shipping info --> Billing info |verify CC using Paypal| --> Order summary --> Submit |authorize CC using Paypal|
Shipping info: fill out shipping address, nothing special here
Billing info: fill out your billing address + credit card info. Don't save the credit card info since it's against standards, instead just send the CC number, expiration date, and CVV directly to PayPal to verify. PayPal approves.
Order summary: The order sees the summary of his order before he submits the order. He presses submit and another request to PayPal is sent to authorize the funds.
However, the CC info vanishes after #2, so how would I persist that data to #3 so that I can send it to PayPal again?
Can I just use the ORIGID to point to the PNREF ? The documentation says I have to do a full request with the whole params list (including CC info, CVV, exp date, etc).
TRXTYPE=A&TENDER=C&PWD=x1y2z3&PARTNER=PayPal&VENDOR=SuperMerchant&USER=S
uperMerchant&ACCT=5555555555554444&EXPDATE=0308&AMT=123.00&COMMENT1=Seco
nd purchase&COMMENT2=Low risk customer&INVNUM=123456789&STREET=5199
MAPLE&ZIP=94588
Or am I just misunderstanding what authorization means? Isn't authorization actually reserving funds in the user's CC? So that shouldn't be done until the user presses submit order right?
I figured it out.
The documentation here: https://www.paypalobjects.com/webstatic/en_US/developer/docs/pdf/pp_payflowpro_guide.pdf
on page 40 mentions it briefly, but doesn't go into much detail about this checkout flow even though it seems pretty common.
My assumption was right, in that I could just do an address verification request first with all the CC info, and use the PNREF returned. I save the PNREF id in my session and reuse it to submit a request that looks like this:
def authorize_transaction(pnref)
make_request(authorization_data(pnref))
end
def authorization_data(pnref)
{
"TRXTYPE" => "A",
"TENDER" => "C",
"USER" => PAYPAL_API["user"],
"PWD" => PAYPAL_API["pwd"],
"VENDOR" => PAYPAL_API["user"],
"PARTNER" => "Paypal",
"AMT" => purchase.total_price,
"ORIGID" => pnref,
"VERBOSITY" => "HIGH"
}
end
And receive the desired response:
{"RESULT"=>"0", "PNREF"=>"A10A6A9C08E1", "RESPMSG"=>"Approved", "AUTHCODE"=>"752PNI", "AVSADDR"=>"Y", "AVSZIP"=>"Y", "HOSTCODE"=>"A", "PROCAVS"=>"Y", "VISACARDLEVEL"=>"12", "TRANSTIME"=>"2014-01-31 11:53:56", "FIRSTNAME"=>"net", "LASTNAME"=>"theory", "AMT"=>"15.64", "ACCT"=>"1111", "EXPDATE"=>"0115", "CARDTYPE"=>"0", "IAVS"=>"N"}

Cannot capture amounts after DoExpressCheckoutPayment with parallel payment

I user PayPal's Express Checkout API to make an parallel Payment. Everything works fine, on the payee site, the 2 payments are booked as "open".
While DoExpressCheckoutPayment I get an transaction id for each payment. But a doCapture fails with "You%20do%20not%20have%20permissions%20to%20make%20this%20API%20call". A single authorized payment that I made several weeks ago but have never captured gives me just "Order%20has%20expired%2e" - which is fine.
I use the following parameters for the NVP API:
$parameters = array("METHOD"=>"DoCapture",
"AUTHORIZATIONID"=>$transactionid_item,
"AMT"=>$amt_item,
"CURRENCYCODE"=>$currencycode,
"COMPLETETYPE"=>"Complete"
);
when of course the variable are the corresponding values to each payment. (plus authentication/api credential).
What am I doing wrong? Is there an additional variable to set when I make a parallel instead of an single payment?
regards,
chris
This is an example call and the response:
https://api-3t.sandbox.paypal.com/nvp?METHOD=DoCapture&AUTHORIZATIONID=O-67121848EA448750G&AMT=9.70&CURRENCYCODE=EUR&COMPLETETYPE=Complete&USER=xxx&PWD=xxx&SIGNATURE=xxx&VERSION=95.0
array(9) {
["TIMESTAMP"]=>
string(28) "2013%2d06%2d15T09%3a35%3a52Z"
["CORRELATIONID"]=>
string(12) "140dec053198"
["ACK"]=>
string(7) "Failure"
["VERSION"]=>
string(6) "95%2e0"
["BUILD"]=>
string(7) "6444009"
["L_ERRORCODE0"]=>
string(5) "10007"
["L_SHORTMESSAGE0"]=>
string(19) "Permission%20denied"
["L_LONGMESSAGE0"]=>
string(67) "You%20do%20not%20have%20permissions%20to%20make%20this%20API%20call"
["L_SEVERITYCODE0"]=>
string(5) "Error"
}
It looks like you are running your Express Checkout API call as an order, then you are turning around and doing a DoCapture request but you are passing over the order id for the auth id instead of the authorization id. If you are wanting to set your Express Checkout to be an order instead of an auth or a sale, then you need to perform the calls in the following ways.
SetExpressCheckout API call (processing as order)
GetExpressCheckoutDetail API Call
DoExpressCheckoutPayment API Call (processing as order)
DoAuthorization (performs an auth, and passes over the order id that you received from the EC flow)
DoCapture (performs a capture against the auth, you will pass over the auth id that was returned in the previous call here, not the order id)