Example #1
0
function exampleFull()
{
    $moip = new Moip();
    $moip->setEnvironment('test');
    $moip->setCredential(array('key' => 'ABABABABABABABABABABABABABABABABABABABAB', 'token' => '01010101010101010101010101010101'));
    $moip->setUniqueID(false);
    $moip->setValue('100.00');
    $moip->setReason('Teste do Moip-PHP');
    $moip->setPayer(array('name' => 'Nome Sobrenome', 'email' => '*****@*****.**', 'payerId' => 'id_usuario', 'billingAddress' => array('address' => 'Rua do Zézinho Coração', 'number' => '45', 'complement' => 'z', 'city' => 'São Paulo', 'neighborhood' => 'Palhaço Jão', 'state' => 'SP', 'country' => 'BRA', 'zipCode' => '01230-000', 'phone' => '(11)8888-8888')));
    $moip->validate('Identification');
    $moip->setReceiver('*****@*****.**');
    $moip->addParcel('2', '4');
    $moip->addParcel('5', '7', '1.00');
    $moip->addParcel('8', '12', null, true);
    $moip->addComission('Razão do Split', 'recebedor_secundario', '5.00');
    $moip->addComission('Razão do Split', 'recebedor_secundario', '2.00', true);
    $moip->addComission('Razão do Split', 'recebedor_secundario_2', '12.00', true, 'recebedor_secundario_3');
    $moip->addPaymentWay('creditCard');
    $moip->addPaymentWay('billet');
    $moip->addPaymentWay('financing');
    $moip->addPaymentWay('debit');
    $moip->addPaymentWay('debitCard');
    $moip->setBilletConf("2011-04-06", true, array("Primeira linha", "Segunda linha", "Terceira linha"), "http://seusite.com.br/logo.gif");
    print_r($moip->getXML());
}
Example #2
0
    $resultPedidoPagamento = $mysqli->ExecutarSQL($queryPedidoPagamento);
    $idPedidoPagamento = $mysqli->InsertId();
    if ($idPedidoPagamento) {
        $mysqli->ExecutarSQL("UPDATE e_PEDIDO SET NUMERO_PEDIDO = '" . $idPedido . "-" . $idPedidoPagamento . "' WHERE ID_PEDIDO = " . $idPedido . "");
    }
}
if ($_SESSION['sessionValorPagamento'] != $valorPagamento or $_SESSION['sessionIdPedido'] != $idPedido or $formaPagamentoAnterior != $formaPagamento) {
    include_once "autoload.inc.php";
    $moip = new Moip();
    $moip->setEnvironment();
    $moip->setCredential(array('key' => 'S1GYRB2AWMYLYDIKMUIZJSGHYNSFXSCEGKJQ1BCY', 'token' => 'II222XFJJEAKQCBE6E9RKNGGJ355AOIP'));
    $moip->setUniqueID($idPedido . "-" . $idPedidoPagamento);
    $moip->setValue($valorPagamento);
    $moip->setReason('Pagamento Pedido: ' . $idPedido . "-" . $idPedidoPagamento);
    $moip->setReceiver('comlinestramontina');
    $moip->setPayer(array('name' => $name, 'email' => $email, 'payerId' => $payerId, 'billingAddress' => array('address' => $address, 'number' => $number, 'complement' => $complement, 'city' => $city, 'neighborhood' => $neighborhood, 'state' => $state, 'country' => $country, 'zipCode' => $zipCode, 'phone' => $phone)));
    $moip->addParcel('1', '12');
    $moip->validate('Identification');
    $moip->send();
    // print_r($moip->getAnswer());
    // print_r($moip->getXML());
    if ($moip->getAnswer()->token) {
        $retorno = '{ "cod": "sucesso", "token": "' . $moip->getAnswer()->token . '" }';
        $_SESSION['sessionValorPagamento'] = $valorPagamento;
        $_SESSION['sessionToken'] = $moip->getAnswer()->token;
    } else {
        $retorno = '{ "cod": "erro" }';
    }
} else {
}
if ($_SESSION['sessionToken']) {