Authorize.Net hosted form: how to verify payment succeeded after redirect - authorize.net

I'm using the hosted payment form with getHostedPaymentPageRequest
After successful payment the browser opens by success url correctly.
However, i dont know how to verify that payment was actually completed. I have the token from getHostedPaymentPageRequest, but i cant find an API to call to get the result of that transaction.
I can see that when using an IFrame we can use the IFrameCommunicator, but we would prefer to not use that.
How can i verify the transaction succeeeded after redirect back from the hosted payment page?

If you don't use the iframe you won't get the results of the transaction in real time. Your best option then is to use a webhook to receive a notification of the successful payment. You can then get the transaction info using the transaction ID provided by the webhook. But that would mean the user won't know the status of their payment when they arrive back at your site. For that to happen you'd have to build a mechanism that does the above and have your receipt page poll your backend until it has the results of the transaction and then can display them to the user.

Related

Authorize.Net: How do I verify a hosted payment was successful once the user is redirected back to my site?

I am using the hosted form payment approach to accepting payments from users on my site. I dont see any examples of how to go about verifying the payment once the user is redirected back to my site. Here is how I'm trying to approach it:
Generate a token/form based on the cart
Post to the form url and send the user away
User returns to a verifying page
I have set up a webhook for all payment notifications
I receive the notification
?????
Verify the payment status and price are correct
Navigate the user away from the verifying screen to the next page
In step 6 all i have is the token that was generated for the transaction and the webhook doesnt provide that token back to me. How do I say "this transaction belongs to this user who is waiting to be verified"?
You can use the getTransactionDetailsRequest in their Transaction Reporting API to get the transaction details. The best place to put this information is in the refTransId field which is a value you can pass in as part of your transaction.

Flask + Stripe - how can I prevent people from accessing my successful checkout page without making a payment?

Basically I understand how to integrate Stripe payment into Flask, I'm using the official website (https://stripe.com/docs/payments/accept-a-payment?integration=elements) as a guide. In the guide the user is taken to a success page after the payment is successful. What I want to do upon a successful payment is collect the user's email, create a randomized password, and then email that password to the user. I've learned how to grab information from the session id using this page (https://stripe.com/docs/payments/checkout/custom-success-page). What I'm concerned about is that a user might go to the success page, get an account, and bypass the required payment.
My idea to solve that is to get the session info using this line:
session = stripe.checkout.Session.retrieve(request.args.get('session_id'))
and then before doing anything else check if it's none. If it's none, it will display an error page, if it is not none then it will create an account for the user. Would that work? Or would people just be able to change the session_id in the url until they find a number that is a valid session?
If that doesn't work, all I really want to do is upon successful payment create an account for the user using their email and a randomized password. How do I do that?
You're on the right track. Generally the flow is:
Customer is redirected to Checkout
Customer pays
Checkout redirects customer back to your success_url
You fetch the Checkout Session using the ID in the URL to confirm a valid payment
For #4 you can do various things to make sure people can't guess a Checkout Session ID (which would be unlikely due to their length and complexity). I suggest checking to see if the successful payment happened within a certain timeframe, like the past hour or past day, for example.

How to redirect the customer to the success page after Payment from Stripe?

I am using Stripe to handle my payments for my own rental website. (Backend - DJANGO)
Previously, I was using Stripe ChargesAPI and was manually sending out payouts to the Host of the property but I came to know that it can be automated by using Stripe PaymentIntentsAPI.
I have successfully managed to onboard my customers to receive payments in their bank accounts using Stripe Express.
After creating the payment intent and passing to the client I can charge their account as well as update my database for the booking.
The problem I am facing here is after the payment is done, I want to redirect the customer to the success page or payment failure page which I was able to do it by passing my reservation ID and updating it as payment received which I now do by using Webhooks.
How can redirect my customer to the success page showing the receipt of the booking?
You'll have to setup Payment Intent using a custom payment flow.
Briefly, how it works:
Capture your user's credit/debit card information and send a request to Stripe to authorize the card. If any additional verification checks are needed, Stripe provides you with an easy way to handle this
After authorization is complete, you capture the payment
If payment is successful, you show the user a success page, if not you show them an error message
Here's a link to the documentation: https://stripe.com/docs/payments/accept-a-payment?integration=elements

Issue in redirecting back to our Site from sandbox test authorize net

After processing the payment, control is not directing back to our site(x_relay_url) from https://test.authorize.net/gateway/transact.dll.
The URL mentioned in the x_relay_url cannot be accessed directly it requires session id and other details to access it which was passed to Authorize net page using merchantDefinedData variables.
I checked the following article also but our URL seems to be fine and we checked our code there is nothing wrong in that.
I tried multiple URLs in "x_relay_url" but nothing seems to be working.
Any help is appreciated.
Error Message:
An error occurred while trying to report this transaction to the
merchant. An e-mail has been sent to the merchant informing them of
the error. The following is the result of the attempt to charge your
credit card.
This transaction has been approved.
It is advisable for you to contact the merchant to verify that you will receive the product or service.

Customizing WooCommerce e-mail templates

I have used WooCommerce before, but have never done much customization to it until recently.
I customized the e-mail templates to show the payment information, like transaction number, etc.
This works fine except for one thing.
Right now if a person pays with PayPal the process goes like this:
– order is placed, and is pending payment
– user goes to paypal and makes a payment
– PayPal IPN message is received, order is updated to "processing"
– email is sent to user
However this e-mail does not have the payment info in it. The variables are empty. If I re-send the same e-mail manually it works as expected. other automated e-mails that go out during the order process work fine, it's just that initial e-mail that's missing the information.
What I don’t get is why it's missing the first time, when the PayPal IPN is received, and the transaction info with it, before the e-mail is even sent.
Since the IPN is received before the e-mail is sent why is that info not in the e-mail? If I go to the order and re-send the “processing” e-mail it has the info that we want it to show.
Or maybe even a way to have PayPal orders automatically put "on hold" would work, then when I manually change the order status the e-mail would be sent with the correct information.