PHP code example of first-data / gateway
1. Go to this page and download the library: Download first-data/gateway library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once ('vendor/autoload.php' );
first-data / gateway example snippets
namespace FirstData \FirstApi \Client \Simple ;
class MerchantCredentials {
public function __construct ($apiSecret, $apiKey) ;
}
namespace FirstData \FirstApi \Client \Simple ;
class ClientContext {
public static function create (MerchantCredentials $creds, $apiBasePath = ClientContext::DEFAULT_BASE_PATH, $defaultRegion = null, $defaultStoreId = null) ;
public function getFactory () ;
public function setApiBasePath ($basePath) ;
}
namespace FirstData \FirstApi \Client \Simple ;
class ClientFactory {
public function getAuthenticationApi () ;
public function getCardInfoLookupApi () ;
public function getCardVerificationApi () ;
public function getCurrencyConversionApi () ;
public function getFraudDetectApi () ;
public function getOrderApi () ;
public function getPaymentApi () ;
public function getPaymentSchedulesApi () ;
public function getPaymentTokenApi () ;
public function getPaymentUrlApi () ;
}
namespace FirstData \FirstApi \Client \Simple ;
use FirstData \FirstApi \Client \Model \AccessTokenResponse ;
use FirstData \FirstApi \Client \Model \ErrorResponse ;
class AuthenticationApi {
public function authenticationAccessTokensPost () ;
}
namespace FirstData \FirstApi \Client \Simple ;
use FirstData \FirstApi \Client \Model \CardInfoLookupRequest ;
use FirstData \FirstApi \Client \Model \CardInfoLookupResponse ;
use FirstData \FirstApi \Client \Model \ErrorResponse ;
class CardInfoLookupApi {
public function cardInfoLookup (CardInfoLookupRequest $payload, $region = null) ;
}
namespace FirstData \FirstApi \Client \Simple ;
use FirstData \FirstApi \Client \Model \CardVerificationRequest ;
use FirstData \FirstApi \Client \Model \TransactionResponse ;
use FirstData \FirstApi \Client \Model \ErrorResponse ;
class CardVerificationApi {
public function verifyCard (CardVerificationRequest $payload, $region = null) ;
}
namespace FirstData \FirstApi \Client \Simple ;
use FirstData \FirstApi \Client \Model \ExchangeRateRequest ;
use FirstData \FirstApi \Client \Model \ExchangeRateResponse ;
use FirstData \FirstApi \Client \Model \ErrorResponse ;
class CurrencyConversionApi {
public function getExchangeRate (ExchangeRateRequest $payload, $region = null) ;
}
namespace FirstData \FirstApi \Client \Simple ;
use FirstData \FirstApi \Client \Model \ScoreOnlyRequest ;
use FirstData \FirstApi \Client \Model \ScoreOnlyResponse ;
use FirstData \FirstApi \Client \Model \ClientRegistration ;
use FirstData \FirstApi \Client \Model \PaymentRegistration ;
use FirstData \FirstApi \Client \Model \FraudRegistrationResponse ;
use FirstData \FirstApi \Client \Model \ErrorResponse ;
class FraudDetectApi {
public function scoreOnly (ScoreOnlyRequest $payload, $region = null) ;
public function fraudPaymentRegistrationPost (PaymentRegistration $payload,$region = null) ;
}
namespace FirstData \FirstApi \Client \Simple ;
use FirstData \FirstApi \Client \Model \OrderResponse ;
use FirstData \FirstApi \Client \Model \SecondaryTransaction ;
use FirstData \FirstApi \Client \Model \TransactionResponse ;
use FirstData \FirstApi \Client \Model \ErrorResponse ;
class OrderApi {
public function orderInquiry ($orderId, $region = null, $storeId = null) ;
public function submitSecondaryTransaction ($orderId, SecondaryTransaction $payload, $region = null, $storeId = null) ;
}
namespace FirstData \FirstApi \Client \Simple ;
use FirstData \FirstApi \Client \Model \AuthenticationVerificationRequest ;
use FirstData \FirstApi \Client \Model \PrimaryTransaction ;
use FirstData \FirstApi \Client \Model \SecondaryTransaction ;
use FirstData \FirstApi \Client \Model \TransactionResponse ;
use FirstData \FirstApi \Client \Model \ErrorResponse ;
class PaymentApi {
public function finalizeSecureTransaction ($transactionId, AuthenticationVerificationRequest $payload, $region = null) ;
public function primaryPaymentTransaction (PrimaryTransaction $payload, $region = null) ;
public function secondaryPaymentTransaction ($transactionId, SecondaryTransaction $payload, $region = null, $storeId = null) ;
public function transactionInquiry ($transactionId, $region = null, $storeId = null) ;
}
namespace FirstData \FirstApi \Client \Simple ;
use FirstData \FirstApi \Client \Model \PaymentSchedulesRequest ;
use FirstData \FirstApi \Client \Model \PaymentSchedulesResponse ;
use FirstData \FirstApi \Client \Model \RecurringPaymentDetailsResponse ;
use FirstData \FirstApi \Client \Model \ErrorResponse ;
class PaymentSchedulesApi {
public function cancelPaymentSchedule ($orderId, $region = null, $storeId = null) ;
public function createPaymentSchedule (PaymentSchedulesRequest $payload, $region = null) ;
public function inquiryPaymentSchedule ($orderId, $region = null, $storeId = null) ;
public function updatePaymentSchedule ($orderId, PaymentSchedulesRequest $payload, $region = null, $storeId = null) ;
}
namespace FirstData \FirstApi \Client \Simple ;
use FirstData \FirstApi \Client \Model \PaymentTokenizationRequest ;
use FirstData \FirstApi \Client \Model \PaymentTokenizationResponse ;
use FirstData \FirstApi \Client \Model \ErrorResponse ;
class PaymentTokenApi {
public function createPaymentToken (PaymentTokenizationRequest $payload, $authorization = null, $region = null) ;
public function deletePaymentToken ($tokenId, $authorization = null, $region = null, $storeId = null) ;
public function getPaymentTokenDetails ($tokenId, $authorization = null, $region = null, $storeId = null)
// ...
}
namespace FirstData \FirstApi \Client \Simple ;
use FirstData \FirstApi \Client \Model \PaymentUrlRequest ;
use FirstData \FirstApi \Client \Model \PaymentUrlResponse ;
use FirstData \FirstApi \Client \Model \PaymentUrlDetailResponse ;
use FirstData \FirstApi \Client \Model \ErrorResponse ;
class PaymentUrlApi {
public function createPaymentUrl (PaymentUrlRequest $payload, $region = null) ;
public function deletePaymentUrl ($region = null,$storeId = null,$transactionId = null,$orderId = null,$paymentUrlId = null,$transactionTime = null) ;