In my website ,i need to refund a successful transaction. I have stored the transaction ID in my database.when clicking on the particular transaction ID ,i wish to go to the detail page of the transaction .Is it possible with PHP.
You can use the GetTransactionDetails API to pull details about a particular transaction and generate/display a nice detail page that includes a refund link/button of some sort.
Then you can use the RefundTransaction API to actually process the refund when that gets triggered.
If you're working with PHP I'd recommend taking a look at my class library for PayPal. It will make these API calls very simple for you, and you could have it done within a matter of minutes.
Related
I am trying to integrate the PayPal REST API into my Symfony 2 web app but I find hard to understand how exactly the complete workflow looks like:
The PayPal docs describe the following steps to accept a payment. One can use the PayPal Playground to simulate these steps:
Get an access token
Create a Payment object by querying the API
Redirect the user to the approval url received in the Payment response
After the user approved the payment on the PayPal page, he is redirected back to my page, using the success-link defined in the Payment object. Use the received information to execute the payment.
Payment is completed with status approved
From the docs: Once a payment is complete, it is referred to as a
sale. You can then look up the sale and refund it.
So far so good. BUT: Where are Webhooks used/fired in this workflow? I have defined a wildcard Webhook (accepting all possible events) in the PayPal Developer Dashboard.
My observation is, that my system receives the Webhook event 1-2 Minutes (!) after the user was redirected back to the success-link and after the payment was executed (Step 4).
Beside this long delay between executing the payment and receiving the Webhook, this workflow means, that I only receive the Webhook AFTER handling the success-link. This means, handling the success-link is absolutly necessary for the payment to be completed. Is this correct?
Do I need to use Webhooks?
I already asked this question a few days before and the answer by nifr is quite reasonable: One cannot trust the user to follow any redirect URL but should only rely on the Webhook events.
However this collides with the observations I described before, since I will never receive the Webhook without handling the redirect URL...
So, handling the PAYMENT.SALE.COMPLETED webhook event does not make a lot of sense, since this should already be done in when handling the redirect URL. Correct?
However, to handle updates on pending payments, handle refunds or reversed payments, etc. are only possible by listening on those events.
So the answer is: Only use Webhooks to get updates on payments made before. Correct?
So, the main questions are:
The 5-step process to accept payments does not say anything about using Webhooks. This does not seem to make a lot of sense, because without Webhooks one would miss update events, etc.? So, is it really possible to implement the complete payment workflow without Webhooks?
If yes, how are updates (refunds, pending, etc) handled in this case?
If no, what is the right strategy/time to fulfill the order since it take quite a long time to completly receive and handle the webhook?
i am still a newbie in PayPal world, but few days ago i integrated PayPal Plus REST API in an online Shop, and from my understanding i can tell that the workflow looks like:
create a Payment
redirect to PayPal
Payer could pay using PayPal account OR (using Bank Direct debit or Credit Card Payment without PayPal Account)
After completing the process on PayPal side, PayPal redirect the user back to your success URL.
till now the user is still not charged(you got no money). At the moment where you (in your success URL) do $payment->execute($paymentExecution,$api); , you ask Paypal to charge the amount from user. BUT also after this, you got no Money. Paypal have first to process the charging and notify you later via WebhookEvents.
the Webhook Notification (with that nasty delay) is especially important when the user pays per direct debit or Credit Card etc. Processing such Payments takes few seconds/minutes.
the redirectUrl ist absolutly necessary for charging/executing the Payment.
here on execution succeed, just to tell the user, that he finished his Job, and you can here save/capture the PaymentID/Transaction id for later usage/update via WebhookEvent Listener.
so i would recommend you to update your Database(Payment completed) only after receiving notofications via WebhookEvent Listener and not in the success RedirectUrl.
I'm trying to pull in orders from paypal into my database. When I say orders, I mean orders from paypal buttons we have in various places.
I've dove into the REST API, but I don't see any API for searching for / listing transactions. I see a list of payment Resources, but that comes back with count 0.
I also see Sale Transactions in the API but that asks for a single transaction ID.
Is there a way I can periodically get transactions? I know this is possible because we use a tool called Shipstation that grabs new orders from Paypal and brings them into their system.
Thanks!
You can use REST APIs to do what you are wanting to do. You can use
GetPaymentList to do this. This is sample code from the PayPal Github PHP homepage. You will need to install and use the PayPal PHP SDK.
I'm trying to find a way of checking if a customer has clicked the final submit button to perform a transaction in PHP.
I need to send a second e-mail to different people when the customer makes a transaction, but as far as I can tell, there's no function or property to retrieve some sort of confirmation value.
I don't need to know if the payment went through or not, just if they clicked the last submit button, but the checkout page is hosted on Microsoft's servers.
All of the payment APIs will return a status immediately. You just have to look for it and handle it in your code. How this is done will vary by API.
You can use Silent Post* which is similar to Paypal's IPN. Basically a script on your server will be notified of all payments.
Use the Transaction Details API and look for the transaction in your unsettled batches.
* I am the author of that article
Is it possible to make Paypal payments using stored user's data (credit card info, name, address etc.) within cron job or other script execution without actual user present?
I want to implement autopayments on my service but I can not to use standard Paypal autocharge functionality because of its complexity.
What you're looking for is called Reference Transactions. You can use the DoReferenceTransaction API to accomplish your goal.
Using this API you simply pass in the transaction ID of a previous Authorization or Sale transaction along with a new amount you'd like to process. It will lookup the billing info saved on PayPal's system using that previous transaction ID, and then process the same source for the new transaction.
This works with both Payments Pro and Express Checkout.
I noticed you posted this with the adaptive payments tag, too. That would be the Preapproval API and the Pay API, but would not involve DoDirectPayment.
I am working on a PHP website with Google checkout Payment. I need to get the transaction id in the merchant calculation page using API Call back url. What method can I use for this?
Google Checkout offers a service similar to Paypal's IPN where they send all of the transaction information to a URL you specify. This includes the transaction number.