mercadopago / DEPRECATED-sdk-php

DEPRECATED - MercadoPago PHP SDK
MIT License
1 stars 10 forks source link

El codigo no permite crear preferencias en modo Sandbox #24

Closed asmerkin closed 5 years ago

asmerkin commented 10 years ago
public function create_preference($preference) {
    $access_token = $this->get_access_token();

    $preference_result = MPRestClient::post("/checkout/preferences?access_token=" . $access_token, $preference);
    return $preference_result;
}
matiasgordon commented 10 years ago

Hola Asmerkin, Puedes ver en la documentación de Sandbox cómo utilizar el SDK en esta modalidad. http://developers.mercadopago.com/sandbox Saludos,

asmerkin commented 10 years ago

Genial, y el tema de los refunds se pueden testear en sandbox? No encontré la forma.

Gracias!

matiasgordon commented 10 years ago

API PUT https://api.mercadolibre.com/sandbox/collections/ID_DE_PAGO/status?access_token=TU_ACCESS_TOKEN

{"status": ":refunded", "status_detail": ":refunded"}

Saludos,

asmerkin commented 10 years ago

Ah, yo estaba usando el sdk para php. Me recomendás que haga un call directo?

Gracias!

2014-09-16 15:04 GMT-03:00 Matias Gordon notifications@github.com:

API PUT

https://api.mercadolibre.com/sandbox/collections/ID_DE_PAGO/status?access_token=TU_ACCESS_TOKEN

{"status": ":refunded", "status_detail": ":refunded"}

Saludos,

— Reply to this email directly or view it on GitHub https://github.com/mercadopago/sdk-php/issues/24#issuecomment-55786323.

Andrés Smerkin http://www.andressmerkin.com.ar

matiasgordon commented 10 years ago

El SDK no esta preparado para refund en sandbox. Podes agregarlo modificando la funcion refund_payment:

public function refund_payment($id) {
        $access_token = $this->get_access_token();

        $uri_prefix = $this->sandbox ? "/sandbox" : "";

        $refund_status = array(
            "status" => "refunded"
        );

        $response = MPRestClient::put($uri_prefix."/collections/" . $id . "?access_token=" . $access_token, $refund_status);
        return $response;
    }

En el archivo donde llames a la funcion refund_payment agrega:

 $mp->sandbox_mode(TRUE);

Saludos.

asmerkin commented 10 years ago

Si lo hice pero no funcionó. No se pq Sent using CloudMagic On mar, sep 16, 2014 at 3:23 PM, Matias Gordon notifications@github.com wrote:El SDK no esta preparado para refund en sandbox. Podes agregarlo modificando la funcion refund_payment:

public function refund_payment($id) { $access_token = $this->get_access_token();

    $uri_prefix = $this->sandbox ? "/sandbox" : "";

    $refund_status = array(
        "status" => "refunded"
    );

    $response = MPRestClient::put($uri_prefix."/collections/" . $id . "?access_token=" . $access_token, $refund_status);
    return $response;
}

En el archivo donde llames a la funcion refund_payment agrega:

$mp->sandbox_mode(TRUE);

Saludos.

—Reply to this email directly or view it on GitHub.

knifesk commented 8 years ago

Se que quizas a vos ya no te haga falta, pero yo probé directamente haciendo un PUT a la api de sandbox y no me funcionó hasta que cambie el content-type a application/json