PayPal for Play2 / Scala - scala

I am looking for a decent implementation of Paypal's IPN for reuse in a play application.
I found https://github.com/liftmodules/paypal but have no idea if this can easily be reused or ported or if better implementations exist for play-framework. I havent found any other that look either stable / maintained or so simple that I can understand them myself...
Here's my technical question:
(how) Can I "use" (that) lift-modules inside play-framework ?

Consider the usage PayPal API like in this example or directly use PayPal's core sdk. You must specify next parameters (some of them are optional, for more details see PayPal's specificaion):
clientID
clientSecret
tokenCredential
accessToken
amountDetails
transaction
redirectUrl

Related

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

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

Braintree payment integration : Using Client AuthorizationTokenization Keys

I am using Braintree payment in my app. It works perfectly fine using nonce method using server, this method.
But now our requirements changed and we are not allow to use any sever to verify nonce.
In Braintree we can use tokenization key authorizes clients to tokenize payment information. But there is not any descriptive information about it, this method. Only one line of code is provided in doc and there is no other resources I found useful for tokenization key method.
let apiClient = BTAPIClient(authorization: tokenizationKey)
How to use it with DropInUI ?
apiClient is always return nil.
Also I checked Briantreeios demo, but its very confusing. In some example I don't know how payment method work and on which end points used to verify details and deduct amount.
Thanks in advance.
Full disclosure, I work at Braintree. If you have any further questions, I recommend contacting Support.
You are not able to perform transactions directly from the client. Braintree is a full stack solution that requires a server integration with one of Braintree's available SDKs or by using the GraphQL API. In either case, you cannot make payments directly from the client using a tokenization key.

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 with Notifications

PayPal has recently released a new API which should replace the old API. The new API is based on a REST approach.
As fare as I can see there is no option to define a callback URL. In the old API the parameter was 'notify_url'. I use the following documentation:
https://developer.paypal.com/webapps/developer/docs/api/#create-a-payment
Is there a parameter in the new REST API which allows to define a notification URL?
Unfortunately, the REST API is still pretty far behind the classic API's with all of the features they provide. To my knowledge, notify_url/NOTIFYURL simply aren't included in the REST API yet.
That said, if you have IPN configured in your PayPal account profile the REST API calls should still trigger them. It's just that you can't override the value there with a custom one using notify like you're talking about.
The classic API's aren't going away, though. You can still use them just fine.

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