本文整理汇总了PHP中PagSeguroConfig::getApplicationCredentials方法的典型用法代码示例。如果您正苦于以下问题:PHP PagSeguroConfig::getApplicationCredentials方法的具体用法?PHP PagSeguroConfig::getApplicationCredentials怎么用?PHP PagSeguroConfig::getApplicationCredentials使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PagSeguroConfig
的用法示例。
在下文中一共展示了PagSeguroConfig::getApplicationCredentials方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: main
/**
*
*/
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");
$credentials = PagSeguroConfig::getApplicationCredentials();
// 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());
}
}
示例2: main
public static function main()
{
// Instantiate a new payment request
$directPaymentRequest = new PagSeguroDirectPaymentRequest();
// Set the Payment Mode for this payment request
$directPaymentRequest->setPaymentMode('DEFAULT');
// Set the Payment Method for this payment request
$directPaymentRequest->setPaymentMethod('CREDIT_CARD');
/**
* @todo Change the receiver Email
*/
$directPaymentRequest->setReceiverEmail('vendedor@lojamodelo.com.br');
// Set the currency
$directPaymentRequest->setCurrency("BRL");
// Add an item for this payment request
// Add an item for this payment request
$directPaymentRequest->addItem('0001', 'Descricao do item a ser vendido', 2, 10.0);
// Add an item for this payment request
$directPaymentRequest->addItem('0002', 'Descricao do item a ser vendido', 2, 5.0);
// Set a reference code for this payment request. It is useful to identify this payment
// in future notifications.
$directPaymentRequest->setReference("REF123");
// Set your customer information.
// If you using SANDBOX you must use an email @sandbox.pagseguro.com.br
$directPaymentRequest->setSender('João Comprador', 'email@comprador.com.br', '11', '56273440', 'CPF', '156.009.442-76', true);
$directPaymentRequest->setSenderHash("d94d002b6998ca9cd69092746518e50aded5a54aef64c4877ccea02573694986");
// Set shipping information for this payment request
$sedexCode = PagSeguroShippingType::getCodeByType('SEDEX');
$directPaymentRequest->setShippingType($sedexCode);
$directPaymentRequest->setShippingAddress('01452002', 'Av. Brig. Faria Lima', '1384', 'apto. 114', 'Jardim Paulistano', 'São Paulo', 'SP', 'BRA');
//Set billing information for credit card
$billing = new PagSeguroBilling(array('postalCode' => '01452002', 'street' => 'Av. Brig. Faria Lima', 'number' => '1384', 'complement' => 'apto. 114', 'district' => 'Jardim Paulistano', 'city' => 'São Paulo', 'state' => 'SP', 'country' => 'BRA'));
$token = "5b97542cd1524b67a9e89b3d90c1f262";
$installment = new PagSeguroDirectPaymentInstallment(array("quantity" => 2, "value" => "15.00", "noInterestInstallmentQuantity" => 2));
$cardCheckout = new PagSeguroCreditCardCheckout(array('token' => $token, 'installment' => $installment, 'holder' => new PagSeguroCreditCardHolder(array('name' => 'João Comprador', 'documents' => array('type' => 'CPF', 'value' => '156.009.442-76'), 'birthDate' => date('01/10/1979'), 'areaCode' => 11, 'number' => 56273440)), 'billing' => $billing));
//Set credit card for payment
$directPaymentRequest->setCreditCard($cardCheckout);
try {
/**
* #### Credentials #####
* Replace the parameters below with your credentials
* You can also get your credentials from a config file. See an example:
* $credentials = PagSeguroConfig::getAccountCredentials();
*/
// seller authentication
//$credentials = new PagSeguroAccountCredentials("vendedor@lojamodelo.com.br",
// "E231B2C9BCC8474DA2E260B6C8CF60D3");
// application authentication
$credentials = PagSeguroConfig::getApplicationCredentials();
$credentials->setAuthorizationCode("E231B2C9BCC8474DA2E260B6C8CF60D3");
// Register this payment request in PagSeguro to obtain the payment URL to redirect your customer.
$return = $directPaymentRequest->register($credentials);
self::printTransactionReturn($return);
} catch (PagSeguroServiceException $e) {
die($e->getMessage());
}
}
示例3: authorizationNotification
private static function authorizationNotification($notificationCode)
{
$credentials = PagSeguroConfig::getApplicationCredentials();
try {
$authorization = PagSeguroNotificationService::checkAuthorization($credentials, $notificationCode);
// Do something with $authorization
} catch (PagSeguroServiceException $e) {
die($e->getMessage());
}
}
示例4: main
public static function main()
{
//$authorizationCode = "C7A067F4AEDC4B538242EBBE3B7FB755";
$authorizationCode = "FD3AF1B214EC40F0B0A6745D041BF50D";
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");
$credentials = PagSeguroConfig::getApplicationCredentials();
$authorization = PagSeguroAuthorizationSearchService::searchByCode($credentials, $authorizationCode);
self::printAuthorization($authorization);
} catch (PagSeguroServiceException $e) {
die($e->getMessage());
}
}