How to refund transaction in paypal? PHP Code - paypal

How to refund a transaction at once after pay? I use express checkout and need to refund payments atonce after pay if user paid for some product by mistake.
I found some link:
https://developer.paypal.com/docs/integration/direct/refund-payment/
But it seems to be wrong, because seems I have to send not only transaction id.
If just send curl post with a transaction id, what is non-sandbox link for refund?
I'm doing it via API

Are you sure that paypal is not sending you a transaction id?
Try to do a var dump on $_GET['id'] and see if you get anything... or just check if you get any response in the url. else something is going wrong.

Related

Paypal API get payment confirmation

I am able to post payment data to the Paypal REST API, and I get a response.
However, I ran some tests and entered incorrect expire dates and invorrect CVV2 numbers, but the response I get from the API is that the credit card has been approved.
From searching around, I understand that I should use the IPN to get a confirmation of the payment. I setup the IPN listener, and when I use the simulator to test, everything seems to be working.
My question is, how to I trigger the IPN callback on the payment? Or what would be the correct method to fully test the credit card details?
Any suggestions would be greatly appreciated! TIA!
Yes, in live env., it will return the same failed response than a wrong card number.

Buy with pay now vs pay with subscription on IPN paypal

I'm having problem with payment on subscription IPN paypal.
If I set cmd is '_xclick-subscriptions', after payment, I saw IPN response to update my db is very slow.
But if I set cmd is '_xclick', after paypmen, I saw IPN response to update my db is very quickly, seems immediate...
Does anyone know about this problem. Could you help me??
Thanks you so much!
If you rely on time then you need to use Express Checkout for subscriptions.
This is because you won't need to wait for an IPN notification to update your database, instead you will get the answer from paypal right away in an API call.
In your case you will need the credentials of the person who will receive the money, not the person who is going to subscribe. You need the follow the process described here: developer.paypal.com/docs/classic/express-checkout/
Here you can see some diagrams: here

What happen if I don´t send my transaction id to PayPal PDT?

I'm testing my PayPal's accounts with SandBox, I read that after PayPal answer I should send a post request with my transaction id, but I don´t understand why. When PayPal send's me request with GET, mi account show operation complete, so:
1.- Why I need send a post request with confirmation if PayPal already done the transaction?
2.- Why I need a Identity token if PayPal already done the transaction?
Thanks.
I've been thinking, after read many times the process, and the reasons to use PDT instead IPN, answered both questions:
1.- I need send a post request to PayPal to verify transaction is real and was made to me.
2.- I need a identity token, because that's the way to say to PayPal "Hey, it's really me, tell me if transaction is real and was made to me"
This avoids that malicious users send me false url request or repeated request (in that case PayPal should't tell me SUCCESS". So, at the time to know than transaction is real and was made to me, I can update my stock, for example

Paypal merchant acceept or deny each transcation

I'm developing website for online shopping in which i have integrate paypal as payment method.
but, i want each transaction must be confirmed by merchant so that merchant can accept or reject(decline-deny) each transaction.
payments for the rejected transaction will be refunded to payer. and accepted transaction will we processed as confirmed order.
is their any way to do this ?
please help me on this. thanks in advance
I found my answer.
now i will go with "paypal authorization capture api"
for this i need to use paymentaction="authorization" in my paypal standard payment form that make the transaction on hold.
and at admin side i need to make that onhold transaction make capture to proceed order or void orders to cancel i just need transaction id their.
i will use "paypal authorize and capture api" for that...
you should manually lo-gin into you merchant account to reject(decline-deny) each transaction.

Capturing payment; express checkout

Hi
I have paypal express checkout working on my site, when user buys something the transaction goes through and the merchant is able to capture payment by clicking on the capture button on the sandbox site. Problem is that I need 'capture status' returned to the site as I need to store it in database for future use, is there a way that paypal sends some notification whenever the payment is captured by the merchant.
Thanks
PayPal IPN: https://www.paypal.com/ipn
In short, include NOTIFYURL in your SetExpressCheckout and DoExpresscheckoutPayment call and you'll receive a POST on that URL when the transaction has been captured. Look for 'PAYMENTSTATUS', as that should read 'Complete'.
Don't forget to validate the POST by sending it back to https://www.paypal.com/cgi-bin/webscr?cmd=_notify-validate and checking for a VERIFIED / INVALID response.