The GP SDK for PHP provides a native interface to the GP API. This is still a work in progress (WIP) project and hence it will be on the master branch.
composer require lesterchan/gp-php-sdkThis helps the end-user login or register for GP.
/**
* @param string $codeVerifier Code verifier
* @param string $requestToken Request token
* @param string $redirectUri Redirect URI
* @param string $scope Scope (payment.one_time_charge or payment.recurring_charge)
*/
$gp->getOauthAuthorizeUrl($codeVerifier, $requestToken, $redirectUri, $scope);/**
* @param string $code Code
* @param string $redirectUri Redirect URI
* @param string $codeVerifier Code verifier
*/
$gp->getAccessToken($code, $redirectUri, $codeVerifier);/**
* @param string $partnerId Partner ID
* @param string $partnerSecret Partner Secret
* @param string $clientId Client ID
* @param string $clientSecret Client Secret
* @param string $merchantId Merchant ID
*/
$gp = new GP\OneTimeCharge($partnerId, $partnerSecret, $clientId, $clientSecret, $merchantId);/**
* @param string $txId order ID
* @param string $groupTxId partner transaction ID
* @param int $amount Transaction amount as integer
* @param string $description description of the charge (optional)
*/
$gp->initCharge($txId, $groupTxId, $amount, $description);/**
* @param string $accessToken OAuth access token
* @param string $partnerTxId partner transaction ID
*/
$gp->completeCharge($accessToken, $partnerTxId);/**
* @param string $partnerId Partner ID
* @param string $partnerSecret Partner Secret
* @param string $clientId Client ID
* @param string $clientSecret Client Secret
* @param string $merchantId Merchant ID
*/
$gp = new GP\Tokenization($partnerId, $partnerSecret, $clientId, $clientSecret, $merchantId);/**
* @param string $txId order ID
*/
$gp->bind($txId);/**
* @param string $accessToken OAuth access token
* @param string $txId order ID
* @param string $groupTxId partner transaction ID
* @param int $amount Transaction amount as integer
* @param string $description description of the charge (optional)
*/
$gp->charge($accessToken, $txId, $groupTxId, $amount, $description);/**
* @param string $accessToken OAuth access token
* @param string $txId order ID
*/
$gp->unbind($accessToken, $txId);/**
* @param string $accessToken OAuth access token
*/
$gp->getWalletInfo($accessToken);/**
* @param string $accessToken OAuth access token
* @param string $txId order ID
*/
$gp->checkChargeStatus($accessToken, $txId);/**
* @param string $accessToken OAuth access token
* @param string $txId order ID
* @param string $groupTxId partner transaction ID
* @param string $originTxID original partner transaction ID
* @param int $amount Transaction amount as integer
* @param string $description description of the charge (optional)
*/
$gp->refund($accessToken, $txId, $groupTxId, $originTxID, $amount, $description);/**
* @param string $accessToken OAuth access token
* @param string $txId order ID
*/
$gp->checkRefundStatus($accessToken, $txId);/**
* @param string $partnerId Partner ID
* @param string $partnerSecret Partner Secret
* @param string $merchantId Merchant ID
* @param string $terminalId Terminal ID
*/
$gp = new GP\Pos($partnerId, $partnerSecret, $merchantId, $terminalId);/**
* @param string $txId order ID
* @param int $amount Transaction amount as integer
*/
$gp->createMerchantPresentQrCode($txId, $amount);/**
* @param string $txId order ID
* @param int $amount Transaction amount as integer
* @param string $qrCode QR code being scanned
*/
$gp->performConsumerPresentQrCode($txId, $amount, $qrCode);/**
* @param string $txId order ID
*/
$gp->qrCodeInquiry($txId);/**
* @param string $origTxID Original order ID
*/
$gp->cancelTransaction($origTxID);/**
* @param string $txID order ID
* @param string $origTxID Original order ID
* @param int $amount Transaction amount as integer
*/
$gp->refundTransaction($txID, $origTxID, $amount);$gp->useProduction();/**
* @param string $countryCode Country code (alpha-2)
*/
$gp->setCountryCode($countryCode);/**
* @param string $currency Currency
*/
$gp->setCurrency($currency);/**
* @param int $length Length
*/
$gp->generateNonce($length);Please refer to the GP PHP SDK Sample Code Repository for some sample codes.