diff --git a/composer.json b/composer.json index 3e70409..7b436f8 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,8 @@ { "name": "mp-ecommerce-php", "type": "project", - "require": {} + "require": { + "mercadopago/dx-php": "2.0.0", + "ext-json": "*" + } } diff --git a/detail-boleto.php b/detail-boleto.php new file mode 100644 index 0000000..b8c7bb0 --- /dev/null +++ b/detail-boleto.php @@ -0,0 +1,251 @@ + + + + E-commerce sample + + + + + + + + + + + + + + + +
+
+ +
+
+
+
+
+
+ +
+
+
+
+
+

+
+
+

+
+
+
+
Quantity :
+ +
+
+
+
+
+

Detalhe do comprador

+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+
+
+
+
+

+
+ +
+ + --> + + \ No newline at end of file diff --git a/detail.php b/detail.php index ade1f5c..6b6f31d 100644 --- a/detail.php +++ b/detail.php @@ -11,6 +11,7 @@ + @@ -44,7 +45,75 @@


- +
+

Detalhe do comprador

+
+
+ + +
+
+ + +
+
+ + +
+
+

Detalhes do cartão

+
+
+ + +
+
+ +
+ + / + +
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + + +
+ +
+
+
+
+
@@ -60,5 +129,113 @@ + + \ No newline at end of file diff --git a/process_payment/boleto.php b/process_payment/boleto.php new file mode 100644 index 0000000..d356ebe --- /dev/null +++ b/process_payment/boleto.php @@ -0,0 +1,25 @@ +transaction_amount = (float)$_POST['transactionAmount']; +$payment->description = $_POST['description']; +$payment->payment_method_id = "bolbradesco"; +$payment->payer = array( + "email" => $_POST['email'], + "first_name" => $_POST['nome'], + "last_name" => $_POST['sobrenome'], + "identification" => array( + "type" => $_POST['docType'], + "number" => $_POST['docNumber'] + ), +); + +$payment->save(); +echo $payment->transaction_details->external_resource_url; \ No newline at end of file diff --git a/process_payment/index.php b/process_payment/index.php new file mode 100644 index 0000000..dd186ac --- /dev/null +++ b/process_payment/index.php @@ -0,0 +1,32 @@ +transaction_amount = (float)$_POST['transactionAmount']; + $payment->token = $_POST['token']; + $payment->description = $_POST['description']; + $payment->installments = (int)$_POST['installments']; + $payment->payment_method_id = $_POST['paymentMethodId']; + + $payer = new MercadoPago\Payer(); + $payer->email = $_POST['email']; + $payer->identification = array( + "type" => $_POST['docType'], + "number" => $_POST['docNumber'] + ); + $payment->payer = $payer; + + $payment->save(); + + $response = array( + 'status' => $payment->status, + 'status_detail' => $payment->status_detail, + 'id' => $payment->id + ); + echo json_encode($response); \ No newline at end of file