php - Transfer input data from form to paypal payment and save if payment was successful

45

I am trying to integrate a paypal pay button to my website and have a question:

before the users pays with paypal he inputs two variables in a form called name="amount" and name="address".

Then the users clicks on the paypal button and gets redirected to the payment system where it displays how much he wants to buy and the price (thats not the problem), after the payment the user gets redirected back and it simply prints "payment successful", question is, how do i get the access of "amount" and "address" back to store in a database?

is using $_SESSION here safe?

88

Answer

Solution:

using session is very safe. For instance you can pass the variable as follow

<?php
session_start();
$_session['amount'] =30;

?>

As for getting adrdress and amount to store in database. once the paypal payment is succcessful, pay normal returns the amount paid, transaction Id, currency type etc. in the url. you can get those data using GET method and then store in the database with other variable sessions. Unless I see your code and what you have done so far i will be able to help you further.

People are also looking for solutions to the problem: php - Handling File Uploads when a property is added from the Javascript File Object

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.