Paypal integration with Paypal IPN - kentico

Need some help for Paypal integration. I did all the configuration what is mentioned in the documentation like: Paypal gateway URL, Return URL (Success), and Notification url (~/CMSModules/Ecommerce/CMSPages/PayPalIPN.aspx). But my order status is not updating even after the successful payment.
Using sandbox account for testing
Able to redirect to Paypal page (Sandbox account) and on completion of payment, successfully redirected back to site (thank you page) configured as Return URL in settings
Below is the sample return URL from after succesfult payment
/ConfirmPaypalPayment.aspx?amt=5.00&cc=USD&cm=en-US&item_name=Order%20ID%3A%201177&st=Completed&tx=83L5281177755044V
How can I make sure PaypalIPN is executed properly,
what else I need to do/check other than what I mentioned above.
Can we debug the the code PaypalIPN.asps.cs
Is there any webpart I need to add on the thank you page(ConfirmPaypalPayment)
I am testing this in my local site with Sandbox account
Please suggest.
Thanks,
Sharath

Documentation says: The default Kentico PayPal provider does not utilize payment notifications – Webhooks or Instant Payment Notification (IPN). If you require payment notifications for any custom functionality or integrations, you need to configure the related options for your PayPal Business account and implement the required handlers (either within the Kentico web project or a custom project).
The return page(thank you page) must contain the PayPal payment execution web part, which processes the payment URL parameters provided by PayPal and completes transactions.
So there is no IPN in the default payment flow, if you want to use IPN take a look at Creating a custom payment gateway. There is there an explanation and a code sample.

Related

Woocommerce checkout to process order on an separate WordPress site?

HOW TO MAKE WOOCOMMERCE BRIDGE !?
SITE A : WooCommerce have products no accepted by Stripe
Payment Gateway : WooCommerce Custom Payment Gateway Pro "Plugin"
Plugins related to this trick : AffiliateWP
SITE B : WooCommerce have products accepted by stripe
Payment Gateway : Stripe "Plugin"
How can I make integration between these site I want to make SITE B handle all Payment Process will come from SITE A
Explanation: when customer make order via SITE A when Fill all details for order like (Name, Phone no, etc..) and Choose Payment method (Custom one the site use) when click Pay order the plugin must forward all these details to SITE B and direct process payment via Stripe.
I know many sites work like this and I did some research about it, when customer click on pay now it make redirect to link likes this
https://siteB.com/wp-admin/admin-ajax.php/?action=pay_create&order_id=12345&source=siteA.com&payment_method=stripe
I have done research about it right now I don't know how exactly I must make this integration but i know some information may be right
Use REST API in SITE B
Create endpoint in SITE B to start receive API request from SITE A
Send payment request from SITE A (handle all variables like order_id, amount, customer details etc,, ) using > WooCommerce Custom Payment Gateway Pro plugin
Receive request and process payment via stripe in SITE B
QUESTION IS : how to make these integration in the right way?

How do I know if a payment is successfull in stripe

I have integrated the stripe Api in my website to process payments and It is working fine. The only problem is that after the a successfull payment, i don't get any response or an object to know if the payment is successful or not.
Stripe does process the payment and everything is fine but the question is how would I know that it is successful after stripe redirects the client to the success url ?
You can implement webhook in your application. After a payment is completed stripe will call webhook/callback of your application with the payment_status and other details. Have a look at documentation here Triggering actions with webhooks
Using webhooks and events is definitely the right way to go. You can listen for successful payments, failed payments, and other event types, then add some server code to take some action based on those events.
There's a mention of webhooks in Stripe's custom payments quickstart guide: https://stripe.com/docs/payments/quickstart#use-webhook
They also have a standalone webhooks guide: https://stripe.com/docs/webhooks/quickstart

How can I make payment using credit/debit cards using PayPal payment gateway in Node.js?

I am currently using paypal-rest-sdk and want to accept payment using the cards.
In both sdk's (paypal rest and paypal checkout), when I create an order, in response there is an approve URL:
{
"href":"https://www.sandbox.paypal.com/checkoutnowtoken=token",
"rel":"approve",
"method":"GET"
}
Which will take you to this page:
The payment with PayPal account (logging in) is working, it correctly redirects to the return URL.
However, the "Pay with Credit or Debit card" option is not working.
After filling the card information when I click on continue button a loading screen appears and nothing happens after that.
I have seen solutions using PayPal smart-buttons, but can it work using "Pay with Credit or Debit card" option?
What do you mean by "paypal-rest-sdk" ? The PayPal-Node-SDK is deprecated, do not use it for anything. Use the current Checkout-NodeJS-SDK.
Follow the Set up standard payments guide and make 2 routes on your server, one for 'Create Order' and one for 'Capture Order', documented here. Both routes should return only JSON data (no HTML or text). Inside the 2nd route, when the capture API is successful you should store its resulting payment details in your database (particularly purchase_units[0].payments.captures[0].id, which is the PayPal transaction ID) and perform any necessary business logic (such as sending confirmation emails or reserving product) immediately before forwarding your return JSON to the frontend caller.
Pair those 2 routes with the frontend approval flow: https://developer.paypal.com/demo/checkout/#/pattern/server

How to integrate Paypal with node js into REST way

I need to integrate paypal with node js ( first time ). But node js working as REST server with frontend built on mobile ( Android and iOS ). I think purpose of using return url and cancel url for web based frontend not for mobile.
Previously I implemented Stripe payment gateway which have simple system which generate a auth token on mobile and mobile sent this token to Node Js Rest API. So not node js application have buyer auth token and it process the required payment.
But I am very much confused how Paypal achieve same scenario.
UPDATE : I am using paypal official node js package https://github.com/paypal/PayPal-node-SDK
UPDATE : After more search, I see some steps in payment flow
User paypal payment create API into my REST API to get "payment id" and links.
Hit on approval_url link which used for fullfill buyer information on paypal site. After completion, Paypal hit automatically described return url in first API, along with payment id and payer id params.
In Return API, use payment id and payer id params to paypal payment execute API.
If all above is actual process to generate payment, Then I am assuming that Backend API only needed third Step which API url could be shared with mobile developer in their integration of paypal.
So Mobile will
create payment
Fill Buyer information
While Paypal automatically hit return url where backend API will execute payment.
If this is the recommended ( or only ) way to paypal integration with mobile and rest apis ?
The purpose of return and cancel url is to notify the client(mobile or web) for potential user action, if user completes payment then via return url and if user cancels payments via cancel Url
You can use rest or nvp PayPal will support both, they have rest endpoints which you can use to complete the transaction.
https://github.com/santhoshlfms/Android_PayPal_EC_NodeJs_Server_Sample (Node server)
https://github.com/santhoshlfms/Android_PayPal_EC_CustomTab_Demo (Mobile Front end)
you can follow these repo to figure out how to proceed.

Stripe and validate payments synchronously

I am integrating Stripe in my site and I have the following question. I have read in the official documentation that is needed to use Payment Intents / Checkout to accomplish with 3d secure payments but my doubt is: How can I validate a payment made through this methods in a synchronous way to allow customers to instant download a product without waiting to the webhook call?
I am using Symfony to build the front and the back of the system.
thanks
You don't need to wait for a webhook to get confirmation that a payment was successful. stripe.handleCardPayment will immediately tell you if the payment was successful or not. See the then promise fulfillment here.
If you're using new Checkouts, users will be directed to your payment success page on completion of payment. A webhook is sent to inform you of the payment completion in case the user closes the browser or tab before the redirect can happen.

Resources