MercadoPago create customer code error 130

453 views Asked by At

I'm using the mercadopago-sdk gem, to create customers by API sending email addresses but I'm getting an error code that's not even on the documentation page

response = Mercadopago::SDK.new('access-token').customer.create(email: '[email protected]')

Response

{:status=>400, :response=>{"message"=>"invalid parameters ", "error"=>"bad_request", "status"=>400, "cause"=>[{"code"=>"130", "description"=>"Invalid customer data"}]}}

Documentation https://www.mercadopago.com.ar/developers/es/reference/customers/_customers/post

  • Ruby: 2.6.6

  • mercadopago-sdk (2.0.1)

1

There are 1 answers

2
Dmytro Savochkin On

Try passing the hash explicitly:

Mercadopago::SDK.new('access-token').customer.create({ email: '[email protected]' })

If it doesn't help, check that you are using the latest version of mercadopago-sdk gem (right now it seems to be 2.1.0). Why I am mentioning this is because on the latest gem when I try to run the line you wrote in your question (using the access token from their test code) it gives me a different error

gems/mercadopago-sdk-2.1.0/lib/mercadopago/resources/customer.rb:20:in `create': wrong number of arguments (given 0, expected 1) (ArgumentError)

which makes me suspect you are using the old gem version if you get a different error.

If that doesn't work also check the code of their tests. Maybe they expect more parameters from your access token, not just an email of a customer but also their name, address, etc.

If that doesn't help either your best bet might be contacting them directly.