cancel
Showing results for 
Search instead for 
Did you mean: 

How to get transaction details using the redirect method without using a webhook

I used the redirect method under the Accept Hosted payment form of authorized.net to make a payment. Firstly, I am generating a token to create the payment successfully. After that, when I submit the form, it redirects to the authorized.net payment gateway website. Then, I fill in the payment credentials and click on 'pay now'. The next page shows the payment receipt. When I click on 'continue', it redirects to the URL where the redirect URL was filled in during token generation, but no transaction details are coming from the authorized.net server. How can I get transaction details after clicking on Continue?

This code is written in PHP.

Here is the PHP code to get the response.

 

    $raw_post_data = file_get_contents('php://input');
   
    // 4. Parse data format (based on your configuration)
    $data = json_decode($raw_post_data, true); // Assuming JSON format
   
    // 5. Access specific values
    $transaction_id = $data['transaction']['transactionId'];
    $amount = $data['transaction']['amount'];
    $response_code = $data['transaction']['responseCode'];
       
    print_r($data);
 

If anyone has a solution, please suggest it to me.

2 REPLIES 2

Using the redirect method without using a webhook to get transaction details typically involves a process where the user is redirected back to your platform after completing a transaction on a third-party service. Here's a general overview of how you can achieve this:

1. **Initiate the Transaction:** Your platform initiates the transaction process by redirecting the user to the third-party service (e.g., a payment gateway or a service that processes transactions).

2. **User Interaction:** The user interacts with the third-party service to complete the transaction, providing necessary information such as payment details.

3. **Redirect Back to Your Platform:** After the transaction is completed, the third-party service redirects the user back to a specific URL on your platform. This URL typically includes parameters or tokens that contain transaction details.

4. **Retrieve Transaction Details:** Upon receiving the redirect request, your platform extracts the transaction details from the URL parameters or tokens. These details may include transaction ID, payment status, amount, and any other relevant information.

5. **Process Transaction:** Once you have retrieved the transaction details, you can process them accordingly on your platform. This may involve updating your database, triggering notifications, or performing any other necessary actions based on the transaction outcome.

6. **Display Confirmation:** Finally, you can display a confirmation message to the user, indicating that the transaction was successfully completed or providing instructions in case of any issues.

It's important to ensure that the redirect URL is secure and that sensitive transaction details are transmitted and stored securely on your platform. Additionally, you may need to handle cases where the user cancels the transaction or encounters errors during the process.

While using webhooks can provide real-time notifications of transaction events, the redirect method can be a simpler alternative for scenarios where immediate updates are not required or where integrating webhooks is not feasible.

JackAward
Member

To get transaction details using the redirect method without using a webhook, you typically rely on the response parameters provided after the redirect. Here's a general outline of how this process works:

1. **Initiate the Transaction**: When a user initiates a transaction on your platform, you redirect them to the payment gateway or service provider's website to complete the transaction.

2. **User Completes the Transaction**: The user enters their payment details and completes the transaction on the payment gateway's website.

3. **Redirect Back to Your Website**: After the transaction is completed, the payment gateway typically redirects the user back to a designated URL on your website. This URL often includes parameters appended to it, containing transaction details.

4. **Process Redirected Parameters**: On your website, you need to process the parameters appended to the redirect URL. These parameters usually include information such as transaction ID, status, amount, and other relevant details.

5. **Verify the Transaction**: Once you've extracted the transaction details from the redirected parameters, you can verify the transaction status and other information using APIs or SDKs provided by the payment gateway. This step ensures that the transaction is legitimate and successfully completed.

6. **Update Your System**: Finally, update your system's database or records with the transaction details obtained from the redirect parameters. This allows you to track and manage transactions within your platform.

Keep in mind that the specific implementation details may vary depending on the payment gateway or service provider you're using. It's essential to refer to their documentation for detailed instructions on how to handle transactions using the redirect method and process transaction details upon redirection. Additionally, ensure that you handle sensitive data securely and comply with relevant data protection regulations.

JackAward
Member