Пример #1
0
 public function index()
 {
     error_reporting(0);
     $options['clientId'] = '3622387872526969';
     $options['clientSecret'] = 'nM7RptdRoXtrD8DTAXkqQAVw6JlDDJmL';
     $options['redirectUri'] = 'https://github.com/ayudaresfacil/ayudaresfacil';
     $options['code'] = "TG-549513b5e4b0a8540f891937-171261795";
     $auth = CI_MercadoPago::auth($options);
     echo "auth";
     ma($auth);
     $auth = json_decode($auth);
     $options['refreshToken'] = $auth->{refresh_token};
     $token = CI_MercadoPago::token($options);
     echo "token";
     ma($token);
     $token = json_decode($token);
     $options['accessToken'] = $token->{access_token};
     $options['fee'] = 0;
     $item['title'] = "Donacion";
     $item['description'] = "Donacion";
     $item['quantity'] = 1;
     $item['unit_price'] = 1;
     $item['currency_id'] = "\$";
     $item['picture_url'] = "";
     $options['items'][0] = $item;
     $checkout = CI_MercadoPago::integrateCheckout($options);
     ma($checkout);
 }
Пример #2
0
 public function createMpConection($code)
 {
     $options['clientId'] = MP_CLIENT_ID;
     $options['clientSecret'] = MP_CLIENT_SECRET;
     $options['redirectUri'] = 'https://github.com/ayudaresfacil/ayudaresfacil';
     $options['code'] = $code;
     $auth = CI_MercadoPago::auth($options);
     $auth = json_decode($auth);
     $options['refreshToken'] = $auth->{refresh_token};
     $token = CI_MercadoPago::token($options);
     $token = json_decode($token);
     $options['accessToken'] = $token->{access_token};
     $options['fee'] = 0;
     $item['title'] = "Donacion";
     $item['description'] = "Donacion";
     $item['quantity'] = 1;
     $item['unit_price'] = 1;
     $item['currency_id'] = "\$";
     $item['picture_url'] = "";
     $options['items'][0] = $item;
     $checkout = CI_MercadoPago::integrateCheckout($options);
     $checkout = json_decode($checkout);
     return $checkout->{sandbox_init_point};
 }