Paypal Adaptive payment Pay key validation received from IOS - php

In our app we are using IOS MPL library to make the parallel payment. After I get the pay key from the IOS, when I tried to validate it using PHP app, it shows me the following error:
[error] => Array
(
[0] => ErrorData Object
(
[errorId] => 540031
[domain] => PLATFORM
[subdomain] => Application
[severity] => Error
[category] => Application
[message] => You do not have permission to get these payment details
[exceptionId] =>
[parameter] =>
)
)
But If I create a parallel payment using PHP Adaptive payment API, I am able to validate the paykey and get the correct receipt.
Also what I found is when I try to create the parallel payment in PHP it asks me for App ID, API Username, API Password and API signature. But when we use IOS MPL libarary it just asks for App ID. In sandbox mode we always use same APP ID - APP-80W284485P519543T, which is same for all(universal). Then how the app will know identify who has made the call?
When I create a payment in sandbox mode using PHP application, and try to validate the transaction using a different "API credentials", then I get the same error "You do not have permission to get these payment details", which I receive when we try to do with IOS Pay key.

Here is the reply I get from the Paypal:
This is AP txn made through MPL sdk library from an iPhone app of the sender. The api caller is the sender.
The receivers in the parallel payment are different.
When one of receiver a/c made paymentdetails api call, he is the api caller for this call. So there are few restrictions on what info a api caller can view in paymentdetails api.
The receiver a/c holder will be able to view only his leg of transaction since he is NOT the original api caller that created the payment key.
That's why after paymentdetails API, you can only see the leg of your transaction information.
Also I asked Paypal, if there is a way in MPL library to define the API credentials of the merchant which can be used while doing Adaptive payment instead of the sender's API. They said no, MPL library is not built like that.
So finally, I have used IPN call to resolve the problem. Instead of updating the DB by validating the Pay key I get from the IOS device, what I did is: i have told the IOS developers to send the IPN url in Adaptive payment call. Then through the IPN url I update my database.

Related

Paypal Payments REST API - REQUIRED_SCOPE_MISSING

Fails when Execute() an Authorized Payment after user approval.
scopes
:
"openid profile email address phone https://uri.paypal.com/services/expresscheckout"
consent_uri
:
"https://www.sandbox.paypal.com/webapps/auth/protocol/openidconnect/v1/authorize?client_id=my_client_id&response_type=code&scope=openid%20profile%20email%20address%20phone%20https://uri.paypal.com/services/expresscheckout&redirect_uri=https://www.my_site.com/src/paypal.php"
[http_code] => 403
[url] => https://api.sandbox.paypal.com/v1/payments/payment/PAY-55313193UK1537019LCXIDBA/execute
[header] => Array
(
[0] => Content-Type:application/json
[1] => Authorization:Bearer user_access_token_from_identity_api
[2] => PayPal-Partner-Attribution-Id:pp_attr_id
)
[post_data] => {"payer_id":"3BTU9WTCHAU2Q"}
[response] => {"name":"REQUIRED_SCOPE_MISSING","message":"Access token is missing required scope.","information_link":"https://developer.paypal.com/webapps/developer/docs/api/#REQUIRED_SCOPE_MISSING","debug_id":"e40c3f6b601a"}
)
I am only using one sandbox client_id and I have the Accept Payments and Use Seamless Checkout permissions enabled.
https://developer.paypal.com/docs/integration/direct/identity/seamless-checkout/
Any insight is greatly appreciated.
Do you have "Subcription" mark checked in Your app config under the "APP CAPABILITIES" -->> "Advanced options" on developer.paypal.com ?
TLDR; I was allowing user login separate from checkout and was signing the checkout requests using that Identity API token. In reality, the Identity token is only useful to log a user into my website, at which point a new Bearer token for the Restful API's should be requested and used.
Answer: From pp-randy on Github:
The access_token you need for your rest payments should be using this API call.
The only token I see from you is from the Identify endpoint /v1/identity/openidconnect/tokenservice which is not correct for the REST Payments.
Randy was right - I was signing the API requests using the token returned when I logged in the user with the Identity API.
In reality, the user's access token that is returned by the Identity API has only one purpose, to sign the request to "/v1/identity/openidconnect/userinfo/" which gets the unique_id used for login.
I was signing requests to the Payments API with that same token returned by the Identity API when I should have been using the token provided from this endpoint:
"/v1/identity/openidconnect/tokenservice"
Paypal Reponse Times:
My ticket on Github Paypal SDK was answered in 4 - 5 days
My ticket in the Merchant Services Queue was answered in about 4 days
Entire troubleshooting can be found here:
https://github.com/paypal/PayPal-PHP-SDK/issues/785#issuecomment-282749095
Randy from the Paypal SDK went above and beyond to answer my question, even though I do not use the SDK. Thank you Randy!

PayPal Sandbox - Error 10002: You do not have permission to make this API call

I'm trying to use the PayPal API for express checkout using PHP. I used this guide as a template. When connecting, I receive the error message:
[TIMESTAMP] => 2015%2d07%2d20T15%3a32%3a37Z
[CORRELATIONID] => 3a93310587276
[ACK] => Failure
[VERSION] => 109%2e0
[BUILD] => 17403434
[L_ERRORCODE0] => 10002
[L_SHORTMESSAGE0] => Authentication%2fAuthorization%20Failed
[L_LONGMESSAGE0] => You%20do%20not%20have%20permissions%20to%20make%20this%20API%20call
[L_SEVERITYCODE0] => Error
The error has no correction listed in the errorcode doc:
developer.paypal.com/docs/classic/api/errorcodes/
Upon further research into the error, I read here that you must confirm your email on your paypal account, which I have. Since I'm using a sandbox api account, I also attempted to confirm it, however when I try to from the notifications panel under sandbox test accounts, and I copy/paste the confirmation link into my browser, it tells me the confirmation code is invalid, even if I paste it into the input field. But if I log into the sandbox site with the sandbox account whose email I'm trying to confirm, and when I click confirm in the email section on the email which failed to confirm before, it now says it's already confirmed. Still receiving the above error though.
I've made sure to use the sandbox account api credentials when configuring the connection. It's also a business-pro sandbox account, and the endpoint is for sandbox.
Is there anything obvious that I've missed?
Is there anything additional I should post?
There are a couple of different reasons that you would get that message. One reason is your credentials are incorrect, make certain there are no spaces in your credentials.
Another reason for that error message could be related to the endpoint you are using. If you are using Sandbox API, make certain you are using the Sandbox Endpoint.
If you are using Live API credentials make certain that you are pointed at the Live Endpoint.
API Error codes PayPal Developer
Express Checkout Endpoints
Another reason, if you are doing a DoDirectPayment Api Call, make certain that the account you are using is setup for PayPal Payments Pro.
You simply dont have acess to the api, they need to give you a token(in this case called Signature) to you acess PayPal API. You probably need to check you email adress, if that doesnt work just register again on the Paypal Developers :)

Integrating Paypal classic API

I have made an e-commerce website, but unfortunately I am stuck here when I want to integrate Paypal classic API with my live site. Though I have tested the integration with sandbox which is success, but when I tried to go live it keep returning error. The error I caught is :
Array
(
[Errors] => Array
(
[0] => Array
(
[Receiver] =>
[Category] => Application
[Domain] => PLATFORM
[ErrorID] => 550001
[ExceptionID] =>
[Message] => User is not allowed to perform this action
[Parameter] =>
[Severity] => Error
[Subdomain] => Application
)
)
)
and my classic API information is this :
Adaptive Payment
Basic Payment
1.Checkout, Send Money or Parallel Payments
2.Currency Conversion
3.Get Payment Details
4.Refunds or Chargebacks
Confirm Funding Sources You Support
1.Credit Card Payments
2.E-Checks
3.PayPal Balance
Adaptive Accounts
Basic Payment
1.Create Business Accounts
I and the Classic API status right now is : "Approved Conditionally".
It looks like from all of the information provided that the application has not been fully approved. I recommend calling in to PayPal support to check the status of the application.
You can go to https://www.paypal-apps.com/ and log into your PayPal account. Click 'My Messages' to send your request to PayPal App team. They will review your case and get back to you.

PayPal Adaptive Payments - User is not allowed to perform this action

I am using paypal adaptive payments and i had sandbox account for this to be test for last 2 months it was working very much fine and all the transactions were successfully made by using sandbox.
Now what i'm trying to do is want to go live with adaptive payments get all the necessary information api id,password,signature, ap id etc. the problem is i'm facing right now is getting this error
Array
(
[responseEnvelope.timestamp] => 2014-12-08T21:53:30.943-08:00
[responseEnvelope.ack] => Failure
[responseEnvelope.correlationId] => f8bdc47c42067
[responseEnvelope.build] => 13414382
[error(0).errorId] => 550001
[error(0).domain] => PLATFORM
[error(0).subdomain] => Application
[error(0).severity] => Error
[error(0).category] => Application
[error(0).message] => User is not allowed to perform this action
[error(0).parameter(0)] => Chained Payment
)
and i dont know where is the problem can you please help me out
The error is because you Adaptive Payment application is not approved for Chain Payments and you are trying to execute Chain Payments API.
Go to apps.paypal.com and check(I can see that you are not enabled for chain Payments). In order to resolve the error, create a new application at apps.paypal.com and check "Chain Payments" and then use the new APP-ID to initiate this API call. It is also possible when your business/premier account is not Verified
P.S Btw, it is not possible to update the current application as it is already approved.So create new one.

Paypal Adaptive Pay

When I run a PayPal Adaptive Pay call, and I set about 3 receivers, how to I get the status of each of the receivers?
Because I get something back like this:
Array
(
[responseEnvelope.timestamp] => 2012-11-05T13:17:48.598-08:00
[responseEnvelope.ack] => Success
[responseEnvelope.correlationId] => 8e31ecdad58ca
[responseEnvelope.build] => 4110101
[payKey] => AP-6TJ00518SC231111B
[paymentExecStatus] => COMPLETED
)
Does this go through the IPN or can I view it in a sandbox area? I keep re-reading PayPal docs and Im so confused :)
just use PaymentDetails api to obtain an array of PaymentInfo elements with status for each receiver. If you have permissions from each recipients to make GetTransactionDetails API calls on-behalf of them (which you can obtain using Permissions API) you can use the TransactionID from the PaymentDetails API response to obtain further more transactional data for each one of the sub-transactions.

Categories