Any code to integrate paypal in ASP.NET Core 6 MVC? - paypal

I am developing my first website e-commerce with Visual Studio 2022 and ASP.NET Core 6 MVC. Could someone share with me some code in order to integrate Paypal payments for this version of website?
PS: also, if there is any tutorial that you advise me in order to follow and develop my first e-commerce with ASP.NET Core 6 MVC.
Thanks

Could someone share with me some code in order to integrate Paypal payments for this version of website?
For Paypal integration you should attach it with your order in that
case you can Call the v2/checkout/orders API directly. Here are the URL.
Endpoints For v2 Orders API
Server-side create: https://developer.paypal.com/docs/api/orders/v2/#orders_create
Server-side capture: https://developer.paypal.com/docs/api/orders/v2/#orders_capture
Understand how it works
Here you could have a look how to implement implements on the order page. So that it will be easier for you to understand. You just need to call a few APIs.
Paypal Integration Guides
I would suggest to follow the PayPal Checkout integration guide and make 2 routes on your server, one for the 'Create Order' and one for 'Capture Order' (see the optional step 5 in 'Add and modify the code'). Both of these 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 this frontend approval flow: https://developer.paypal.com/demo/checkout/#/pattern/server
.Net server-side SDK
You can get the SDK sample here: https://github.com/paypal/Checkout-NET-SDK
(using this SDK is optional, direct HTTPS API calls first using a clientid+secret to obtain an access token are also possible. In any case, do not use the deprecated PayPal-NET-SDK which is for the old v1/payments API)
Note
While you would be working on implementation, if you encounter any specific issue feel free to post that. That will be more convenient to assist you on this. First, try to implement within your application.

PayPal website says to use Braintree. Here is the link to the tutorial for you: https://developer.paypal.com/braintree/docs/start/hello-server/dotnet

Related

PayPal Node SDKs: difference between paypal-rest-sdk and #paypal/checkout-server-sdk for webhooks?

I have this question regarding 2 npm PayPal packages, what is the difference between
paypal-rest-sdk and #paypal/checkout-server-sdk ? And can you implement webhooks using #paypal/checkout-server-sdk or there is no need for webhooks for this package ?
paypal-rest-sdk
checkout-server-sdk
var paypal = require('paypal-rest-sdk');
const paypal = require('#paypal/checkout-server-sdk');
All PayPal-*-SDK for every language have been deprecated for a long time and should not be used for anything. This includes the one for node that's in npm as #paypal/paypal-rest-sdk.
The Checkout-*-SDK for every language, in npm for node as #paypal/checkout-server-sdk, implements the v2/checkout/orders API (and only that API). It can still be used if desired, although I've heard it will be deprecated soon as well. Currently all developer.paypal.com documentation only references doing direct HTTPS REST API integrations, using a client id and secret to first obtain an access_token. For node in particular, there is a full stack example in the PayPal Checkout integration guide that serves as a useful starting point, although I recommend the client side onApprove function in this approval flow since that sample includes client-side error handling of the capture response (restarting or showing an error as appropriate)
As for webhooks, they are a separate matter. There is no current SDK for them. The server-side capture API response is already sufficient for normal orders API payments so you may not need webhooks for what you're doing, but if there are specific events you're interested in listening for (such as refunds or disputes that occur on PayPal.com ) you'll need to subscribe to the event(s) you want -- either in the REST app or using webhook API calls.

EuPlatesc payment integration

EuPlatesc is a Romanian provider for online payments.
I want to integrate this in Sylius platform as a plugin. I've reached the phase where I'm handling the step after checkout that reaches CaptureAction.php.
However EuPlatesc works with a POST request made to a secure url, similar to this description PHP Redirect with POST data.
Is it possible to implement this kind of behavior in Sylius ?
You can use Payum\Core\Reply\HttpPostRedirect class, which makes a POST request and redirects user to payment processor page. The example of it usage you can find in Be2Bill gateway

How to use PayPal API credentials?

I need to add PayPal button on client's website. It is first time I am doing this and I asked for credentials he gave me API signature, API username and API password. I was checking lots of tutorials how to add PayPal button, they use sandbox/live Client ID and Secret. Can I use this API credentials instead?
I searched a lot but couldn't find an answer.
I am coding in CodeIgniter 3.
Thanks
Username, Password, and Signature are related to Classic API integration.
Client ID and Secret are related to the REST API integration.
Which one do you want to work with?
Or, the easiest option is to use PayPal Standard Payment Buttons, but that will also be the most limiting.
We actually have a PayPal CodeIgniter Library that you might be interested in. It was built for the Classic API.
The general PayPal PHP SDK that it's based on is now available with Composer, so I would recommend installing it that way.
We'll be releasing an update to that library before the end of the year that adds all of the REST APIs. It's available in the dev branch on GitHub already.

Paypal Rest API and Permissions API from classic

Im trying to implement paypal on a website, where I want to give my site-users the ability to add paypal as an payment option for there web shops. So I'm using Laravel, and I found this one, http://jslim.net/blog/2014/09/19/integrate-paypal-sdk-into-laravel-4/ and do pretty much like that.
So my question is, is it possible to combine the Permissions API from the Classic API and using the Rest API for my shop? And then could anyone point me in the right direction?
Currently adding PayPal REST API and Classic API SDKs are causing namespacing conflict issues, as to prevent breaking changes in REST API. The work is under way to release 1.x version of REST APIs that would allow you to work with both rest and classic APIs together.

Correct API for accepting credit cards directly on my site using PayPal?

We need to accept credit cards (from anywhere in the world) directly on our website. We'd like to use PayPal, but NOT require a PayPal account. The user should be able to simply type in the credit card, date and cvv directly on our site and go. I'm having a hard time figuring out what PayPal API I need to use for this, to integrate with our Java-based server. Turns out PayPal has an overwhelming number of APIs and documentation.
It looks like this link is what I'm looking for... sort of. But can I post this directly from JavaScript? It includes account name and password, which would be in the clear for anyone to see, so I'm thinking this must be server-side code. So the idea is to use a REST API to do this? So the client must pass the credit card information to my server, which then calls PayPal's server?
I'm a little lost, when looking at all the APIs at the Rest API page. Which ones exactly do I need to use?
There is also this link but I'm not familiar with "curl" -- looking for Java. Maybe the distinction is minor and easy to convert from one to the other?
Vern, if you look at the top of this page, you'll see Java (click Java) as one of the languages supported by the PayPal REST Payment API:
https://developer.paypal.com/webapps/developer/docs/api/
You will see related sample requests that use the Java SDK:
https://github.com/paypal/rest-api-sdk-java