Payment gateway possible issues - asp.net

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.

Related

I'm having a problem with my website, using wordpress / woocommerce

I'm having some trouble with the rejected payments in my online store, I want something more "clear" for the people trying to buy stuff and their payments fails. The problem is when a payment is rejected or it fails, the website sends the users to the "order confirmation" site again in a infinite loop, all what I want is that the website sends the users to the payment screen/website so they can try to do the process again.
Is there a woocommerce webhook that can do what I need?
Or better, in short:
Instead of sending me to the order confirmation screen/website again, i want the website to send me to the payment site, so the process can start again in the event of a rejected payment. It's like, I need to change the way it redirects me from the orders to the payments. I don't now if I'm clear enough

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 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...

If I turn on IPN can I still redirect my button users to my custom response pages?

I am currently using email2db to read the emails PayPal sends regarding new subscriptions, payments, cancellations, etc.
Now that I have 6 different fork, including 1 from intl.paypal.com and one from paypal.co.uk it has become difficult to manage my db with email2db.
This is a production system. I want to know if the existing system will remain intact if I turn on IPN for testing and development. I need it continue to redirect the subscriber to my currently chosen thankyou page as included in my button code.
Is it safe for me to activate IPN?
Thank you,
Gordon L
IPN is an entirely separate process from anything else you do. It's simply a notice you can have PayPal send when you get a payment or the status of one changes (i.e. chargeback etc). So it's safe to use with any payment process.

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