-
Notifications
You must be signed in to change notification settings - Fork 102
/
instructions.html
80 lines (79 loc) · 4.16 KB
/
instructions.html
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>PayPal PHP CodeIgniter Class Library | Angell EYE</title>
<style type="text/css">
body,td,th {
font-family: Arial, Helvetica, sans-serif;
font-size: 16px;
}
</style>
</head>
<body>
<h1>Setup</h1>
<ul>
<li><a href="https://github.com/angelleye/paypal-codeigniter" target="_blank">Download the PHP class library for PayPal</a> and upload to a directory on your web server.</li>
<li>Open /application/config/paypal-sample.php and adjust the values with your own Sandbox and Production API credentials. Then save-as paypal.php.
<ul>
<li>There are detailed comments inside the config file to help you fill it out correctly.</li>
</ul>
</li>
</ul>
<h1>How to Make PayPal API Calls</h1>
<ul>
<li>Open /application/controllers/paypal/templates/controllername.php depending on which PayPal API you're going to be using.
<ul>
<li>Example: If we want to make a call to the RefundTransaction API we open payments_pro.php and then seek out the Refund_transaction() function. </li>
</ul>
</li>
<li>Each template function includes PHP arrays for every parameter available to that particular API call. Simply fill in the array parameters with your own dynamic (or static) data. This data may come from...
<ul>
<li>Session Variables</li>
<li>PHP Variables</li>
<li>Database Recordsets</li>
<li>Static Values</li>
<li>Etc.</li>
</ul>
</li>
<li>When you run the function you will get a $PayPalResult array that consists of all the response parameters from PayPal, original request parameters sent to PayPal, and raw request/response info for troubleshooting.
<ul>
<li>You may refer to the <a href="https://developer.paypal.com/webapps/developer/docs/classic/api/">PayPal API Reference Guide</a> for details about what response parameters you can expect to get back from any successful API request.
<ul>
<li>Example: When working with RefundTransaction, I can see that PayPal will return a REFUNDTRANSACTIONID, FEEREFUNDAMT, etc. As such, I know that those values will be included in $PayPalResult['REFUNDTRANSACTIONID'] and $PayPalResult['FEEREFUNDAMT'] respectively. </li>
</ul>
</li>
</ul>
</li>
<li>If errors occur they will be available in $PayPalResult['ERRORS'].</li>
</ul>
<h1>General Tips</h1>
<ul>
<li>The result of the API call will come back in $PayPalResult['ACK'].
<ul>
<li>Remember when checking the value that it could be Success, Failure, SuccessWithWarning, or FailureWithWarning. Simply checking for Success isn't enough.</li>
<li>You may use $this->library_name->APICallSuccessful($Ack) to do this for you.</li>
</ul>
</li>
<li>You may build your calls directly into the template controllers if you would like to, but we recommend keeping those clean for future reference.
<ul>
<li>Instead, copy the function to your own controller, and of course make sure to include the PayPal configuration and library in your controller, which you can see in the constructor of the sample and template controllers.</li>
</ul>
</li>
</ul>
<h1>Tips for Testing in the Sandbox</h1>
<ul>
<li>Create an account at <a href="http://developer.paypal.com" target="_blank">http://developer.paypal.com</a></li>
<li>Create at least one sandbox Seller account and one sandbox Buyer account from within your developer account.
<ul>
<li>These accounts can be used to go through the entire process of buying items within your application, and reviewing what each party involved will see in their PayPal account when the transaction is completed.</li>
<li><a href="https://www.angelleye.com/create-paypal-sandbox-account/" target="_blank">How to create PayPal sandbox accounts</a>.</li>
</ul>
</li>
</ul>
<h1>Tips for Going Live</h1>
<ul>
<li>Review <a href="https://developer.paypal.com/webapps/developer/docs/classic/lifecycle/goingLive/" target="_blank">PayPal's Going Live Information</a></li>
</ul>
</body>
</html>