I am currently integrating a payment service using Aurelia framework. It starts with, rendering an iframe where Customers enter their payment details. Upon successful payment, the payment service from the iframe tries to call POST {baseUrl}/success. Currently, I have {baseUrl}/success route configured but I get 404 with cannot POST /success.
How do I implement this in Aurelia?
Related
I'm trying to integrate a payment gateway like razorpay or stripe in my flutter app, and for any payment provider we need to generate a token using their API in the backend , but none of these payment providers have mentioned the code for the server side to generate tokens and how/where to deploy that server side code. Essentially I'm creating an ecommerce app and to process payments I can't find resources to implement the server side code for each cart order. Can anyone tell how to implement the server side code or some resource which could be useful?
Docs I have read:
https://pub.dev/packages/razorpay_flutter
https://razorpay.com/docs/payments/payment-gateway/flutter-integration/standard/build-integration#16-create-an-order-in-server
but none of these payment providers have mentioned the code for the server side to generate tokens and how/where to deploy that server side code
This is by design. Payment providers help you lower your PCI compliance burden by not touching raw card details. If you use frontend SDKs (like Stripe's Stripe.js + Elements UI library), they are an iframe that collects your end customer card details directly to their servers meaning your integration does not touch card details and does not have to do tons of paperwork on your own PCI compliance.
https://stripe.com/docs/security/guide
https://stripe.com/guides/pci-compliance
So you absolutely need to use their frontend SDKs to directly create a token from your webpage.
I can't find resources to implement the server side code for each cart order.
Once you have your token, you then send that to your server to create an order and (in Stripe's case) create and confirm a PaymentIntent. Though Stripe's recommended flow is a bit different - you create the PaymentIntent first and "confirm" it on your frontend: https://stripe.com/docs/payments/accept-a-payment
For razorpay integration (atleast as a payment gateway) you will be in need of a client and a server. As you say you have the client with you. After the user initiates the payment and completes it in the flutter client - the client has to send out an api request to the api server that can actually capture the payment with the hash comparisons.
I don't not much idea about Razorpay integration but for Stripe you can use Payment Intent API.
You can divide the process in 3 steps:
Send card details from Front-end, if it's a Stripe Customer then you can even use their default card.
Create a payment Intent in Backend, this will return a payment intent object with client_secret. You also might wanna save the payment intent id in DB.
Send this client_secret to Frontend, where you can use this client secret in Stripe.confirmCardPayment(client_secret).
Listen to webhook events to check on the payment status/progress. It's basically an open endpoint where stripe will make REST calls and provide you with details about your payment progress.
Here's a link to the docs mentioning this process. There was an even better doc/github link that I can't seem to find, it had the entire end-to-end happy process.
If this seems a bit complicated then you go with checkout API of Stripe. I've also attached a few youtube videos that might help ya in getting started.
Checkout API YT link
Payment Intent YT link
I'm trying to implement the PayPal checkout server flow described here and I'm a little bit confused about the role of the redirect urls required by the Create Payment REST API
With the PayPal checkout JavaScript components, I need to provide a onAuthorize hook in the JavaScript button initialization code like in the example on the page linked above. My understanding - and I've confirmed this in the sandbox environment - is that this callback gets called after user has successfully authorized the payment on PayPal and in this callback I'm supposed to execute the payment. This part is pretty clear and I've successfully implemented this. The confusion arises from the payload on the PayPal's Create Payment API.
This API expects a required parameter redirect_urls to be provided in the payload. Under this both return_url and cancel_url have to be provided. I understand from the documentation these URLs are where the user will be redirected after successfully authorizing the payment or if they cancel the payment.
In my tests in the sandbox environment, however, the user is never redirected to these redirect urls, as the "return" / "cancel" is handled by the callbacks provided to the button initialization. Now this leads to my question:
Despite this, is there any scenario where the user is redirected to these urls? What should happen if the user is redirected to these urls?
My concern is do I need to duplicate the on authorized / cancelled logic both in the JavaScript code and then upon entering the provided return urls?
The return and cancel url were important in cases where the PayPal experience is not in context (light box ) or if you want to take them to a completely different page once they approve the payment using continue or pay now or if you are using this in a mobile app where the checkout.js won’t work
With the checkout JS integration you don’t really need to pass the url as the experience is in context if that’s what you were trying to ask.
I am unable to get the Paypal provided REST client (the client side js) to trigger webhook events in the sandbox to receive payment confirmation on my server app.
Here's what I can do/ have done:
I have created a REST app in the sandbox.
I have subscribed to all webhook events.
I am able to pay with the client app using my sandbox client id and see see the payment reflected in the facilitator account.
I am able to generate a webhook event using the Webhook simulator and receive it / parse it on my server.
However, when I do a sandbox payment transaction using the client, no webhook event is created (as reflected in the Webhook events list provided in the dashboard), nor it is sent to my server. Again, my server receives simulated webhooks just fine.
The problem seems to be that the Paypal REST Client is not generating a webhook event. I have tripled checked everything, but cannot see what I've missed. Help!
I have the same problem. I racked my brain trying to figure out if something was wrong with my code. I contacted Paypal and they said this is an ongoing issue with Paypal sandbox and are working to resolve it.
I'm working on a website where a user can pay for products to another user, the user that is getting paid has his API Signature set and the payment is accomplished using ExpressCheckout (NVP) (the payer just gets redirected to a PayPal page where he logs in if necessary and just clicks a button to pay).
The problem is I tried using webhooks to track refunds for these payments, so I can later insert the refund data into my database via callback URL (php function), but the URL I've set doesn't get called at all(I've previously simulated an event on the same URL and everything was fine).
I am trying to get this to work by setting my API Signature and a friend of mine paying me some cents(via DoExpressCheckoutPayment) after which I refund them to him (no calls, only using the PayPal website).
Also nothing appears on the Sandbox Webhooks Events page or the Live one. I've tried registering other events like "Payment capture completed" or "Payment sale completed" to my webhook but with the same result.
Do I have to change some settings in my account? I've created a REST API app in order to use webhooks, but I've seen there's an option for NVP/SOAP API apps. I have considered IPN if webhooks don't work.
"Webhooks" are used with the REST API. Express Checkout uses IPN.
You'll need to setup a separate listener for IPN similar to what you've done with webhooks on the REST API.
I am currently working on developing a plugin for subscription in WordPress.
I have integrated PayPal with the plugin but the problem is that how can I get the payment status from PayPal?
I have set return parameter to my subscription page but it does not receive payment status and other parameters from PayPal.
You'll need to use IPN for that. It will POST data to your application about every transaction that hits the account so you can process them accordingly, automatically and in real-time.
You can use PayPal IPN for WordPress to get up and running quickly. It comes with lots of different hooks to trigger your own stuff based on different transaction types or payment status (note: these links are to my own website).