Authorize/Capture for PayPal - paypal

Using PayPal IPN, can we implement delayed payment. Perfect example is Groupon where card is charged only when deal is tipped. Can someone throw light on implementation part using PayPal IPN and also how multiple cards can be charged at once when deal is tipped.

For Authorize And Capture:
To make a payment authorize you will have to pass "authorization" in paymentmethod parameter instead of "sale"
<input type="hidden" name="paymentaction" value="authorization" />
So, For this type of payment, paypal will not charge the sender immediately but will wait till receiver confirmation. To capture this payment two methods are available:
Receiver will either click on capture button in account
It can be done via a API - to capture the payment use DoCapture and void the payment use DoVoid

Related

Notification URL for PayPal IPN and recurring payment

I'm working on implementation of PayPal recurring payments, but I have some doubts.
The steps to create a recurring payment profile are:
Call SetExpressCheckout (with L_BILLINGTYPE0=RecurringPayments)
Get the TOKEN
Call CreateRecurringPaymentsProfile with the token and the billing frequency
Receive the response with the ID of the active profile.
If I set the notify URL (PAYMENTREQUEST_0_NOTIFYURL) in SetExpressCheckout does PayPal IPN notify about recurring payment?
According to https://www.paypal-community.com/t5/Merchant-services-Archive/Recurring-payments-IPN/td-p/350104?profile.language=en CreateRecurringPaymentsProfile does not accept the notify URL but SetExpressCheckout does!
The SEC call does indeed set your IPN. Remember, you're setting up everything with PayPal to process a payment (setting the stage, so to speak). So it makes sense that it, and it alone, would accept the IPN callback (I wouldn't want conflicting IPN URLs in the various calls afterwards)
I would still specify an IPN URL in your account just to be safe, but yes, if you provide an IPN callback you will get notifications sent to that callback.

Paypal Adaptive - 3 way paments (without taking the user to Paypal site)

We would like to configure our shopping carts to leverage Paypal Adaptive - 3 way payments.
However we do not want the user to be redirected to the Paypal site to approve the payment.
Are there any options to leverage (Paypal Adaptive - 3 way payments) in a seamless manner?
Reference Paypal documentation (page 71):
https://www.paypalobjects.com/webstatic/en_US/developer/docs/pdf/pp_adaptivepayments.pdf
"Making a Chained Payment (XML)
A chained payment is when a sender sends a payment to a PayPal-registered receiver who is
the primary receiver.
You send a PayRequest, enabling the primary receiver.
You receive a response with a pay key.
You must redirect the sender’s browser to PayPal to approve the payment."
Unfortunately, there isn't a way to bypass the redirect to PayPal for the sender to approve a Chained Payment. You can use Preapprovals to bypass any redirect for subsequent payments but even with Preapprovals the sender would initially need to be sent to PayPal to approve the Preapproval Agreement.

Custom Payment IPN notify_url

On my website I'm using a custom PayPal checkout form and one of the elements in the form is:
input name="notify_url" type="hidden" value="http://www.example.com/ipn.php"
On actual PayPal I have my real ipn link, but could I route this to another ipn?
For example, let's say under my PayPal settings my ipn is: http://www.example.com/ipn_1.php
Can I set this link to say: http://www.example.com/ipn_2.php and then receive payment notifications at ipn_2.php instead of ipn_1.php like it says in my merchant settings?
Yes, when you use notify_url that will override what you have in your PayPal profile so it would hit that IPN URL instead.

Why is DoExpressCheckoutPayment required for Paypal?

I am trying to build a very simple paypal-backed shopping cart so users can purchase multiple items. I want paypal to handle all the payment details. I don't even want an order confirmation. I will manually check for order confirmation on paypal.
At first I wanted to use "Website Payments Standard" because it seemed easy to create a form that will post to paypal and let paypal handle it from there. But no, this did not work because the "Website Payments Standard" buttons/form do not support submitting multiple items. I tried all sorts of key/value in my form, and it never worked.
Then I tried Express Checkout using the instructions found here. It largely worked, but as I understand it, after sending a SetExpressCheckout, you have to listen for a request from paypal and do a DoExpressCheckoutPayment to complete the transaction. SO reference.
I find this a bit troublesome, because what if my server fails to receive the request from paypal and I never send a DoExpressCheckoutPayment? So a customer THINKS they have finished submitting an order, but the order was never received.
Does anyone know of a way to skip this "confirmation" step? I find it unnecessary, and not sure why paypal requires it.
That's because Express Checkout and Website Payments Standard are fundamentally different products.
To use Express Checkout, you would call the SetExpressCheckout API. In the API call, you specify the details of the products, amounts, and the RETURNURL.
Once you post this data to PayPal's API endpoint, you receive a token in return.
You would then redirect the buyer, and append the token to the following URL: https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=EC-XXXXXXX
Once the buyer has agreed to your purchase, he is redirected back to the URL you specified in the RETURNURL.
You should now show the order confirmation, and call the GetExpressCheckoutDetails API**.
When calling GetExpressCheckoutDetails, supply the token. In the GetExpressCheckoutDetails API response you'll find a PayerID.
Now you're ready to call DoExpressCheckoutPayment, and charge the buyer. Remember to include both the token and the payerID when calling DoExpressCheckoutPayment.
Note: If you want to charge the buyer immediately by calling GetExpressCheckoutDetails and DoExpressCheckoutPayment immediately, redirect the buyer to https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=EC-XXXXXXX&useraction=commit.
The useraction=commit will change the "Continue" button on the PayPal 'Review your payment' page to a "Pay now" button.
--
The reason there's such a significant difference between Express Checkout and Website Payments Standard, is that Website Payments Standard is intended to be a drop-in working solution where PayPal handles the whole transaction flow. Express Checkout is a more flexible solution which allows you to integrate it deeply with an existing checkout flow of a website / shopping cart.
For your use case; lookat using PayPal 'cart upload' buttons.
See for an example https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_html_cart_upload
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="upload" value="1">
<input type="hidden" name="business" value="seller#designerfotos.com">
<input type="hidden" name="item_name_1" value="Item Name 1">
<input type="hidden" name="amount_1" value="1.00">
<input type="hidden" name="item_name_2" value="Item Name 2">
<input type="hidden" name="amount_2" value="2.00">
<input type="submit" value="PayPal">
</form>
Note however, that this is insecure by default, as the amounts you're going to charge will be plainly visible in the HTML.
** The PayerID is appended in the GET of your RETURNURL as well. So you could skip calling GetExpressCheckoutDetails if you wanted to.
For the purposes of this site, the DoExpressCheckoutPayment operation simply is required by the PayPal Express Checkout API.
You're correct that it's not required for PayPal to process a payment, but there are scenarios that would require a second operation. An example of such a scenario would be one where the user (your site's customer) is choosing a shipping address during the PayPal payment confirmation. Depending on your shipping provider(s), you may need to calculate actual shipping amounts after the user has chosen a shipping address on the PayPal confirmation pages.

Does Paypal send an IPN message when payment is captured?

We are using Paypal's Authorisation/Capture. When a user manually captures the payment (on the Paypal website), does Paypal send any notification?
We want our backend to recognise payments that have been captured and authorised versus payments that haven't been captured yet.
We would also like to be notified about payments that were rejected.
Please note we are not using the API.
OK, found out that there is no special variable for this, it is simply stored in the 'payment_status' in the IPN message from Paypal.
The statuses relevant to authorisation/capture are:
Completed (when the payment is captured)
Refunded (when the payment is refunded)
Pending (after the user makes payment but before the payment is manually captured)