Skip to content

Instantly share code, notes, and snippets.

@JuaniVeltri
Created March 20, 2019 13:15
Show Gist options
  • Save JuaniVeltri/d83c0958fde3e61fa0076a745cab63cc to your computer and use it in GitHub Desktop.
Save JuaniVeltri/d83c0958fde3e61fa0076a745cab63cc to your computer and use it in GitHub Desktop.
Crear pago excluyendo medios de pago
<?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 = "test@test.com.ar";
# 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