examples/preapproval-payments/button.rb in mercadopago-sdk-0.3.1 vs examples/preapproval-payments/button.rb in mercadopago-sdk-0.3.2

- old
+ new

@@ -5,11 +5,11 @@ class Button def call(env) mp = MercadoPago.new('CLIENT_ID', 'CLIENT_SECRET') - preapprovalPayment = Hash[ + preapprovalPayment_data = Hash[ "payer_email" => "my_customer@my_site.com", "back_url" => "http://www.my_site.com", "reason" => "Monthly subscription to premium package", "external_reference" => "OP-1234", "auto_recurring" => Hash[ @@ -20,18 +20,18 @@ "start_date" => "2012-12-10T14:58:11.778-03:00", "end_date" => "2013-06-10T14:58:11.778-03:00" ] ] - preapprovalPaymentResult = mp.create_preference(preapprovalPayment) + preapprovalPayment = mp.create_preapproval_payment(preapprovalPayment_data) html = '<!doctype html> <html> <head> <title>MercadoPago SDK - Create Preapproval Payment and Show Subscription Example</title> </head> <body> - <a href="' + preapprovalPaymentResult['response']['init_point'] + '" name="MP-Checkout" class="orange-ar-m-sq-arall">Pay</a> + <a href="' + preapprovalPayment['response']['init_point'] + '" name="MP-Checkout" class="orange-ar-m-sq-arall">Pay</a> <script type="text/javascript" src="http://mp-tools.mlstatic.com/buttons/render.js"></script> </body> </html>' return [200, {'Content-Type' => 'text/html'}, [html]]