obtain buyers name and shipping address through return url
I am experimenting with PayPal-sandbox
for an online shop that I am endeavouring to build. As it currently stands the buyer simply selects a product, clicks the buy now button and is then sent to PayPal to complete the transaction.
After such, I have a function that makes use of the return url to store the transaction details in my orders tables.
Everything works fine but I am wondering if it is also possible to capture the buyers name and shipping address from the PayPal form using the return url.
function process_transaction() {
if(isset($_GET['tx'])) { // ie. if transaction sale has been completed....
$amount = $_GET['amt']; // get amount details for our db
$currency = $_GET['cc'];
$transaction = $_GET['tx']; // get transaction details and we will bump into our db
$status = $_GET['st']; // get status, ie completed
$total = 0; // default product total variables set to zero in the first instance
$item_quantity = 0; // default quantity variable set to zero
$send_order = query(" INSERT INTO orders (order_amount, order_transaction, order_status, order_currency) VALUES('{$amount}','{$transaction}','{$status}','{$currency}')");
confirm($send_order);
$last_id = last_id();
foreach ($_SESSION as $name => $value) {
if($value > 0 ) {
if(substr($name, 0, 8) == "product_") {
$length = strlen($name) - 8;
$id = substr($name, 8 , $length);
$query = query(" SELECT * FROM products WHERE product_id = " . escape_string($id). " " );
confirm($query);
while ($row = fetch_array($query)) {
$product_price = $row['product_price'];
$sub = $row['product_price']*$value;
$item_quantity +=$value;
$insert_report = query(" INSERT INTO reports (product_id, order_id, product_price, product_quantity) VALUES('{$id}','{$last_id}','{$product_price}','{$value}')");
confirm($insert_report); //runs the confirm helper method
} // end of while loop
$total += $sub;
echo $item_quantity;
} // end of substring if statement
}
}
session_destroy();
} else {
redirect("index.php");
}
}
php html forms paypal paypal-sandbox
add a comment |
I am experimenting with PayPal-sandbox
for an online shop that I am endeavouring to build. As it currently stands the buyer simply selects a product, clicks the buy now button and is then sent to PayPal to complete the transaction.
After such, I have a function that makes use of the return url to store the transaction details in my orders tables.
Everything works fine but I am wondering if it is also possible to capture the buyers name and shipping address from the PayPal form using the return url.
function process_transaction() {
if(isset($_GET['tx'])) { // ie. if transaction sale has been completed....
$amount = $_GET['amt']; // get amount details for our db
$currency = $_GET['cc'];
$transaction = $_GET['tx']; // get transaction details and we will bump into our db
$status = $_GET['st']; // get status, ie completed
$total = 0; // default product total variables set to zero in the first instance
$item_quantity = 0; // default quantity variable set to zero
$send_order = query(" INSERT INTO orders (order_amount, order_transaction, order_status, order_currency) VALUES('{$amount}','{$transaction}','{$status}','{$currency}')");
confirm($send_order);
$last_id = last_id();
foreach ($_SESSION as $name => $value) {
if($value > 0 ) {
if(substr($name, 0, 8) == "product_") {
$length = strlen($name) - 8;
$id = substr($name, 8 , $length);
$query = query(" SELECT * FROM products WHERE product_id = " . escape_string($id). " " );
confirm($query);
while ($row = fetch_array($query)) {
$product_price = $row['product_price'];
$sub = $row['product_price']*$value;
$item_quantity +=$value;
$insert_report = query(" INSERT INTO reports (product_id, order_id, product_price, product_quantity) VALUES('{$id}','{$last_id}','{$product_price}','{$value}')");
confirm($insert_report); //runs the confirm helper method
} // end of while loop
$total += $sub;
echo $item_quantity;
} // end of substring if statement
}
}
session_destroy();
} else {
redirect("index.php");
}
}
php html forms paypal paypal-sandbox
What does the return URL look like? Can you post an example here? Obviously without any real customer data in it please...
– yinken
Nov 24 '18 at 14:41
yes, I will do so in a minute,
– weng tee
Nov 24 '18 at 14:44
@yinken added small image above of an example of return url data
– weng tee
Nov 24 '18 at 14:49
add a comment |
I am experimenting with PayPal-sandbox
for an online shop that I am endeavouring to build. As it currently stands the buyer simply selects a product, clicks the buy now button and is then sent to PayPal to complete the transaction.
After such, I have a function that makes use of the return url to store the transaction details in my orders tables.
Everything works fine but I am wondering if it is also possible to capture the buyers name and shipping address from the PayPal form using the return url.
function process_transaction() {
if(isset($_GET['tx'])) { // ie. if transaction sale has been completed....
$amount = $_GET['amt']; // get amount details for our db
$currency = $_GET['cc'];
$transaction = $_GET['tx']; // get transaction details and we will bump into our db
$status = $_GET['st']; // get status, ie completed
$total = 0; // default product total variables set to zero in the first instance
$item_quantity = 0; // default quantity variable set to zero
$send_order = query(" INSERT INTO orders (order_amount, order_transaction, order_status, order_currency) VALUES('{$amount}','{$transaction}','{$status}','{$currency}')");
confirm($send_order);
$last_id = last_id();
foreach ($_SESSION as $name => $value) {
if($value > 0 ) {
if(substr($name, 0, 8) == "product_") {
$length = strlen($name) - 8;
$id = substr($name, 8 , $length);
$query = query(" SELECT * FROM products WHERE product_id = " . escape_string($id). " " );
confirm($query);
while ($row = fetch_array($query)) {
$product_price = $row['product_price'];
$sub = $row['product_price']*$value;
$item_quantity +=$value;
$insert_report = query(" INSERT INTO reports (product_id, order_id, product_price, product_quantity) VALUES('{$id}','{$last_id}','{$product_price}','{$value}')");
confirm($insert_report); //runs the confirm helper method
} // end of while loop
$total += $sub;
echo $item_quantity;
} // end of substring if statement
}
}
session_destroy();
} else {
redirect("index.php");
}
}
php html forms paypal paypal-sandbox
I am experimenting with PayPal-sandbox
for an online shop that I am endeavouring to build. As it currently stands the buyer simply selects a product, clicks the buy now button and is then sent to PayPal to complete the transaction.
After such, I have a function that makes use of the return url to store the transaction details in my orders tables.
Everything works fine but I am wondering if it is also possible to capture the buyers name and shipping address from the PayPal form using the return url.
function process_transaction() {
if(isset($_GET['tx'])) { // ie. if transaction sale has been completed....
$amount = $_GET['amt']; // get amount details for our db
$currency = $_GET['cc'];
$transaction = $_GET['tx']; // get transaction details and we will bump into our db
$status = $_GET['st']; // get status, ie completed
$total = 0; // default product total variables set to zero in the first instance
$item_quantity = 0; // default quantity variable set to zero
$send_order = query(" INSERT INTO orders (order_amount, order_transaction, order_status, order_currency) VALUES('{$amount}','{$transaction}','{$status}','{$currency}')");
confirm($send_order);
$last_id = last_id();
foreach ($_SESSION as $name => $value) {
if($value > 0 ) {
if(substr($name, 0, 8) == "product_") {
$length = strlen($name) - 8;
$id = substr($name, 8 , $length);
$query = query(" SELECT * FROM products WHERE product_id = " . escape_string($id). " " );
confirm($query);
while ($row = fetch_array($query)) {
$product_price = $row['product_price'];
$sub = $row['product_price']*$value;
$item_quantity +=$value;
$insert_report = query(" INSERT INTO reports (product_id, order_id, product_price, product_quantity) VALUES('{$id}','{$last_id}','{$product_price}','{$value}')");
confirm($insert_report); //runs the confirm helper method
} // end of while loop
$total += $sub;
echo $item_quantity;
} // end of substring if statement
}
}
session_destroy();
} else {
redirect("index.php");
}
}
php html forms paypal paypal-sandbox
php html forms paypal paypal-sandbox
edited Nov 24 '18 at 14:48
weng tee
asked Nov 24 '18 at 14:25
weng teeweng tee
103110
103110
What does the return URL look like? Can you post an example here? Obviously without any real customer data in it please...
– yinken
Nov 24 '18 at 14:41
yes, I will do so in a minute,
– weng tee
Nov 24 '18 at 14:44
@yinken added small image above of an example of return url data
– weng tee
Nov 24 '18 at 14:49
add a comment |
What does the return URL look like? Can you post an example here? Obviously without any real customer data in it please...
– yinken
Nov 24 '18 at 14:41
yes, I will do so in a minute,
– weng tee
Nov 24 '18 at 14:44
@yinken added small image above of an example of return url data
– weng tee
Nov 24 '18 at 14:49
What does the return URL look like? Can you post an example here? Obviously without any real customer data in it please...
– yinken
Nov 24 '18 at 14:41
What does the return URL look like? Can you post an example here? Obviously without any real customer data in it please...
– yinken
Nov 24 '18 at 14:41
yes, I will do so in a minute,
– weng tee
Nov 24 '18 at 14:44
yes, I will do so in a minute,
– weng tee
Nov 24 '18 at 14:44
@yinken added small image above of an example of return url data
– weng tee
Nov 24 '18 at 14:49
@yinken added small image above of an example of return url data
– weng tee
Nov 24 '18 at 14:49
add a comment |
1 Answer
1
active
oldest
votes
The information you are adding to your database is coming from the URL string, as you said, using PHP $amount = $_GET['amt']
, etc. Your buyer's name and all other information would have to be parsed in the same way, if it is included in that string, for example in the form of "&customer_name=firstname_lastname".
My guess is though, that it will not be. It would be completely insecure to transmit any sensitive data in such a way.
You will have to get customer information from another source. You should be getting it anyway, since you will have to collect it in your web shop at one point.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53459135%2fobtain-buyers-name-and-shipping-address-through-return-url%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
The information you are adding to your database is coming from the URL string, as you said, using PHP $amount = $_GET['amt']
, etc. Your buyer's name and all other information would have to be parsed in the same way, if it is included in that string, for example in the form of "&customer_name=firstname_lastname".
My guess is though, that it will not be. It would be completely insecure to transmit any sensitive data in such a way.
You will have to get customer information from another source. You should be getting it anyway, since you will have to collect it in your web shop at one point.
add a comment |
The information you are adding to your database is coming from the URL string, as you said, using PHP $amount = $_GET['amt']
, etc. Your buyer's name and all other information would have to be parsed in the same way, if it is included in that string, for example in the form of "&customer_name=firstname_lastname".
My guess is though, that it will not be. It would be completely insecure to transmit any sensitive data in such a way.
You will have to get customer information from another source. You should be getting it anyway, since you will have to collect it in your web shop at one point.
add a comment |
The information you are adding to your database is coming from the URL string, as you said, using PHP $amount = $_GET['amt']
, etc. Your buyer's name and all other information would have to be parsed in the same way, if it is included in that string, for example in the form of "&customer_name=firstname_lastname".
My guess is though, that it will not be. It would be completely insecure to transmit any sensitive data in such a way.
You will have to get customer information from another source. You should be getting it anyway, since you will have to collect it in your web shop at one point.
The information you are adding to your database is coming from the URL string, as you said, using PHP $amount = $_GET['amt']
, etc. Your buyer's name and all other information would have to be parsed in the same way, if it is included in that string, for example in the form of "&customer_name=firstname_lastname".
My guess is though, that it will not be. It would be completely insecure to transmit any sensitive data in such a way.
You will have to get customer information from another source. You should be getting it anyway, since you will have to collect it in your web shop at one point.
answered Nov 24 '18 at 15:32
yinkenyinken
25328
25328
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53459135%2fobtain-buyers-name-and-shipping-address-through-return-url%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
What does the return URL look like? Can you post an example here? Obviously without any real customer data in it please...
– yinken
Nov 24 '18 at 14:41
yes, I will do so in a minute,
– weng tee
Nov 24 '18 at 14:44
@yinken added small image above of an example of return url data
– weng tee
Nov 24 '18 at 14:49