-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME
103 lines (73 loc) · 2.36 KB
/
README
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
// Notes:
This is in by no means a full implimentation of PayPals NVP API.
I have only written methods for what I needed. They are simple to
implement.
You can do whatever you like this this code.
I only have interfaces for,
Setting API Version (You can also do when creating object)
-SetAPIVersion(str)
Setting End point (Useful if you want to test in sandbox)
-SetEndPoint(str)
Setting EC End point (Useful if you want to test in sandbox)
-SetECEndPoint(str)
DoDirectPayment(array)
DoCapture(array)
SetExpressCheckout(array)
GetExpressCheckout(str) //Takes a token
DoExpressCheckout(array)
- All methods will return an object, I will give you back everything PayPal does according to the API version you are using
Two methods will return non standard variables,
-- SetExpressCheckout
--- CLEAN_TOKEN is just a urldecoded token
--- CHECKOUT_URL is the link you need to redirect the user to for paypal to process
-- GetExpressCheckout
--- CLEAN_TOKEN same as above
// Validation:
I try to validate the required fields decently. You still should be watching for throws
as well as checking the PayPal responses
/////////////////////////////////////////////////////////////////////////////////////
// Basic usage example
////////////////////////////////////////////////////////////////////////////////////
$pp = new PayPalNVP(array(
'UserName' => 'seller_139441_biz_api1.gmail.com',
'Password' => '130689946',
'Signature' => 'AYBgIuot3ZEeAX6OGYqN7crDHtyexHvRJ43R9Bk1'
));
$details = array(
'AMT' => '50.02',
'ZIP' => '11566',
'CITY' => 'Merrick',
'CVV2' => '000',
'ACCT' => '476819606062564',
'STATE' => 'NY',
'STREET' => '1 Flower Drive',
'EXPDATE' => '052012',
'LASTNAME' => 'Tsafas',
'FIRSTNAME' => 'George',
'COUNTRYCODE' => 'US',
'CREDITCARDTYPE' => 'VISA',
'PAYMENTACTION' => 'Authorization'
);
try
{
$transaction = $pp->DoDirectPayment($details);
}
catch (Exception $e)
{
echo $e->getMessage();
}
$details = array(
'AUTHORIZATIONID' => $transaction->TRANSACTIONID,
'AMT' => $transaction->AMT,
'CURRENCYCODE' => 'USD',
'COMPLETETYPE' => 'Complete'
);
try
{
$capture = $pp->DoCapture($details);
}
catch (Exception $e)
{
echo $e->getMessage();
}
////////////////////////////////////////////////////////////////////////////////