Sha256: 105e351610fc0efc8611388851bdfefc269e9ab5c387dec7e69e070e196ebcf2
Contents?: true
Size: 842 Bytes
Versions: 6
Compression:
Stored size: 842 Bytes
Contents
require 'rubygems' require 'rack' $LOAD_PATH << '../../../lib' require 'mercadopago.rb' class Button def call(env) mp = MercadoPago.new('CLIENT_ID', 'CLIENT_SECRET') preferenceData = {"items" => ["title"=>"testCreate", "quantity"=>1, "unit_price"=>10.2, "currency_id"=>"ARS"]} preference = mp.create_preference(preferenceData) html = '<!doctype html> <html> <head> <title>MercadoPago SDK - Create Preference and Show Checkout Example</title> </head> <body> <a href="' + preference['response']['init_point'] + '" name="MP-Checkout" class="orange-ar-m-sq-arall">Pay</a> <script type="text/javascript" src="//resources.mlstatic.com/mptools/render.js"></script> </body> </html>' return [200, {'Content-Type' => 'text/html'}, [html]] end end Rack::Handler::WEBrick.run(Button.new, :Port => 9000)
Version data entries
6 entries across 6 versions & 2 rubygems