Paypal - What is "Executing Payment"? - paypal

Can someone tell me the difference between "creating payment" with "executing payment"? thanks.
Creating payment example: http://paypal.github.io/PayPal-PHP-SDK/sample/doc/payments/ExecutePayment.html
"executing payment" example: http://paypal.github.io/PayPal-PHP-SDK/sample/doc/payments/ExecutePayment.html

The first step is to create a payment.
You will pass all the variables required to Paypal and you will get back a redirect URL.
Only when you have the redirect URL you can send the user to approve the payment.
After the approval the user will be brought back to your website and in the response there will be a payerID.
Using the payer-ID you will execute the payment.
There is a description of the flow here:
https://developer.paypal.com/docs/integration/web/accept-paypal-payment/

Related

How can get the Transaction ID or Status for payment on Website?

I'm using PHP and this's my fist post and I have some doubts... The target is: "integrate the paypal payment for a online store, so when the user complete the car's items, he will be able to pay using PAYPAL platform, the website should receive some confirmation to ensure the purchase".
In my code I put the button for payment using this tutorial Client-Side REST (https://developer.paypal.com/docs/integration/direct/express-checkout/integration-jsv4/client-side-REST-integration/), I tried the button using the "test credentials" generated in SANDBOX/ACCOUNTS (buyer account test), but when the buy process finish I only receive de "alert()" message, but it's all :(....
I know !... I can change this alert() function for my own code, but the problem is: "where is the Confirmation ID o Transaction ID" for the payment ?
Whats I need to do to know where is the "Transaction ID" for the payment ?
Regards !
Using the demo code, once you get the alert that the payment was successful you'll need to login to the sandbox account at https://www.sandbox.paypal.com. You'll see your payment processed with the transaction id. Typically you'll be able to gather the information from the API Response or using GET to retrieve the data.
Show payment details: https://developer.paypal.com/docs/api/payments/#payment_get

PayPal API - How to keep the payment process on my website?

I run a small marketplace with multiple sellers where buyers can buy items and pay with PayPal. The problem is, when someone makes a payment, they are then displayed the "Payment Confirmation" on the PayPal website and are given a choice to either return to their PayPal account, or return to the website.
Is there any way to keep the payment flow on my website, except for the payment part? I notice when buying on Etsy for example, the buyer goes to PayPal to make the payment and is then immediately returned to Etsy for the payment confirmation. They never see the PayPal payment confirmation page.
I assume it could be because Etsy and PayPal have a special arrangement that isn't available to other sites? Or am I missing something in the API?
Right now, with the normal PayPal API, this is what buyers see:
NAME, you've just completed your payment.
Your transaction ID for this payment is: XXXXXXXXXXXXXXXXXXXX.
We'll send a confirmation email to your#email.com
Go to PayPal account overview.
Go back to "seller#email.com".
I can't even figure out how to change the "Go back to..." link to my website name in the hidden fields. PayPal just chooses to display the seller's (the person that received the payment) email address.
Is there any way to at least set a website name for them to return to with hidden variables? Keep in mind that I have different sellers, so it's not something I could set inside each seller's PayPal account.
Thank you :)
I assume you are using Express Checkout with Set/Get/Do EC API integration. Please check the below document for experience options available with Express Checkout API.
https://developer.paypal.com/webapps/developer/docs/classic/express-checkout/integration-guide/ECCustomizing/
The 'useraction=commit' in the PayPal payment auth url triigers the 'Buy' button. If you do not send that request paramter then it will show 'continue' button and you can complete rest of the process on your site.
However, if you are using Paypal Payment Standard product then you need to use Express Checkout to accomplish the outcome you are seeking.

Paypal PhP api security issue

I was trying to use the express checkout php api. Everything is working well in the sandbox environment. My question is regarding security.
After payment the sample code redirects to GetExpressCheckout.php?token=...$PayerID=.....; But after clicking "confirm payment" in my site and logging in to paypal account (did not confirm payment in paypal); I directly opened the same page in another tab, and it showed payment successful (which is not the case). Is there a way to prevent this or am I missing some thing.
I'm not following exactly what you're trying to say here.
The process needs to be...
1) Call SetExpressCheckout to retrieve your token and redirect to PayPal accordingly.
2) PayPal will return the user back to your ReturnURL if they confirm payment, at which point you can call GetExpressCheckoutDetails (optionally) and DoExpressCheckoutPayment to finalize the payment.
Not until DECP is completed does any transaction actually take place. The success message you're seeing probably came from GetExpressCheckoutDetails, which does nothing more than retrieve the buyer/order info so that you can finalize the payment on your site.

Paypal Payment Standard: Callback URL

On Paypal Sandbox:
After logging in using a test account and then clicking the "Pay Now" button, the user is redirected to "Thanks for your order" page inside Paypal. The page has three(3) links below the message that says:
Return to Test Store
Go to PayPal account overview
Add funds from your bank
Clicking the "Return to Test Store" will redirect me to the return URL I specified on my query string. This marks the order as "Completed" or whatever the value of the payment_status returned by Paypal is.
The Problem:
Clicking the other links bypasses the return URL and goes to user account profile which leaves the order incomplete even if the transaction was successfully paid because the return URL has the script to mark the outcome of the transaction.
The Question:
Is there a way to bypass the Thank you page and just redirect to my return URL so the transaction can be concluded accordingly?
BTW, I have my Test Business Account set to autoredirect to the return URL after the order.
You want to read about PayPal's Instant Payment Notification and about Identifying Your IPN Listener to PayPal.
You have the option to be notified whenever a transaction takes place, regardless of what users clicks on. Paypal's servers will make requests to a Notification URL you provide and give you informations about that 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.