Prevent PayPal Payments with payKey (Or refund instead) - paypal

I am trying to prevent paypal for allowing a payment I have created.
The scenario:
My App is creating a Payment. I get the payKey from PayPal and the Customer is redirected to PayPal.
When the Customer is not able to finish the Payment after 2 minutes I will delete the Order for him and then - if possible - I will force Paypal that the payment is not active anymore and the customer is not able to pay after these 2 minutes. For this I have to do at least of this:
send Paypal the payKey and tell Paypal: Do not allow to pay with this payKey! Just "Delete" the information for this order
after the customer paid - but after 2 minutes, so the order is deleted - I will tell Paypal the payKey and a refund has to be done right after the customer has paid. This is no problem I thought but because its an AdaptivePayment and chained paypal is not allowing me to refund the money because every receiver in the refund receiverList needs permissions to allow a refund by API Call.
So my question is:
Is it possible to prevent a Payment with an API call ? I did not find any information in the REST API Reference of PayPal.

The payKey cannot be deleted or change the expire duration. You can use delayed chained payment with IPN. You are the API caller and primary receiver, compare the transaction complete time with the paykey generation time to decide refund or pay secondary receivers.

Related

PayPal Subscription: Refund full or partial

I am using Paypal rest API on my site. Till now I have implemented flow for regular order -
Create checkout session
Approve Payment by Payer
Capture Payment
Refund against captured payment
For subscription, I have implemented -
Create a checkout session with a subscription
Approve subscription by the payer
But after this, I couldn't get any further to capture any payment even from webhook, against which I could initiate a refund. There is an API for subscription capture, but it only adjusts the outstanding balance with the current payment. Also, the API doesn't return any object that might carry any capture info to work on a refund.
Does PayPal have any way to refund against payments on recurring subscriptions?
Approved subscriptions will charge automatically on their schedule. That is the point of subscriptions.
To be notified of subscription payments, register a listener endpoint for the webhook event PAYMENT.SALE.COMPLETED.
To refund subscription payments, full or partially, use the rel:refund link within any such sale object to refund it. See the v1/payments/sale/.../refund API call.

Which webhooks to subscribe for payments on paypal recurring payments?

I'm creating a website using paypal recurring payments. Each month the payment happens automatically, but I need to know when this happens in order to update the user profile in my application, so I know until when the subscription is valid.
Using paypal webhooks, which events do I need to subscribe to in order to know when the payment actually happens (or fails) each month?

When to stop querying paypal api's for payment status?

Using the parallel payments paypal api. If user 1 makes a payment to user 2, I make a check using the api to make sure paypal returns the payment details as COMPLETED.
How long does paypal keep that COMPLETED payment record? Do they keep it indefinitely, or do they delete it after a while? I ask because I am at the stage of development where I need to decide if I should rely on paypal keeping that record indefinitely, or if I should create a record on my server that the payment has been completed, or if I should always check if the payment has been marked as COMPLETED by querying paypal?
The only reason why I "want" to check via paypal, is if the payment is ever returned to user1 as REFUNDED or PARITALLY_REFUNDED when paypal is queried using their apis. I would want to act accordingly in such situations.
It's not too much of an issue if the status is REFUNDED or PARTIALLY_REFUNDED as apparently people can't get refunds if they don't open a case with paypal before 45 days are up. I am more concerned about the REVERSED status, which can apparently happen any time, even after 45 days which is beyond paypal's control, as it is done by the credit card companies, if the user pays by credit card...
Using the PaymentDetails request I was able to pull my oldest Adaptive Payment transaction, which was over 60 days old and had no problems pulling it up using the transactionId field. It should be able to pull up payments as long as they are listed in the PayPal account (currently forever.)
This will work using the payKey field also if you are storing that instead of transactionId, however the transactionId is displayed in your PayPal account and is sent with IPN responses.

Refunds Using Paypal's Delayed Chained Payments

I am currently developing a web application which is a booking system for events.
Basically i want to use PayPal's Delayed Chained Payments system to do this:
BUYER makes a purchase through web app
ADMIN is the primary receiver of the funds
SELLER receives the funds 7 days after the event has occurred (less commission for ADMIN)
The reason i am leaving a 7 day period until the SELLER receives the funds is to allow for refunds and cancellations.
My question is:
Does the API allow me to interveen the delayed payment before the 7 days has elapsed, thus cancelling the payment to the SELLER and allow me to directly refund the BUYER the full amount. This is my ideal situation as it means their will not be the problem of the SELLERS account not having sufficient funds for the refund.
If anyone could help it would be great!
With Delayed Chained Payments you'll have the ability to cancel or execute the payment whenever you need to (within 90 days). So if the seller isn't able to supply the product to the buyer (or whatever reason) you can cancel the transaction.
Submitting a refund after a payment has been executed is a little tricky.
So to do a refund for a Chained Payment transaction you'll need to use the Permission Services API calls for the receivers to allow you to process refunds on their behalf. If they don't, you cannot refund the payment sent to another recipient.
After make delayed chained payment if you are not execute payment to secondary receiver then you can refund full amount of payment using refund api Call but you need to grand third party access .using grant api access

Transfer amount to credit card from paypal

I have stuck into the problem of related to transfer amount back to credit card from paypal when user cancel his/her transaction. I don't want to use paypal refund feature in our application. My client requires to send back amount at the same time when user cancel his/her transaction.
Can anyone guide me to complete this feature or is there any API to solve such type of feature.
Thanks in advance.
Dewan
I don't want to use paypal refund feature in our application. My
client requires to send back amount at the same time when user cancel
his/her transaction.
How PayPal Refunds
You don't want to use PayPal's refund feature, but you want to send money back to the buyer? This is called a refund. I am sure you are mistaking how PayPal refunds money. If the user pays with a credit card, they are refunded to their credit card. If they pay with a bank account or PayPal account, they are refunded to their PayPal account.
API calls that refund buyers
DoNonReferencedCredit would refund to a credit card you specify, everytime, and you do not need a transaction ID.
In a scenario where the buyer no longer has a card that was
associated with a transaction, or the time allotted for a refund in
PayPal has passed, you would want to use the DoNonReferencedCredit
API.
RefundTransaction would refund the funding source as described in the "How PayPal Refunds" paragraph.
If your main concern is to issue a refund, via API, you have a transaction ID (you say a payment has been completed so you should have a transaction ID), AND PayPal's refund time has not passed, you should use the RefundTransaction API.
You might be able to use something like DoNonReferencedCredit from the paypal API - but I'm not 100% sure on that.