Exemple #1
0
function exampleConfigPaymentWay($param)
{
    $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->addPaymentWay('creditCard');
    $moip->addPaymentWay('billet');
    $moip->setBilletConf("2011-04-06", true, array("Primeira linha", "Segunda linha", "Terceira linha"), "http://seusite.com.br/logo.gif");
    print_r($moip->send());
}
Exemple #2
0
        $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']) {
    $retorno = '{ "cod": "sucesso", "token": "' . $_SESSION['sessionToken'] . '" }';
} else {
    $retorno = '{ "cod": "erro" }';