@@ -3,21 +3,18 @@ First Data Global Gateway PHP API Service
33
44This component provides a PHP Wrapper to post api calls to the First Data payment processor.
55
6- It requires curl and the php curl extension.
7-
8- ## Features:
9- * Supports all transaction types.
10- * Supports Transarmor Token for charging credit cards more than once without storing the actual card number.
6+ It requires ` curl ` and the ` php_curl ` extension.
117
128## Installation
139This library is now installable using <a href =' http://getcomposer.org ' >Composer</a >
1410
1511Add this to your project composer.json:
1612
1713```
18- "require": {
19- "integready/firstdataapi": "dev-master"
20- },
14+ "require": {
15+ // ...
16+ "integready/firstdataapi": "dev-master"
17+ },
2118```
2219
2320To use the component:
@@ -26,24 +23,24 @@ To use the component:
2623<?php
2724use integready\firstdataapi\FirstData;
2825
29- //
30- // 3rd Parameter sets debug mode on.
31- // In debug mode, the demo gateway is used.
32- // You will need to create a demo gateway account with First Data
33- //
26+ /**
27+ * 3rd Parameter sets debug mode on.
28+ * In debug mode, the demo gateway is used.
29+ * You will need to create a demo gateway account with First Data
30+ */
3431$firstData = new FirstData(API_LOGIN, API_KEY, HMAC_ID, HMAC_KEY, true);
3532
3633```
3734
3835## Documentation and Examples
3936### First Data Documentation:
40- <a href =' https://firstdata.zendesk.com/entries/407571-First-Data-Global-Gateway-e4-Web-Service-API-Reference-Guide ' >Api Reference Guide</a >
37+ <a href =' https://firstdata.zendesk.com/entries/407571-First-Data-Global-Gateway-e4-Web-Service-API-Reference-Guide ' >API Reference Guide</a >
4138
4239In these examples:
43- * API_LOGIN is the Terminal Gateway ID of your commerce terminal.
44- * API_KEY is the password you generate in the terminal screen.
45- * HMAC_ID is the HMAC ID of your commerce terminal.
46- * HMAC_KEY is the HMAC Key you generate in the terminal screen.
40+ * ` API_LOGIN ` is the Terminal Gateway ID of your commerce terminal.
41+ * ` API_KEY ` is the password you generate in the terminal screen.
42+ * ` HMAC_ID ` is the HMAC ID of your commerce terminal.
43+ * ` HMAC_KEY ` is the HMAC Key you generate in the terminal screen.
4744
4845
4946### Examples:
@@ -57,31 +54,31 @@ $firstData = new FirstData(API_LOGIN, API_KEY, HMAC_ID, HMAC_KEY, true);
5754// Charge
5855$firstData->setTransactionType(FirstData::TRAN_PREAUTH);
5956$firstData->setCreditCardType($data['type'])
60- ->setCreditCardNumber($data['number'])
61- ->setCreditCardName($data['name'])
62- ->setCreditCardExpiration($data['exp'])
63- ->setAmount($data['amount'])
64- ->setReferenceNumber($orderId);
57+ ->setCreditCardNumber($data['number'])
58+ ->setCreditCardName($data['name'])
59+ ->setCreditCardExpiration($data['exp'])
60+ ->setAmount($data['amount'])
61+ ->setReferenceNumber($orderId);
6562
6663if($data['zip']) {
67- $firstData->setCreditCardZipCode($data['zip']);
64+ $firstData->setCreditCardZipCode($data['zip']);
6865}
6966
7067if($data['cvv']) {
71- $firstData->setCreditCardVerification($data['cvv']);
68+ $firstData->setCreditCardVerification($data['cvv']);
7269}
7370
7471if($data['address']) {
75- $firstData->setCreditCardAddress($data['address']);
72+ $firstData->setCreditCardAddress($data['address']);
7673}
7774
7875$firstData->process();
7976
8077// Check
8178if($firstData->isError()) {
82- // there was an error
79+ // there was an error
8380} else {
84- // transaction passed
81+ // transaction passed
8582}
8683```
8784
@@ -94,31 +91,31 @@ $firstData = new FirstData(API_LOGIN, API_KEY, HMAC_ID, HMAC_KEY, true);
9491// Charge
9592$firstData->setTransactionType(FirstData::TRAN_PURCHASE);
9693$firstData->setCreditCardType($data['type'])
97- ->setCreditCardNumber($data['number'])
98- ->setCreditCardName($data['name'])
99- ->setCreditCardExpiration($data['exp'])
100- ->setAmount($data['amount'])
101- ->setReferenceNumber($orderId);
94+ ->setCreditCardNumber($data['number'])
95+ ->setCreditCardName($data['name'])
96+ ->setCreditCardExpiration($data['exp'])
97+ ->setAmount($data['amount'])
98+ ->setReferenceNumber($orderId);
10299
103100if($data['zip']) {
104- $firstData->setCreditCardZipCode($data['zip']);
101+ $firstData->setCreditCardZipCode($data['zip']);
105102}
106103
107104if($data['cvv']) {
108- $firstData->setCreditCardVerification($data['cvv']);
105+ $firstData->setCreditCardVerification($data['cvv']);
109106}
110107
111108if($data['address']) {
112- $firstData->setCreditCardAddress($data['address']);
109+ $firstData->setCreditCardAddress($data['address']);
113110}
114111
115112$firstData->process();
116113
117114// Check
118115if($firstData->isError()) {
119- // there was an error
116+ // there was an error
120117} else {
121- // transaction passed
118+ // transaction passed
122119}
123120```
124121
@@ -131,19 +128,19 @@ $firstData = new FirstData(API_LOGIN, API_KEY, HMAC_ID, HMAC_KEY, true);
131128// Charge
132129$firstData->setTransactionType(FirstData::TRAN_PURCHASE);
133130$firstData->setCreditCardType($data['number'])
134- ->setTransArmorToken($data['token'])
135- ->setCreditCardName($data['name'])
136- ->setCreditCardExpiration($data['exp'])
137- ->setAmount($data['amount'])
138- ->setReferenceNumber($orderId);
131+ ->setTransArmorToken($data['token'])
132+ ->setCreditCardName($data['name'])
133+ ->setCreditCardExpiration($data['exp'])
134+ ->setAmount($data['amount'])
135+ ->setReferenceNumber($orderId);
139136
140137$firstData->process();
141138
142139// Check
143140if($firstData->isError()) {
144- // there was an error
141+ // there was an error
145142} else {
146- // transaction passed
143+ // transaction passed
147144}
148145```
149146
@@ -156,20 +153,20 @@ $firstData = new FirstData(API_LOGIN, API_KEY, HMAC_ID, HMAC_KEY, true);
156153// Charge
157154$firstData->setTransactionType(FirstData::TRAN_PREAUTHCOMPLETE);
158155$firstData->setCreditCardType($data['number'])
159- ->setTransArmorToken($data['token'])
160- ->setCreditCardName($data['name'])
161- ->setCreditCardExpiration($data['exp'])
162- ->setAuthNumber($dat['auth_number'])
163- ->setAmount($data['amount'])
164- ->setReferenceNumber($orderId);
156+ ->setTransArmorToken($data['token'])
157+ ->setCreditCardName($data['name'])
158+ ->setCreditCardExpiration($data['exp'])
159+ ->setAuthNumber($dat['auth_number'])
160+ ->setAmount($data['amount'])
161+ ->setReferenceNumber($orderId);
165162
166163$firstData->process();
167164
168165// Check
169166if($firstData->isError()) {
170- // there was an error
167+ // there was an error
171168} else {
172- // transaction passed
169+ // transaction passed
173170}
174171```
175172
@@ -182,19 +179,19 @@ $firstData = new FirstData(API_LOGIN, API_KEY, HMAC_ID, HMAC_KEY, true);
182179// Charge
183180$firstData->setTransactionType(FirstData::TRAN_REFUND);
184181$firstData->setCreditCardNumber($data['number'])
185- ->setTransArmorToken($data['token'])
186- ->setCreditCardName($data['name'])
187- ->setCreditCardExpiration($data['exp'])
188- ->setAmount($data['amount'])
189- ->setReferenceNumber($orderId);
182+ ->setTransArmorToken($data['token'])
183+ ->setCreditCardName($data['name'])
184+ ->setCreditCardExpiration($data['exp'])
185+ ->setAmount($data['amount'])
186+ ->setReferenceNumber($orderId);
190187
191188$firstData->process();
192189
193190// Check
194191if($firstData->isError()) {
195- // there was an error
192+ // there was an error
196193} else {
197- // transaction passed
194+ // transaction passed
198195}
199196```
200197
@@ -207,19 +204,19 @@ $firstData = new FirstData(API_LOGIN, API_KEY, HMAC_ID, HMAC_KEY, true);
207204// Charge
208205$firstData->setTransactionType(FirstData::TRAN_VOID);
209206$firstData->setCreditCardType($data['number'])
210- ->setTransArmorToken($data['token'])
211- ->setCreditCardName($data['name'])
212- ->setCreditCardExpiration($data['exp'])
213- ->setAmount($data['amount'])
214- ->setReferenceNumber($orderId);
207+ ->setTransArmorToken($data['token'])
208+ ->setCreditCardName($data['name'])
209+ ->setCreditCardExpiration($data['exp'])
210+ ->setAmount($data['amount'])
211+ ->setReferenceNumber($orderId);
215212
216213$firstData->process();
217214
218215// Check
219216if($firstData->isError()) {
220- // there was an error
217+ // there was an error
221218} else {
222- // transaction passed
219+ // transaction passed
223220}
224221```
225222
0 commit comments