/** * */ public static function main() { // Instantiate a new authorization request $authorizationRequest = new PagSeguroAuthorizationRequest(); $authorizationRequest->setReference('REF123'); $authorizationRequest->setRedirectURL('http://www.lojamodelo.com.br'); $authorizationRequest->setNotificationURL('http://www.lojamodelo.com.br'); /** * @enum "CREATE_CHECKOUTS", * @enum "RECEIVE_TRANSACTION_NOTIFICATIONS", * @enum "SEARCH_TRANSACTIONS", * @enum "MANAGE_PAYMENT_PRE_APPROVALS", * @enum "DIRECT_PAYMENT", * @enum "REFUND_TRANSACTIONS", * @enum "CANCEL_TRANSACTIONS" */ $authorizationRequest->setPermissions(array("CREATE_CHECKOUTS", "RECEIVE_TRANSACTION_NOTIFICATIONS", "SEARCH_TRANSACTIONS", "MANAGE_PAYMENT_PRE_APPROVALS", "DIRECT_PAYMENT", "REFUND_TRANSACTIONS", "CANCEL_TRANSACTIONS")); try { /** * #### Credentials ##### * Replace the parameters below with your credentials * You can also get your credentials from a config file. See an example: * $credentials = PagSeguroConfig::getApplicationCredentials(); */ $credentials = new PagSeguroApplicationCredentials("appId", "appKey"); // Register this payment request in PagSeguro to obtain the payment URL to redirect your customer. $return = $authorizationRequest->register($credentials); self::printAuthorizationReturn($return); } catch (PagSeguroServiceException $e) { die($e->getMessage()); } }