/** * Processa os produtos e envia a requisição ao PagSeguro * */ public function checkout() { // caso não tenha definido as credenciais no bootstrap descomente a linha abaixo // e defina seus dados //$this->Checkout->defineCredenciais('seu-email', 'seu-token'); // opcionais //$this->Checkout->defineUrlRetorno('url-de-retorno'); //$this->Checkout->defineReferencia(25); $this->Checkout->adicionarItem(1, 'Produto Teste', '0.01', '1000', 1); $this->Checkout->adicionarItem(2, 'Produto Teste 2', '12.40', '1000', 1); $this->Checkout->adicionarItem(3, 'Produto Teste 3', '27.90', '1000', 1); $this->Checkout->defineContatosComprador('nome do comprador', 'email-do-comprador', '41', '99999999'); $this->Checkout->defineEnderecoComprador('80000000', 'Rua Teste', '0000', 'Complemento', 'Bairro', 'Cidade', 'UF'); $this->Checkout->defineTipoFrete(PagSeguroEntrega::TIPO_SEDEX); // opcional $this->Checkout->defineValorTotalFrete('0.01'); $this->Checkout->defineTipoPagamento(PagSeguroTiposPagamento::tipoDePagamentoEmString(PagSeguroTiposPagamento::TIPO_PAGAMENTO_BOLETO)); if ($result = $this->Checkout->finalizaCompra()) { $this->redirect($result); } }
/** * Retorna tipo e meio de pagamento * * @return array * @since 1.0 */ public function obterDadosPagamento() { return array('tipo' => PagSeguroTiposPagamento::tipoDePagamentoEmString($this->dadosTransacao->getPaymentMethod()->getType()->getValue()), 'metodo' => PagSeguroTiposPagamento::meioDePagamentoEmString($this->dadosTransacao->getPaymentMethod()->getCode()->getValue())); }
/** * Retorna tipo e meio de pagamento * * @return array * @since 2.1 */ public function obterDadosPagamento() { $dadosPagamento = array('tipo_id' => $this->consultaPorCodigo->getPaymentMethod()->getType()->getValue(), 'tipo' => PagSeguroTiposPagamento::tipoDePagamentoEmString($this->consultaPorCodigo->getPaymentMethod()->getType()->getValue()), 'metodo_id' => $this->consultaPorCodigo->getPaymentMethod()->getCode()->getValue(), 'metodo' => PagSeguroTiposPagamento::meioDePagamentoEmString($this->consultaPorCodigo->getPaymentMethod()->getCode()->getValue())); return $dadosPagamento; }