-
Notifications
You must be signed in to change notification settings - Fork 0
/
confirmInContext.php
106 lines (94 loc) · 5.27 KB
/
confirmInContext.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
<?php
if (session_id() == "")
session_start();
include 'header.php';
?>
<body>
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.3";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<h1>Kat & Alec's Tahoe Funding</h1>
<?php
/*==================================================================
PayPal Express Checkout Call
===================================================================
*/
// Check to see if the Request object contains a variable named 'token'
$token = "";
if (isset($_REQUEST['token']))
{
$token = $_REQUEST['token'];
}
// If the Request object contains the variable 'token' then it means that the user is coming from PayPal site.
if ( $token != "" )
{
require_once ("paypalfunctions.php");
/*
'------------------------------------
' Calls the GetExpressCheckoutDetails API call
'
' The GetShippingDetails function is defined in PayPalFunctions.jsp
' included at the top of this file.
'-------------------------------------------------
*/
$resArray = GetShippingDetails( $token );
$ack = strtoupper($resArray["ACK"]);
if( $ack == "SUCCESS" || $ack == "SUCESSWITHWARNING")
{
/*
' The information that is returned by the GetExpressCheckoutDetails call should be integrated by the partner into his Order Review
' page
*/
$email = $resArray["EMAIL"]; // ' Email address of payer.
$payerId = $resArray["PAYERID"]; // ' Unique PayPal customer account identification number.
$payerStatus = $resArray["PAYERSTATUS"]; // ' Status of payer. Character length and limitations: 10 single-byte alphabetic characters.
$salutation = $resArray["SALUTATION"]; // ' Payer's salutation.
$firstName = $resArray["FIRSTNAME"]; // ' Payer's first name.
$middleName = $resArray["MIDDLENAME"]; // ' Payer's middle name.
$lastName = $resArray["LASTNAME"]; // ' Payer's last name.
$suffix = $resArray["SUFFIX"]; // ' Payer's suffix.
$cntryCode = $resArray["COUNTRYCODE"]; // ' Payer's country of residence in the form of ISO standard 3166 two-character country codes.
$business = $resArray["BUSINESS"]; // ' Payer's business name.
$shipToName = $resArray["PAYMENTREQUEST_0_SHIPTONAME"]; // ' Person's name associated with this address.
$shipToStreet = $resArray["PAYMENTREQUEST_0_SHIPTOSTREET"]; // ' First street address.
$shipToStreet2 = $resArray["PAYMENTREQUEST_0_SHIPTOSTREET2"]; // ' Second street address.
$shipToCity = $resArray["PAYMENTREQUEST_0_SHIPTOCITY"]; // ' Name of city.
$shipToState = $resArray["PAYMENTREQUEST_0_SHIPTOSTATE"]; // ' State or province
$shipToCntryCode = $resArray["PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE"]; // ' Country code.
$shipToZip = $resArray["PAYMENTREQUEST_0_SHIPTOZIP"]; // ' U.S. Zip code or other country-specific postal code.
$addressStatus = $resArray["ADDRESSSTATUS"]; // ' Status of street address on file with PayPal
$invoiceNumber = $resArray["INVNUM"]; // ' Your own invoice or tracking number, as set by you in the element of the same name in SetExpressCheckout request .
$phonNumber = $resArray["PHONENUM"]; // ' Payer's contact telephone number. Note: PayPal returns a contact telephone number only if your Merchant account profile settings require that the buyer enter one.
$confArray = confirmPayment($resArray["PAYMENTREQUEST_0_AMT"]);
include 'mysql.php';
write_db($firstName, $lastName, $resArray["PAYMENTREQUEST_0_AMT"], $shipToStreet, $shipToStreet2, $shipToCity, $shipToState, $shipToZip, $email, $resArray["PAYMENTREQUEST_0_CUSTOM"]);
echo "<h3>Thank you for your kind gift and for helping make Kat and Alec's special day even better!</h3>";
echo "<h4><a href='index.php'>Return to the main page</a> to see the difference your gift made!</h4>";
}
else
{
//Display a user friendly Error on the page using any of the following error information returned by PayPal
$ErrorCode = urldecode($resArray["L_ERRORCODE0"]);
$ErrorShortMsg = urldecode($resArray["L_SHORTMESSAGE0"]);
$ErrorLongMsg = urldecode($resArray["L_LONGMESSAGE0"]);
$ErrorSeverityCode = urldecode($resArray["L_SEVERITYCODE0"]);
echo "GetExpressCheckoutDetails API call failed. ";
echo "Detailed Error Message: " . $ErrorLongMsg;
echo "Short Error Message: " . $ErrorShortMsg;
echo "Error Code: " . $ErrorCode;
echo "Error Severity Code: " . $ErrorSeverityCode;
}
}
?>
<h3>Share this page on Social Media</h3>
<div class="fb-share-button" data-href="http://www.gamergadgets.net/katandalec/" data-layout="button_count"></div>
<a href="https://twitter.com/share" class="twitter-share-button" data-url="http://www.gamergadgets.net/katandalec" data-size="large" data-hashtags="KatAndAlecTahoe">Tweet</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
<?php include 'footer.php'; ?>
</body>
</html>