api/payments.js
function submitPayment(account, payment, clientResourceID, secret,
    urlBase, options, callback) {

  function formatTransactionResponse(message, meta) {
    if (meta.state === 'validated') {
      var txJSON = message.tx_json;
      txJSON.meta = message.metadata;
      txJSON.validated = message.validated;
      txJSON.ledger_index = txJSON.inLedger = message.ledger_index;
      return formatPaymentHelper(payment.source_account, txJSON);
    }

    return {
      client_resource_id: clientResourceID,
      status_url: urlBase + '/v1/accounts/' + payment.source_account
        + '/payments/' + clientResourceID
    };
  }

  function prepareTransaction(_transaction, remote) {
    validate.client_resource_id(clientResourceID);

    _transaction.lastLedger(Number(options.last_ledger_sequence ||
      (remote.getLedgerSequence() + transactions.DEFAULT_LEDGER_BUFFER)));

    if (Number(options.max_fee) >= 0) {
      _transaction.maxFee(Number(xrpToDrops(options.max_fee)));
    }

    if (Number(options.fixed_fee) >= 0) {
      _transaction.setFixedFee(Number(xrpToDrops(options.fixed_fee)));
    }

    _transaction.clientID(clientResourceID);
    return _transaction;
  }

  var isSubmitMode = options.submit !== false;
  var _options = _.assign({}, options, {
    clientResourceId: clientResourceID,
    blockDuplicates: isSubmitMode,
    saveTransaction: isSubmitMode
  });

  var initialTx = createPaymentTransaction(account, payment);
  var transaction = isSubmitMode ? prepareTransaction(
    initialTx, this.remote) : initialTx;
  var converter = isSubmitMode ? formatTransactionResponse :
    _.partial(TxToRestConverter.parsePaymentFromTx, account);
  transact(transaction, this, secret, _options, converter, callback);
}
function submitPayment(account, payment, clientResourceID, secret,
    urlBase, options, callback) {

  function formatTransactionResponse(message, meta) {
    if (meta.state === 'validated') {
      var txJSON = message.tx_json;
      txJSON.meta = message.metadata;
      txJSON.validated = message.validated;
      txJSON.ledger_index = txJSON.inLedger = message.ledger_index;
      return formatPaymentHelper(payment.source_account, txJSON);
    }

    return {
      client_resource_id: clientResourceID,
      status_url: urlBase + '/v1/accounts/' + payment.source_account
        + '/payments/' + clientResourceID
    };
  }

  function prepareTransaction(_transaction, remote) {
    validate.client_resource_id(clientResourceID);

    _transaction.lastLedger(Number(options.last_ledger_sequence ||
      (remote.getLedgerSequence() + transactions.DEFAULT_LEDGER_BUFFER)));

    if (Number(options.max_fee) >= 0) {
      _transaction.maxFee(Number(xrpToDrops(options.max_fee)));
    }

    if (Number(options.fixed_fee) >= 0) {
      _transaction.setFixedFee(Number(xrpToDrops(options.fixed_fee)));
    }

    _transaction.clientID(clientResourceID);
    return _transaction;
  }

  var isSubmitMode = options.submit !== false;
  var _options = _.assign({}, options, {
    clientResourceId: clientResourceID,
    blockDuplicates: isSubmitMode,
    saveTransaction: isSubmitMode
  });

  var initialTx = createPaymentTransaction(account, payment);
  var transaction = isSubmitMode ? prepareTransaction(
    initialTx, this.remote) : initialTx;
  var converter = isSubmitMode ? formatTransactionResponse :
    _.partial(TxToRestConverter.parsePaymentFromTx, account);
  transact(transaction, this, secret, _options, converter, callback);
}
function submitPayment ( account , payment , clientResourceID , secret , urlBase , options , callback ) { function formatTransactionResponse ( message , meta ) { if ( meta . state === 'validated' ) { var txJSON = message . tx_json ; txJSON . meta = message . metadata ; txJSON . validated = message . validated ; txJSON . ledger_index = txJSON . inLedger = message . ledger_index ; return formatPaymentHelper ( payment . source_account , txJSON ) ; } return { client_resource_id : clientResourceID , status_url : urlBase + '/v1/accounts/' + payment . source_account + '/payments/' + clientResourceID } ; } function prepareTransaction ( _transaction , remote ) { validate . client_resource_id ( clientResourceID ) ; _transaction . lastLedger ( Number ( options . last_ledger_sequence || ( remote . getLedgerSequence ( ) + transactions . DEFAULT_LEDGER_BUFFER ) ) ) ; if ( Number ( options . max_fee ) >= 0 ) { _transaction . maxFee ( Number ( xrpToDrops ( options . max_fee ) ) ) ; } if ( Number ( options . fixed_fee ) >= 0 ) { _transaction . setFixedFee ( Number ( xrpToDrops ( options . fixed_fee ) ) ) ; } _transaction . clientID ( clientResourceID ) ; return _transaction ; } var isSubmitMode = options . submit !== false ; var _options = _ . assign ( { } , options , { clientResourceId : clientResourceID , blockDuplicates : isSubmitMode , saveTransaction : isSubmitMode } ) ; var initialTx = createPaymentTransaction ( account , payment ) ; var transaction = isSubmitMode ? prepareTransaction ( initialTx , this . remote ) : initialTx ; var converter = isSubmitMode ? formatTransactionResponse : _ . partial ( TxToRestConverter . parsePaymentFromTx , account ) ; transact ( transaction , this , secret , _options , converter , callback ) ; }
Submit a payment in the ripple-rest format.

@global
@param {/config/config-loader} config

@body
@param {Payment} request.body.payment
@param {String} request.body.secret
@param {String} request.body.client_resource_id
@param {Number String} req.body.last_ledger_sequence
- last ledger sequence that this payment can end up in
@param {Number String} req.body.max_fee
- maximum fee the payer is willing to pay
@param {Number String} req.body.fixed_fee - fixed fee the payer wants to pay
the network for accepting this transaction

@query
@param {String "true"|"false"} request.query.validated - used to force
request to wait until rippled has finished validating the
submitted transaction
Submit a payment in the ripple - rest format .