Created
March 20, 2019 13:15
-
-
Save JuaniVeltri/d83c0958fde3e61fa0076a745cab63cc to your computer and use it in GitHub Desktop.
Crear pago excluyendo medios de pago
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 | |
require_once 'vendor/autoload.php'; | |
MercadoPago\SDK::setAccessToken("ACCESS_TOKEN"); | |
# Create a preference object | |
$preference = new MercadoPago\Preference(); | |
# Create an item object | |
$item = new MercadoPago\Item(); | |
$item->title = "Heavy Duty Concrete Gloves"; | |
$item->quantity = 2; | |
$item->currency_id = "ARS"; | |
$item->unit_price = 27.38; | |
# Create a payer object | |
$payer = new MercadoPago\Payer(); | |
$payer->email = "[email protected]"; | |
# Setting preference properties | |
$preference->items = array($item); | |
$preference->marketplace_fee = 15 | |
$preference->payment_methods = array( | |
"excluded_payment_types" => array( | |
(object) ["id" => "ticket"], | |
(object) ["id" => "atm"], | |
), | |
"excluded_payment_methods" => array( | |
(object) ["id" => "master"], | |
); | |
# Save and posting preference | |
$preference->save(); | |
echo $preference->init_point; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment