Comments (4)
julio336,
Do you already have your client_id and client_secret on MercadoPago?
from mercadopago.
Yes, I would like an example of how to make a checkout with MercadoPago, I hope you can help me!
By the way I have my client_id and my client_secret.
Kind regards.
from mercadopago.
I have defined a method at my products model like this:
client_id = 'xxxxx'
client_secret = 'xxxxxxxxxxxxx'
mp_client = MercadoPago::Client.new(client_id, client_secret)
Then I send some data, like your example:
data = {
"external_reference" => "OPERATION-ID-14288",
"items" => [
{
"id" => "123",
"title" => "Example T-Shirt",
"description" => "Red XL T-Shirt",
"quantity" => 1,
"unit_price" => 10.50,
"currency_id" => "BRL",
"picture_url" => "http://www.site.com/image/123.png"
}
],
"payer" => {
"name"=> "John",
"surname"=> "Mikel",
"email"=> "[email protected]"
},
"back_urls"=> {
"pending"=> "https://www.site.com/pending",
"success"=> "http://www.site.com/success",
"failure"=> "http://www.site.com/failure"
}
}
payment = mp_client.create_preference(data)
I got the Json as you said, but how can I redirect to the init_point url where is the data of the product?
I would like to know how to initialize my mercadopago count, I have code at the folder config/initializers/mercadopago.rb something like this:
client_id = 'xxxxx'
client_secret = 'xxxxxxxxxxxxx'
mp_client = MercadoPago::Client.new(client_id, client_secret)
But It doesn't answer, It brings some error like "mp client doesn't exists"
How can I make it work?
from mercadopago.
I'm sorry for taking so long to answer this question.
So, you were able to create the preference, right?
In the response hash, MercadoPago sends the init_point UR, which you should use to redirect the buyer to the checkout page on MercadoPago.
from mercadopago.
Related Issues (14)
- Add support for Ruby 2
- IPN on Sandbox mode HOT 2
- Authentication related tests are failing HOT 3
- Authentication error HOT 1
- Add VCR to tests
- Add ability to auto paginate results
- Release v2.2.1 or v2.3.0 HOT 1
- gemspec warnings on `gem build`
- Problems with authentication? HOT 4
- Make the collection module to be an Enumerable
- Security Issue JSON
- Redirecting to make payment HOT 1
- Problems with connection with SSL HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mercadopago.