WePay.userRegister()

Register a new user account that can accept payments.

Register a new user account with WePay and returns an access token.

Usage

Hover over inputs/exits for more info.

var WePay = require('machinepack-wepay');


// Register a new user account that can accept payments.

WePay.userRegister({

clientId: 123456,

clientSecret: '6446c521bd',

email: 'bilbo@baggins.com',

scope: 'manage_accounts,collect_payments,view_user,send_money,preapprove_payments',

firstName: 'Bilbo',

lastName: 'Baggins',

originalIp: '74.125.224.84',

originalDevice: 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_6; en-US) AppleWebKit/534.13 (KHTML, like Gecko) Chrome/9.0.597.102 Safari/534.13',

tosAcceptanceTime: 1209600,

useProduction: false,

redirectUri: 'https://www.baggins.com/thanks',

callbackUri: 'https://www.baggins.com/callback',

}).exec({

// An unexpected error occurred.

error: function (err) {

 

},

// OK.

success: function (result) {

 

},

});

Inputs

clientId required

The integer client ID issued to the app, found on your application's dashboard

123456
clientSecret required

The string client secret issued to the app, found on your application's dashboard

'6446c521bd'
email required

The email of the user you want to register

'bilbo@baggins.com'
scope required

A comma separated list of permissions.

'manage_accounts,collect_payments,view_user,send_money,preapprove_payments'
firstName required

The first name of the user you want to register

'Bilbo'
lastName required

The last name of the user you want to register

'Baggins'
originalIp required

The IP address of the user you want to register

'74.125.224.84'
originalDevice required

The user-agent (for web) or the IMEI (for mobile) of the user you want to register

'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_6; en-US) AppleWebKit/534.13 (KHTML, like Gecko) Chrome/9.0.597.102 Safari/534.13'
tosAcceptanceTime required

A Unix timestamp referencing the time the user accepted WePay's terms of service.

1209600
useProduction

Use WePay production API - payments will be charged. Defaults to WePay staging - payments are not charged.

false
redirectUri

The uri the user will be redirected to after they have confirmed they wanted to be registered on WePay. By default this will be your application's homepage.

'https://www.baggins.com/thanks'
callbackUri

The callback_uri you want to receive IPNs on. Must be a full URI.

'https://www.baggins.com/callback'

Exits

error

An unexpected error occurred.

success

OK.

{ user_id: 567235,
  access_token: '604f39f41e364951ced74070c6e8bfa49d346cdfee6191b03c2c2d9c9cda9184',
  token_type: 'BEARER',
  expires_in: 1209600 }