PayPal Instant Payment Notification for Held Payments - asp.net

So I'm using an API to receive payment notifications,
I don't really care what's in the notification I just want paypal to notify the API when a payment has been made and execute my own code.
So first off is this even going to work?
I put the URL for the API in the Instant Payment Notification under my account settings. My account is still new because I sent a test payment and it didn't work, do held payments not notify the IPN?

If the payment is held within PayPal it will notify via IPN, yes. You will be able to see such held payments by logging into www.paypal.com and viewing the activity. There will also be a "pendingreason" value in the IPN, to notify you of why it is held.
Note that if at transaction time a "notify_url" is set by the integration (many older shopping carts do this), that URL will be used in place of whatever is set at the account level in www.paypal.com. Whatever was set at transaction time has precedence.
--
If an order is "on hold" by your shopping cart (pending payment), PayPal will not send any notification as nothing has taken place within its system (except maybe a checkout attempt that was clicked on but not finished for whatever reason)

Related

Recurring and non-recurring items in single PayPal checkout flow

I'm currently migrating a website from WooCommerce to Shopware 6, which needs to support recurring payments for a membership subscription.
WooCommerce is still using PayPal Standard, which allows you to mix non-recurring line items with a recurring subscription, in a single checkout flow.
Shopware 6 uses the REST API, which doesn't appear to support this ability and the only solution appears to be using the Javascript SDK:
User clicks Pay with PayPal.
Subscription is created via actions.subscription.create
Dialog is displayed requesting approval.
Customer approves.
Submit original checkout.
Redirect to PayPal.
Complete payment.
Redirect back to website with confirmation.
A potential solution I'm looking into now is changing the return URL of the initial order creation to redirect to a billing agreement approval URL and have the return URL's of that redirect back to the original return url.
Overly complicated and the worse UX I've ever seen.
Before I tear what's left of my hair out, does anyone have any suggestions?
UPDATE
Although it isn't the solution I was hoping for, I ended up removing the Shopware 6 PayPal plugin and implementing my own payment method using the NVP API.
From the user perspective, there is only one approval process. In the backend, once the user has approved the transaction (that has been marked as needing a billing agreement) the transaction is verified and then a recurring profile is created.
There's no way to combine Subscriptions and one-time payments in a single checkout. Such items even require different parameters on the PayPal SDK line, if using the PayPal buttons to show an in-context experience.
The in-context experience is best, since it involves no redirects away from your site to PayPal and back. Here is the flow for one-time payments:
Make two routes on your server, one for 'Create Order' and one for 'Capture Order', documented here. These routes should return only JSON data (no HTML or text). The latter one should (on success) store the payment details in your database before it does the return (particularly purchase_units[0].payments.captures[0].id, the PayPal transaction ID)
Pair those two routes with the following approval flow: https://developer.paypal.com/demo/checkout/#/pattern/server
A similar (separate) flow can be used for PayPal Subscriptions. Only one subscription can be approved at a time.

Paypal button and site reservation

In my app I plan to use the pay pal buy now button to sell tickets.
My plan is to
When the user selects tickets to buy, create a reservation marker saying 1 ticket have been taken.
Give this reservation a time to live of lets say 15mins. If the user hasnt bought it, I will auto close the reservation and the ticket inventory goes up
The user clicks pay now buton, sends to pay pal. Lets say this takes 30mins
User completes transaction
Paypal calls back to my site
However at this point I would have closed the reservation and they would have paid but I have no ticket for them
How do I handle this pattern?
Using PayPal buy now button you will always have that problem because the payment itself happens in PayPal site and you don't know exactly when.
In your case is better to use an Express Checkout, where the last step of the payment process will occur in your site. This means that you can verify that there are possible reservations just before the payment is done.
If you look at the process flow from the following image, you can verify if reservations are open just before calling DoExpressCheckoutPayment:

PayPal Failure notification

I have an asp.net application
The User can purchase items and/or upgrade an existing service. I use PayPal to handle payments.
When the order is placed I put the order details into a table as a record. I also do this so that if the User revisits my page I check a flag in that table to tell them whether payment has been received.
If not received then I display a message on my web page telling them they have requested and upgrade and that we are currently waiting for payment.
I also disable any future purchases for that User so that they do not upgrade twice (or more).
Now, it occurs to me that when the User is redirected to PayPal to make that purchase that a payment could fail or they could close the web page.
In that case then the User would not be able to ever upgrade unless they send me a support email.
What is best practice? Wait for a time period to elapse and if no payment then allow User to try again or stick with the support email route?
If it is best to wait for a period of time what is an acceptable period of time to wait for?
I am using the post back of Form values method to imitate payment to PayPal:
https://www.paypal.com/cgi-bin/webscr
What you can do.
Each time the user is ready to leave your page and move to paypal to pay, you create
Clone of their order
A new unique ID connected with that cloned order.
So, if one order if fail, at any time the user come back is find a new set "Order"+"Unique ID". With that 2 elements can make a final payment.
You may end up with two or tree or more cloned orders, but from my experience because this is what I really do, is rare, and its safe for your customer and you.
Also please note that paypal is accept only one unique id for each order. If one ID is fail, then you must create a new one anyway.
The unique id you send to paypal go to the invoice parametre.
The manual for all parametres is this pdf - PayPal Payments Standard Intergration Guide... and there are more pdf for paypal...

Payment gateway possible issues

I have implemented 2 payment gateways in my app (paypal and datatrans). In both gateways payment happens on gateway site i.e. user is redirected to payment gateway site where he pays and then redirected back to our site.
I have identified some scenarios where there is some issue in entire payment flow. E.g.
lost internet connection after payment and so order is not placed but money got debited from user's account
PayPal sent response but application got exception and so user did not get confirmation
Double payment due to hitting refresh button when transaction was in progress
I would like to know what are standard exceptions should be handled in payment gateway integration.
Any example with paypal would help me lot, I use asp.net mvc 3. thanks.
Double payment.
To avoid them you need to create a unique ID for every order, after the user move from your site to the paypal or other site, this ID must be read-only, and if the user return to your site after fail or other reason, and ask to re-order the same cart, you must create a new cart, and a new order ID.
For every order id, paypal and other sites allow only one payment (or one fail).
Lost the internet connections, or not get confirmations
Paypal have 3 ways that contact with your.
IPN
PDT
emails.
The one is that you get information from the return of the user after the payment, the other method is that paypal communicate with you and send you the payment informations, and final you get email.
In the rare case that all fails, user will inform you after some days that he did not get his order.
Practical they never fail all of them. Actually they never fail any of them.
Exceptions and bugs
Well some times you can not avoid bugs, so monitor your payments and log any possible errors to fix it. After 7 years of payments with paypal I still monitor them for problems, fraud, issues, new thinks etc, and still make some small adjustments time to time.

How to transmit data recieved from the product/service buyers to the payment gateway?

I am willing to know how the process of sending the user account information, payment amount information as well as product/service id information to the payment gateway is conducted.
Where does the data from my last jsp page goes out there in the payment gateway?
How the transmitted information is synchronized and understood when they don't know my thing about the product/service m offering,prices and other flexibilities associated
or whether they expect me to be preparing a fully accomplished shopping cart and the finally tell them the final amount the buyer has to pay. what actually happens out there?
Most inline payment processors are willing to just take an amount. If you're sending the user to an external payment site, you'll normally have to send a cart. Each different payment processor will most likely give you a schema or webservice to use to send them a cart. The cart won't stay synchronized, just updated whenever you send that user to the payment processor.

Resources