From 7986499ab1667ffa78d2723e4ab9e201b47a1324 Mon Sep 17 00:00:00 2001 From: Hafiz Ismail Date: Tue, 11 Feb 2014 17:09:25 +0800 Subject: [PATCH] Implement Mobile Express Checkout (MEC) Add an option to enable mobile device support using MEC. It's a simple option to return the PAYMENTURL with 'cmd' argument to redirect url to '_express-checkout-mobile'. Usage: var cred = { username : config.paypal.api_username, password : config.paypal.api_password, signature : config.paypal.api_signature }; var opts = { sandbox : true, mobile_express_checkout : true, version : '93' }; var ec = new PayPalEC(cred, opts); ... MEC details https://developer.paypal.com/docs/classic/mobile/gs_MEC/ --- lib/paypal-ec.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/paypal-ec.js b/lib/paypal-ec.js index 3c09192..32d42af 100644 --- a/lib/paypal-ec.js +++ b/lib/paypal-ec.js @@ -36,6 +36,7 @@ var API_METHODS = [ var PayPalEC = function ( cred, opts ){ this.nvpreq = new NVPRequest( cred, opts ); this.sandbox = opts ? opts.sandbox : false; + this.mobile_express_checkout = opts ? opts.mobile_express_checkout : false; }; /** @@ -61,7 +62,7 @@ PayPalEC.prototype.make_payment_url = function ( token ){ host : ( this.sandbox ) ? SANDBOX_URL : REGULAR_URL, pathname : '/cgi-bin/webscr', query : { - cmd : '_express-checkout', + cmd : ( this.mobile_express_checkout ) ? '_express-checkout-mobile' : '_express-checkout', token : token } });