Is there a better way to send a refund on the payment received via transaction_id? Or no other way but to send back a new payment operation back to the sender?


I read the question as

Is there a method where I can provide a txn id and automatically refund the payment I received

The answer is no. You will have to issue a new payment to effect any refunds.

Additionally, a transaction is a sequence of 1 or more operations and may include zero, one or many payment operations. So it is not possible to precisely identify a payment by transaction id.


I assume you mean "transaction id" for "transaction_hash".

For all transactions, you have "transaction hash", "ledger num" and the "asset name". Unfortunately you cannot query the transfer using "asset name" at Horizon, so "transaction hash" should already be the best method available. (Note: For the same ledger, more than 1 transaction can occur, so "ledger num" is not a good choice for tracking.)

Feasible ways that I can think of (via Laboratory):

  1. [Effects] > [Effects for Transaction]


  2. [Operations] > [Operations for Transaction]


  3. [Payments] > [Payments for Transaction]


  4. [Transactions] > [Single Transaction]


In Stellar-core DB, it seems there is no direct data for what your transaction has done.

In Horizon DB, there is a table [history_effects] that you may query with "history_operation_id". But normally you cannot deduce the "history_operation_id" directly, so it seems that "transaction hash" is the most direct for your usage in this case.

Among these choices, IMO #2 gives the best visual output.

    "id": "542613283278849",
    "paging_token": "542613283278849",
    "type": "payment",
    "type_i": 1,
    "created_at": "2018-03-13T10:13:52Z",
    "transaction_hash": "bae8c989688785ede07ffd621820a29651343869090672e49beb58d53947cedf",
    "asset_type": "credit_alphanum12",
    "asset_code": "Ass1to0",
    "amount": "0.9000000"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.