Last active
February 1, 2017 12:41
-
-
Save fernandobandeira/37845013f2667534503cf0fe28839761 to your computer and use it in GitHub Desktop.
Exemplo recorrente
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
try { | |
$plan = PagSeguroRecorrente::sendPreApprovalRequest([ | |
'preApprovalName' => 'Téste', | |
'preApprovalCharge' => 'auto', | |
'preApprovalPeriod' => 'MONTHLY', | |
'preApprovalAmountPerPayment' => 10.00, | |
]); | |
PagSeguroRecorrente::setPlan($plano) | |
->setSenderInfo([ | |
'senderName' => 'Nome Completo', | |
'senderPhone' => '12 12345678', | |
'senderEmail' => '[email protected]', | |
'senderHash' => '210923aed6eda1bebf3c91a4e9378512ab9420a2f68dd3e315407c9a26955f86', | |
'senderCPF' => '12345678900' //Ou CNPJ se for Pessoa Júridica | |
]) | |
->setCreditCardHolder([ | |
'creditCardHolderName' => 'Nome Completo', //Deve conter nome e sobrenome | |
'creditCardHolderBirthDate' => '10/02/1940', | |
]) | |
->setSenderAddress([ | |
'senderAddressStreet' => 'Rua/Avenida', | |
'senderAddressNumber' => 'Número', | |
'senderAddressDistrict' => 'Bairro', | |
'senderAddressPostalCode' => '12345-678', | |
'senderAddressCity' => 'Cidade', | |
'senderAddressState' => 'RS' | |
]) | |
->setBillingAddress([ | |
'billingAddressStreet' => 'Rua/Avenida', | |
'billingAddressNumber' => 'Número', | |
'billingAddressDistrict' => 'Bairro', | |
'billingAddressPostalCode' => '12345-678', | |
'billingAddressCity' => 'Cidade', | |
'billingAddressState' => 'RS' | |
]) | |
->sendPreApproval([ | |
'creditCardToken' => '4C63F1BD5A0E47220F8DB2920325499D' | |
]); | |
} | |
catch(\Artistas\PagSeguro\PagSeguroException $e) { | |
$e->getCode(); //codigo do erro | |
$e->getMessage(); //mensagem do erro | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment