Preferences - Ruby - Mercado Pago Developers

Create preference

It is possible to create Preferences using the SDK below. For details on request parameters, check the Create preferences API.

          
preference_data = {
  items: [
    {
      title: 'Blue shirt',
      quantity: 10,
      currency_id: 'PEN',
      unit_price: 150
    }
  ],
  payer: {
    email: 'john@yourdomain.com'
  }
}

preference_response = sdk.preference.create(preference_data)
preference = preference_response[:response]