Skip to content

Instantly share code, notes, and snippets.

@dancameron
Last active December 16, 2015 00:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dancameron/5347046 to your computer and use it in GitHub Desktop.
Save dancameron/5347046 to your computer and use it in GitHub Desktop.
Log of an attempted payment preference status.

Create a payment preference response

[09-Apr-2013 15:50:11] Array
(
[status] => 201
[response] => Array
    (
        [collector_id] => 131258484
        [operation_type] => regular_payment
        [items] => Array
            (
                [0] => Array
                    (
                        [id] => 
                        [title] => Prime Theme
                        [currency_id] => ARS
                        [picture_url] => http://prime.gbmu.dev/wp-content/themes/prime-theme-beta/img/logo.png
                        [description] => 2*Attributes without Categories (44); 
                        [quantity] => 1
                        [unit_price] => 0.2
                    )

            )

        [payer] => Array
            (
                [email] => grow@sproutventure.com
                [name] => Daniel
                [surname] => Cameron
            )

        [back_urls] => Array
            (
                [failure] => 
                [error] => http://prime.gbmu.dev/checkout/
                [pending] => http://prime.gbmu.dev/checkout/?mp_payment=1
                [cancel] => http://prime.gbmu.dev/cart/
                [success] => http://prime.gbmu.dev/checkout/?mp_payment=1
            )

        [payment_methods] => Array
            (
                [excluded_payment_methods] => Array
                    (
                    )

                [excluded_payment_types] => Array
                    (
                    )

                [installments] => 
            )

        [client_id] => 963
        [marketplace] => NONE
        [marketplace_fee] => 0
        [external_reference] => 234
        [additional_info] => 
        [expires] => 
        [expiration_date_from] => 
        [expiration_date_to] => 
        [date_created] => 2013-04-09T11:50:10.140-04:00
        [id] => 131258484-36f7a44b-2f55-4f01-b3c6-37ef89db0dad
        [init_point] => https://www.mercadopago.com/mla/checkout/pay?pref_id=131258484-36f7a44b-2f55-4f01-b3c6-37ef89db0dad
        [sandbox_init_point] => https://sandbox.mercadopago.com/mla/checkout/pay?pref_id=131258484-36f7a44b-2f55-4f01-b3c6-37ef89db0dad
    )

)

Payment on Sandbox

Redirected payment to sandbox, url: https://sandbox.mercadopago.com/mla/checkout/pay?pref_id=131258484-36f7a44b-2f55-4f01-b3c6-37ef89db0dad

Used Test Credit Card Info: http://s-v.me/O9iG

https://developers.mercadopago.com/alpha/sandbox

Callback to check payment status

On return the system checks the payment status based on the id found earlier. The function used within the MP class is search_payment()

The API callback is: https://api.mercadolibre.com/sandbox/collections/search?site_id=MLA&id=131258484-36f7a44b-2f55-4f01-b3c6-37ef89db0dad&offset=0&limit=0&access_token=APP_USR-360806205579652-040911-a0fd1a1fbf9e0669852d127d6a97302e__K_L__-131258484

Result is null http://s-v.me/OAOe

This callback is made immedialty after purchase and the return to the site.

Attempting to get payment status via get_payment_info()

I've attemtped to use the get_payment_info() function and the error is resource_not_found. http://s-v.me/O9qo

API URL: https://api.mercadolibre.com/sandbox/collections/notifications/131258484-36f7a44b-2f55-4f01-b3c6-37ef89db0dad&offset=0&limit=0?access_token=APP_USR-360806205579652-040911-a0fd1a1fbf9e0669852d127d6a97302e__K_L__-131258484

Attempting to get the payment status via other search methods

  1. Tried using the same access token used to create the payment preference, null result. https://api.mercadolibre.com/sandbox/collections/search?site_id=MLA&id=131258484-36f7a44b-2f55-4f01-b3c6-37ef89db0dad&offset=0&limit=0&access_token=APP_USR-360806205579652-040911-7731ee37f93d3815c2f126d0b8e16820__H_D__-131258484

  2. Get payment status without sandbox, even if the payment was made through sandbox. https://api.mercadolibre.com/collections/notifications/131258484-36f7a44b-2f55-4f01-b3c6-37ef89db0dad&offset=0&limit=0?access_token=APP_USR-360806205579652-040911-a0fd1a1fbf9e0669852d127d6a97302e__K_L__-131258484

  3. Sandbox searching for payments seems to return null regardless of what's searched. https://api.mercadolibre.com/sandbox/collections/search?access_token=APP_USR-360806205579652-040911-7731ee37f93d3815c2f126d0b8e16820__H_D__-131258484&operation_type=regular_payment&range=date_created&begin_date=NOW-1MONTH&end_date=NOW

  4. Searching based on external reference produces null. https://api.mercadolibre.com/sandbox/collections/search?access_token=APP_USR-360806205579652-040911-7731ee37f93d3815c2f126d0b8e16820__H_D__-131258484&external_reference=234

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment