vendredi 24 juillet 2015

RoR handling gem MercadoPago

I 'm trying to implement the MercadoPago-sdk gem.

[Github - Mercadolibre][1]

In the README:

"Payment Creation

Your request will need a hash to explain what the payment is for. For example:

data = {
  external_reference: "OPERATION-ID-1234",
  items: [
   {
      id:           "Código 123",
      title:        "Example T-Shirt",
      description:  "Red XL T-Shirt",
      quantity:     1,
      unit_price:   10.50,
      currency_id:  "BRL",
      picture_url:  "localhost:3000/image/123.png"
    }
  ],
  payer: {
    name:     "John",
    surname:  "Mikel",
    email:    "buyer@email.com"
 },
  back_urls: {
    pending: "localhost/pending",
    success: "localhost/success",
    failure: "localhost/failure"
  }
}

"

From what I understand I have to create the hash data on a form , and set payment = mp_client.create_preference (data) in the controller . It's like that? Or is not the right way? How should be the form to create the hash ?

thank you!

Aucun commentaire:

Enregistrer un commentaire