I'm using this gem for payments in my rails app:
https://github.com/jpablobr/active_paypal_adaptive_payment
I can not make a refund, I get the next message in response log:
...refund_status="NO_API_ACCESS_TO_RECEIVER">]> response_envelope=#<Hashie::Rash ack="Success"....
I am using the pay_key for make a refund.
Its possible fix this error?
Thank you so much!
Ok the problem was, For a receiver to grant permission to refund to the API Caller:
Login to www.paypal.com (For Sandbox: www.sandbox.paypal.com - Make sure you are already signed in https://developer.paypal.com) and login with the receiver account. Goto Profile -> API Access -> Grant API Permission -> Input the API Caller (Example: May6_1307031077_biz_api1.paypal.com) in Third Party Permission Username textbos and click Lookup button -> Enable checkbox for "Issue a refund for a specific transaction" and click Add button.
This is how receiver can grant permission to API Caller.
Once this is enabled, the refund should work.
Founded in https://www.x.com/developers/paypal/forums/adaptive-payments-api/adaptive-refund-notprocessed
Edited.......
You can see on https://www.x.com/devzone/articles/paypal-permissions-and-advantages-integrating-permissions-api If you need make this feature with Api you can use this gem:
https://github.com/moshbit/paypal_permissions
Thank you very much!
I was having the exact same problem and my issue could not be resolved by the accepted solution. My problem was that I sent money from a merchant account to a seller account and was trying to refund the transaction, but there is (currently) no way to grant API permissions from a personal account to allow the refund transaction to go through. I just called Paypal, and they said that there's no way to complete the refund I was attempting to do, but since I only needed the refund for testing purposes (to make sure there was always money in my merchant account), they suggested that I instead just send an equal payment from my personal account back to my merchant account. I hope this helps someone.
Related
I'm building an application where a user can connect their own Paypal account through Paypal Permissions SDK (https://github.com/paypal/permissions-sdk-ruby). I was able to successfully get permission from the user and was able to store the tokens that were returned from the Paypal Permissions SDK. Now, I am using the following gem for Express Checkout (https://github.com/nov/paypal-express). But the documentation for Paypal Express Checkout on behalf of a user is not clear on how we should use the tokens to invoke a call for Express Checkout.
I have the following codes
#api = PayPal::SDK::Permissions::API.new({
token: #credential.paypal_access_token,
token_secret: #credential.paypal_secret_token
})
Where #credential is my object stored in the database that has the tokens from the Paypal Permissions SDK.
Now after getting, I can use the #api object to get Paypal Username, Password, and Signature
request = Paypal::Express::Request.new(
:username => #api.config.username,
:password => #api.config.password,
:signature => #api.config.signature
)
Now, my problem is that the money isn't going directly to the users paypal account but it is going to our account (we made an account so that we can create a Application in the Classic API part of Paypal).
Is there anyone who can help me? or point me to the right direction?
When calling API on behalf of other account, you need to add parameter "subject" to indicate the account that you are calling API for. The value of "subject" could be the account primary email address or payerID. Then the money will go to the account which was the value of subject.
Yihui gave the right answer. But I wanted to explain/post here what I did to fix my problem (using Yihui's guidance).
You need to get the Payer ID from the 3rd Party Permissions SDK of Paypal. So you will need to ask for the following "ACCESS_BASIC_PERSONAL_DATA", "EXPRESS_CHECKOUT", and "REFUND".
Then you will need to use the NVP (Name Value Pair) SDK of paypal to perform Express Checkout on behalf of another party/merchant.
For more information, we followed the following article of Paypal
https://developer.paypal.com/docs/classic/express-checkout/ht_ec-singleItemPayment-curl-etc/
I am using paypal-adaptive gem in myapp and i have multiple receivers
there, one is admin and second one is project owner.Now I want to
verify each project owner email using paypal and need following steps
:
In Project owner account settings there is a form containing input
PayPal Email & name of project owner
When click one submit ,it should redirect to paypal and project
owner should login in Paypal to verify application & redirect to my
app & get verified .
This might help if you are still looking:
The GetVerifiedStatus API operation lets you determine whether the
specified PayPal account's status is verified or unverified.
A PayPal account achieves verified status under a variety of
circumstances, such as when an account is linked to a verified funding
source. Verified status indicates a trust relationship. For more
information about verified status, see the Frequently asked questions
about the verification process.
Note: In addition to GetVerifiedStatus, you can use Log In with PayPal or the Permissions API to gather information about PayPal users. Please see the documentation of these interfaces for more information.
Read more on document: https://developer.paypal.com/webapps/developer/docs/classic/api/adaptive-accounts/GetVerifiedStatus_API_Operation/
I would like my user to login his Paypal account after registering in my iPhone app. However I was unable to find any api calls in MPL for this.
I checked the REST API calls. Unable to find what I'm looking for.
Is there any way to login Paypal and store the session details and use it for checkout ?
Or do I have to go through the default flow of Paypal button -> Login -> checkout ?
If I select 'Keep me logged in' while logging in with the above mentioned flow (using Paypal button), when will this session expire ? Will my user have to login in Paypal again ?
To my understanding, you must use the Login button to initiate the payment flow. I'm not sure what the session expiry is but I would guess it is similar to the web client's one. If they are not on a fresh install, they will be logged in next time they use the app, provided that they selected that option.
I am not clear of the question though, hope what you are asking about how to keep the user logs in after a session been initialized. So, the session timeout is totally controlled by the server end (Paypal backend server), this is due to the security reasons I guess.
If you want to know the number of seconds your the session will be kept alive, you can refer to the property given in the JSON respond,
"expires_in": 28800
This is given in their tutorial https://developer.paypal.com/webapps/developer/docs/integration/direct/make-your-first-call/
I had to deal with a similar situation, so what I did was I took this value just after user logs into the application and created a NSTimer which gets fired after the 'expires_in' time (i.e. in 28800 seconds), so whenever the time expires, I give a message to the user saying that he should refresh his Paypal login before continue with the purchase. In that case, user won't be surprised at the end of his purchase flow by having to login into the Paypal again. So anyway, that was my requirement, hope you can use this information to get around with your issue.
EDIT
Is there any way to login Paypal and store the session details and use
it for checkout ?
Can you save the Cookie ID in the storage (Keychain or NSUserDefaults)
when will this session expire ?
Refer to the response property I described above please
Will my user have to login in Paypal again ?
If you save the Cookie ID, theoretically I don't think so, but I haven't done it so cannot really answer.
Using the PayPal REST API, I cannot seem to figure out how to cancel a payment after a client clicks the "Cancel order and return to website" link. Perhaps in production mode PayPal cancels these payments automatically, but in sandbox mode they seem to stay in the "created" state.
That observation lead me to believe that I need to programmatically cancel each payment upon return to the website's "cancel_url" page. However, I cannot seem to find a cancel function in the PayPal REST API documentation.
https://developer.paypal.com/docs/api/
For what it's worth, I'm using the Ruby API.
I have been in contact with PayPal's technical support last week and this is what they said:
If the buyer has completed the work on the PayPal checkout page
without cancelling the checkout, then they are redirected back to your
site. If you wish for them to have a cancellation at that point, you
can build the Return URL to have a final confirmation (showing final
total to be billed). So at this point the buyer is on your site, but
the payment execution has not happened. If the buyer decides to
proceed, then you run the execute command, updating your database with
the successful payment details. If the buyer decides to cancel at
that point, you do not run the execute command, and purge the payment
ID and the buyer's Payer ID. There would be no request that you would
need to pass to PayPal to cancel what the buyer did on PayPal. This
would be the same type of process done with the Classic APIs using
Express Checkout. Once the buyer gets sent over to PayPal, they
choose the funding source and shipping address and get sent back to
your site, if they want to cancel the transaction, your site does not
send any API call to PayPal to cancel or void the EC token. It is
just not used to collect the payment.
When asked how to handle non-executed payments and if they automatically void non-executed payments after a certain amount of time:
Yes, I recommend deleting the Payment ID from your database, so there
is no accidental payment. Our system, by default, will expire the
payment approval made by PayPal payers if the payment hasn't been
executed within 3 hours.
Permission has been given by PayPal to post their answer here.
I actually talked directly with someone from PayPal. The answer was:
Once a user authorized a sale, the sale has to be executed. It cannot be canceled
past beyond that point. So if the user comes back on your return URL, you are
simply expected to run an "execute" command on your payment.
This may not directly apply to your case. I think that the only way to "cancel" would be to first "execute", then apply a full "refund". Otherwise, never execute (which I also view as strange because that looks like a potential for security problems. That said, the main problem that could happen is an "execute" on the payment and your company would receive the money that you can then manually refund if necessary...)
I think you need to void the authorization of the payment:
https://developer.paypal.com/docs/api/#void-an-authorization
I used paypal api v2, and there is cancel order api.
https://developer.paypal.com/docs/api/orders/v1/?mark=cancel%20order#orders_cancel
I have create the basics of subscription Paypal using the RailsCast and now I'm doing what is missing there.
Now I'm developing the process to do the Devise user registration together/just after the payment is done. For now, I'm trying something like this and this.
As the RailsCast got the e-mail from PayPal using this line:
#subscription.email = PayPal::Recurring.new(token: params[:token]).checkout_details.email
So, I thought that I could get first name, middle name and last name from PayPal as well. From PayPal documentation it seems that it is possible but I couldn't get it through paypal-recurring gem.
I have tried to see if I can learn what I have to do from paypal-recurring GitHub docs and code but I couln't find and tried some possibilities without success.
Is it possible? Maybe in another way not using paypal-recurring gem?
If you have another recomendation/reference to do this registration process, please, let me know.
Update
As #Andrew suggested PayPal IPN, I thought it would be better update my question as I want to have the first_name from PayPal as a default value to ease the process to the user register in my database but he or she may want to change to another name.
The process that I want is something like:
The user chooses his plan and to pay with PayPal
User is sent to PayPal
User fills payment info on PayPal site
User is sent again to my site
My site gets e-mail and name of the user from PayPal and asks the user to confirm or change the data, and provide his password to create the login to my site
My site uses the user data provided to register the user and sends the request to PayPal to request the payment and create the recurring profile
Ok, based on your current outline of steps you can handle that exact flow using Express Checkout.
SetExpressCheckout will generate a token for you, and you then redirect the user to PayPal. They review and approve the payment and are then redirected back to your site. There you can call GetExpressCheckoutDetails to obtain the email, name, address, etc. and display a final review page for the customer to confirm everything or make changes if necessary. Finally, you'd call DoExpressCheckoutPayment to finalize the payment using the customers confirmed details.
I would look at PayPal IPN (Instant Payment Notification). It'll POST transaction details to a listener script you have sitting on your server so you can process the data accordingly in real-time.