authorize paypal payment on client and capture payment on server - javascript

I want to authorize the payment with Paypal on the client-side (React) and then the payment is to be captured on the server-side (ASP.NET). Is this possible using any library provided by Paypal? How can it be achieved?

You might want to take a look at webhooks from Paypal API. You can configure a webhook listener and subscribe it to any event you are interested in getting notified of. Paypal will then notify you (by sending an HTTP POST notification to a URL listening on your server that you have to provide when you configure the webhook) when any of the events you subscribed to occur.

Related

Ionic 4 Cordova Payment with Stripe and SCA

With the SCA (https://stripe.com/docs/strong-customer-authentication),
I have to update my payment routine that was using the Charge API : https://stripe.com/docs/payments/charges-api
From the documentation, i understood that my options are Payment intent : https://stripe.com/docs/payments/payment-intents
and Setup Intent : https://stripe.com/docs/payments/save-and-reuse
In order to communicate between my front End and my Backend, I use stripe.js Element.
The problem is that, in order to reach the PaymentIntent API, i need https, and Cordova is not https but only http from what i understood as specified in the Stripe documentation :
A Stripe Element contains an iframe that securely sends the payment information to Stripe over an HTTPS connection. The checkout page address must also start with https:// rather than http:// for your integration to work.
You can test your integration without using HTTPS. Enable it when you’re ready to accept live payments.
I would like to know how i could handle the Stripe PaymentIntent API with stripe.js Element on my Ionic Cordova application.
If anyone got an idea it would be an amazing help !
You need to switch to using Payment Intents here. Those API calls have to be made server-side, and your client-side Elements/Javascript calls can remain nearly same.

How do I detect payments using PayPal v2 and JavaScript?

I'm developing a server that will detect PayPal payments to a specific PayPal account.
I've started looking into the PayPal SDK and got lost... I saw that V1 is deprecated, so I probably should use V2.
The only thing that I need is that PayPal will call my server webhook once the account receives money.
How should I do this?
The only thing that I need is that PayPal will call my server webhook
Don't do that. Use a proper server integration.
You need two routes on your server, one for 'Set Up Transaction' and one for 'Capture Transaction', documented here: https://developer.paypal.com/docs/checkout/reference/server-integration/
The best approval flow for the customer to go through is: https://developer.paypal.com/demo/checkout/#/pattern/server , as your site stays loaded in the background, and it does not redirect away from your page.
When your capture transaction API call runs successfully and completes the order, you will have an immediate response with a payment object and transaction details. Thus, there is no need for the extra asynchronous step of waiting for a separate webhook call (which is prone to errors or exceptions), and your integration will be more robust.

Nodejs Stripe Webhooks

I am trying to create a stripe webhook for sending a notification to user email (not customer) every time a customer adds credit card to his account. Talked with stripe support team but, the only information they gave me was too implement it through stripe webhooks.
Stripe has some notification that we can enable and that will send notifications to user email but, it does not have a notification for when customer adds credit card details to his account and I am trying to implement that. Thanks in advance
I've already installed ngrok to run the webhook but, I do not know how to set up enpoint and create the webhook to send notifications to user
You can sign in stripe, Navigation to Webhooks in left dashboard. And then create a webhook endpoint with ngrok host and your webhook API route. Example,
you create an webhook endpoint API like POST /api/v1/webhooks/stripe => Your webhook endpoint is: https://ngrok.abc/api/v1/webhooks/stripe
Click here to redirect to stripe webhooks page
I'm not sure what you mean by "sending a notification to user email (not customer)" but Stripe generally won't send emails to your users.
You'd have to implement sending an email on card update yourself. Have a look at implementing webhooks (https://stripe.com/docs/webhooks/setup) and then listening for the customer.source.created event (https://stripe.com/docs/api/events/types#event_types-customer.source.created).
Will a Slack notification work for you? Here’s an automation I created using Pipedream’s free service that listens for Stripe's customer.source.created event (based on #Paul Asjes suggestion) and sends a message to Slack:
https://pipedream.com/#pravin/send-message-to-slack-when-payment-method-added-in-stripe-p_7NClk5
To use it:
Fork the template
Create an incoming webhook URL in Slack and add it to the Pipedream workflow
Copy the Pipedream endpoint and set it as the webhook URL for customer.source.created events in Stripe
I hope that's helpful! I confirmed that it works with a test event from Stripe. If the notification has to an email, do you use any email services like Sendgrid?

Stop redirection in browser. I will stay in app

I have created a website. and make a web view of this website in app. so android application shows a mobile website in app. but while having use app.. there are some functionalities to make payment and i will use a third party payment gateway.
When it will hit for the payment, third party gateway links open in mobile's browser not in app. So after the payment it shows an error bcz there is no session in browser. It's all in app.
coding is done in codeigniter.
So how i will redirect payment gateway in app not in browser. So i could not get error.
I don't know what your code looks like but you can use Intent to set which link to inside or outside the app.
You can simply tap into whatever the payment gateway returns and find out if the payment has been completed
Since yopu ve not specified on the payment gateway lets assume an example of paypall.
Paypall has an instant payment notification that you listenm o when payment is completed
his will basically send a confirmation to your server that tells you it has gone through.
Listen for this in the server(php codeignter) and send a notification to your android app that payment is completed.
So probably in your case check on the payment api's they can provide more details

Server Sent Events with Hybrid Application

I'm working on a hybrid app that is based on Angular 1.5. In part of the app now, the client wants a messaging system for the admin of a group to be able to message the normal worker/user. I want to check and see if this is done, would server sent events be the solution? If so, do I continue to let it run as the user has the app open? How does this affect performance?
I am presuming authentication would need to be performed against users in order to differentiate between admin and worker accounts.
Have Angular send AJAX calls to your server, which will check the users' authentication status before the client-side view is rendered.
You should research the resolve property in Angular in order to implement this type of solution.

Categories

Resources