code: function formatPaymentHelper(account, txJSON) {
    if (!(txJSON && /^payment$/i.test(txJSON.TransactionType))) {
      throw new InvalidRequestError('Not a payment. The transaction '
        + 'corresponding to the given identifier is not a payment.');
    }
    var metadata = {
      client_resource_id: txJSON.client_resource_id || '',
      hash: txJSON.hash || '',
      ledger: String(!_.isUndefined(txJSON.inLedger) ?
        txJSON.inLedger : txJSON.ledger_index),
      state: txJSON.validated === true ? 'validated' : 'pending'
    };
    var message = {tx_json: txJSON};
    var meta = txJSON.meta;
    var parsed = TxToRestConverter.parsePaymentFromTx(account, message, meta);
    return _.assign({payment: parsed.payment}, metadata);
  }
docs: Formats the local database transaction into ripple-rest Payment format
  
  @param {RippleAddress} account
  @param {Transaction} transaction
  @param {Function} callback
  
  @callback
  @param {Error} error
  @param {RippleRestTransaction} transaction