Create a checkout for an account.

There are two ways to have your customers make a payment. You can have the checkout url hosted by WePay or you can use a previously acquired payment method, such as a preapproval or a credit card.


Hover over inputs/exits for more info.

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

// Create a checkout for an account.


accessToken: '604f39f41e364951ced74070c6e8bfa49d346cdfee6191b03c2c2d9c9cda9184',

accountId: 1548718026,

shortDescription: '2 dozen bisquits',

type: 'goods',

amount: 9.99,

currency: 'USD',

longDescription: 'This recipe will produce the biggest biscuits in the history of the world! Serve these gems with butter, preserves, gravy or they can also be used as dinner rolls...you get the picture.',

emailMessage: {},

fee: {},

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

autoCapture: false,

referenceId: '1234abcd',

uniqueId: 'abcdef123456',

hostedCheckout: {},

paymentMethod: {},

deliveryType: 'none',

useProduction: false,


// An unexpected error occurred.

error: function (err) {



// OK.

success: function (result) {





accessToken required

The string access token of the user accepting the checkout payment.

accountId required

The unique ID of the account you want to create a checkout for.

shortDescription required

A short description of what is being paid for. Max 255 chars.

'2 dozen bisquits'
type required

The checkout type (one of the following: goods, service, donation, event or personal). Must be in lowercase.

amount required

The amount that the payer will pay.

currency required

The currency used. Possible values: USD, CAD


A long description of what is being paid for. Max 2047 chars.

'This recipe will produce the biggest biscuits in the history of the world! Serve these gems with butter, preserves, gravy or they can also be used as dinner rolls...you get the picture.'

Specifies a short message to send to the payee and payer when a checkout is successful. More at https://stage.wepay.com/developer/reference/structures#email_message


Specify whether an app fee will be collected and who should pay the app fee. For EMV transactions, this parameter must be present. More at https://stage.wepay.com/developer/reference/structures#fee


The uri that will receive any instant payment notifications sent. Needs to be a full uri (ex https://www.wepay.com ) and must NOT be localhost or or include wepay.com.


A boolean value (true or false) default is true.


Reference id for this checkout.


Customer-generated unique_id. WePay will only process a single call with a given unique_id. Platforms can use this to prevent duplicates, e.g. when retrying if a call times out. See below for tips on handling errors.


Use this to have payers enter payment information on a WePay hosted checkout URL. Send either hosted_checkout or payment_method parameter. Do not send both parameters at the same time. If neither parameter is specified, default behavior will be hosted_checkout. Full example object at https://stage.wepay.com/developer/reference/structures#hosted_checkout.


Use this to pay using previously acquired payment information, such as a preapproval or a credit card.


Delivery type for checkout. Possible values: none, fully_delivered, point_of_sale, shipping, donation, subscription, partial_prepayment, full_prepayment. Must be in lower case.


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




An unexpected error occurred.



{ checkout_id: 649945633,
  account_id: 1548718026,
  type: 'donation',
  short_description: 'test',
  currency: 'USD',
  amount: 20,
  state: 'new',
  soft_descriptor: 'WPY*Wolverine',
  auto_capture: true,
  create_time: 1439582388,
  delivery_type: 'point_of_sale',
  long_description: 'test',
  callback_uri: 'http://www.test.com',
  reference_id: 'null',
  fee: { app_fee: 1, fee_payer: 'payer', processing_fee: 0 },
  gross: 0,
  chargeback: { amount_charged_back: 0, dispute_uri: 'null' },
  refund: { amount_refunded: 0, refund_reason: 'null' },
   { checkout_uri: 'http://wepay.com/api/iframe/649945633/51e59317/api_checkout?iframe=1',
     redirect_uri: 'http://www.test.com',
     shipping_fee: 2,
     require_shipping: true,
     shipping_address: 'null',
      { theme_id: 96914023,
        name: 'test',
        primary_color: 'ffffff',
        secondary_color: '000000',
        background_color: 'ffffff',
        button_color: '000000' },
     mode: 'iframe' },
  payer: { name: 'null', email: 'null', home_address: 'null' },
  npo_information: { legal_name: 'org name', ein: '343644743' },
  payment_error: 'null' }