-
Notifications
You must be signed in to change notification settings - Fork 303
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SEP-24: Withdraw transaction refund handling. #1122
Comments
@JakeUrban @leighmcculloch @CassioMG would love your thoughts here too. |
Plan A: "The wallet will be able to link multiple @lijamie98 Just for clarity, how would the wallet link this refund transaction with other existing withdraw/deposit transactions? |
Yes, we may add a |
I think creating a new transaction record that is visible on the
Instead, I think we should try to update the transaction record schema to include the necessary information on the refund payments made in association with it. What do you think about the following schema change? GET /transaction?id=xxx
{
"id": "xxx",
"kind": "withdrawal",
"amount_in": 110,
...,
status: "completed",
refund: {
"type": "partial",
"total_refunded": "10",
"transaction_ids": [
// for withdraw transactions, these are stellar transaction hashes
// for deposit transactions, these are off-chain identifiers
"b9d0b2292c4e09e8eb22d036171491e87b8d2086bf8b265874c8d182cb9c9020",
"54321ab047a193c6fda1c47f5962cbcca8708d79b87089ababd57532c21c5402"
]
}
} |
Interesting @JakeUrban, I like the non-disruptive approach. Do you see a problem with also including the |
I'd imagine most wallets that don't support this would simply ignore the attribute. But of course this could cause some breakage - which is also true even if we only alter the |
The I actually don't think this will cause any breakage because the |
I can guess there may be transactions other than
|
Adding Plan D in the issue description. |
I like the idea of generalizing related transactions. Another |
@lijamie98 this looks good! In this sample you posted, should the wallet expect a Sep-24 transaction to be found and returned by the Anchor once fetching |
@CassioMG That's a good point. I would vote for a YES. Any concerns? |
I prefer the refund transactions that are explicitly denoted as such, outlined in #1122 (comment). I think that is easier for an integrating developer to understand. It also gives us some freedom since the refund resource can contain refund specific fields, as is demonstrated where the example @JakeUrban shared has a total amount refunded explicitly shown. What type of sub-transactions do we anticipate there being? And would it be clearer to make those their own resources as they are encountered? |
I think the In addition, it will be awkward if we have multiple refunds with different amount. The type of sub-transactions are unknown at this moment. It serves as a placeholder for future types. |
One thing that I think is confusing about the sub-transactions design is that the |
The balance here is between creating something generic and futureproof, and creating something incremental and simple that addresses the concern. I'm not particularly a fan of introducing a new concept of nested sub-transactions, because this creates a new dimension of complexity. What are sub-transactions? What are the criteria to define whether one transaction is related to another? Do sub-transactions have sub-sub-transactions? What is the guidance we'll give to UIs consuming this API? The problem we're trying to solve is around refunds, which is a well-understood problem: there's a So I guess I'm leaning towards @JakeUrban's suggestion from here: #1122 (comment) // Transaction Structure
{
"id": "xxx",
"kind": "withdrawal",
"amount_in": 110,
...,
"status": "completed",
"refund_info": {
"type": "partial",
"total_refunded": "10",
"transaction_ids": [
// for withdraw transactions, these are stellar transaction hashes
// for deposit transactions, these are off-chain identifiers
"b9d0b2292c4e09e8eb22d036171491e87b8d2086bf8b265874c8d182cb9c9020",
"54321ab047a193c6fda1c47f5962cbcca8708d79b87089ababd57532c21c5402"
]
}
} This design doesn't prevent us from creating new |
+1 I think we can also tweak the refunds object a little so that over time we can add more fields if needed, by making the list of {
"id": "xxx",
"kind": "withdrawal",
"amount_in": 110,
...,
"status": "completed",
"refunds": {
"type": "partial",
"amount_refunded": "10",
"transactions": [
{
"id": "b9d0b2292c4e09e8eb22d036171491e87b8d2086bf8b265874c8d182cb9c9020"
},
{
"id": "54321ab047a193c6fda1c47f5962cbcca8708d79b87089ababd57532c21c5402"
}
]
}
} |
Would we be able to hit |
According to @JakeUrban's earlier comment the IDs are Stellar transaction hashes or external off-chain identifiers.
|
So we could have: {
"id": "xxx",
"kind": "withdrawal",
"amount_in": 110,
...,
"status": "completed",
"refunds": {
"type": "partial",
"amount_refunded": "10",
"transactions": [
{
"stellar_id": "b9d0b2292c4e09e8eb22d036171491e87b8d2086bf8b265874c8d182cb9c9020"
},
{
"external_id": "54321ab047a193c6fda1c47f5962cbcca8708d79b87089ababd57532c21c5402"
}
]
}
} So we know there is no pure |
This is exactly what I was about to ask, and the answer is somewhat still unclear to me. I'll try exemplifying for clarification. If I'm understanding correctly in this example that @JakeUrban posted the user completed a withdrawal of amount So, let's say the wallet gets this What should be the expected response here? Should the Anchor return the same Sep-24 transaction object as if the wallet were fetching the original withdrawal transaction? I think it'd be great to get the same transaction object since the wallet could easily iterate over Does that make sense? |
Updated the description by adding Plan E. When I first read about SEP, my felt traces of incremental changes and that sometimes confused me when I read it. That's why I kind of leaning towards a future proof design. But have something that's future proof can be disruptive and may have interest conflict with incremental design. Plan A, Plan D and Plan E represents three different directions. I don't have strong opinions on which one is better because they have pros and cons. @CassioMG I think people are leaning towards plan E. Once we decide on one of the plans, we can deep dive and confirm. I also added some comments. Hopefully that makes sense to you to calculate the final amount. |
I'm leaning towards plan E as well. About how to retrieve the transaction using a refund transaction id, it makes more sense to me if we do one of the following:
The reason I don't like to overload the |
The question I'd like to answer first is how the wallet uses the If the wallet is uncertain about the transaction being internal/external, then we shouldn't overload the query parameters If the wallet is not certain about it being a refund, then we shouldn't go with Thoughts? |
I vote for plan E. The sub-transactions idea is interesting but I'd rather design for the known use case rather than generalize prematurely. I agree with @marcelosalloum that we should not overload the I personally like the Before we choose to standardize something like
The user can then click on transaction B to get the refund info. Are we thinking the wallet will do something like this? Showing the refund transaction as a distinct transaction?
|
This is a good point. Unclear. I think if we can limit the refund transactions to living inside the |
I agree @leighmcculloch, my preference would be to not support fetching transaction records by a refund ID. |
I have this scenario in mind: let's say a stellar wallet app has a History section in which it'd like to display all transactions that happened for this user in the stellar network. In this case the refund transaction would appear like the below since by the end of the day it's a new payment transaction from the Anchor to the user:
In case we can't use the refunded tx id to I have 2 suggestions in which we could split this heavy lifting between Anchor & Wallet: A) - Allow
B) - Allow something like I also like plan E, I think the biggest question is whether Anchors should support directly querying refund transactions or not. I think they should somehow provide that, specially considering a refund could happen in any point in time (like it could happen the day after, the month after, or the year after) so wallets won't be sure in which timeframe they should be looking at considering the scenario I mentioned. How does that sound? |
🤔 I see your point. If you're using the Stellar Network as your source of data (transaction IDs), then you wouldn't be able to quickly look up the SEP-related transaction data from the anchor. This is assuming that you know that the particular transaction ID on the stellar network relates to a specific anchor's SEP service though. I'm not against a |
You are right, the wallet wouldn't need to fetch all transactions from all anchors but instead all transactions related to this specific Anchor which sent this payment.
Sounds good, maybe before going deeper into this we could check with the Anchor how they feel about supporting a |
Sounds like a plan to me. I'll start drafting the PR 👍 |
Thanks @JakeUrban ! |
It seems Plan-E is the clear consensus.
Plan E: Add extra field
refund
What problem does your feature solve?
In the withdraw process, the user may transfer the USDC to the anchor. However, the anchor may need to refund the transaction due to technical or business reasons.
In that scenario, there are two Stellar network transactions but only one SEP-24 transaction. The wallet won't be able to see the "anchor-initiated" refund transactions.
What would you like to see?
The wallet should be able to see both the withdraw transaction and the "reverse" transaction.
The goal of this ticket is to choose one of the three alternatives (others are welcome) to propose a change for the refund process.
What alternatives are there?
There are three plans:
Plan A: Create a new value:
refund
orereverse
of thekind
field.In this plan, a new possible value,
refund
will be added to SEP-24. A new transaction schema will be added.Pros:
withdraw
anddeposit
transactions without overloading the meanings of the existing fields.refund
transactions with the existingwithdraw
ordeposit
transaction.Cons:
refund
kind.The impact may be limited because for existing wallets working with existing anchor, the new
refund
kind has no impact. For wallets working with this new anchor, we can quickly implement.Plan B: Create a separate
deposit
transactionThe anchor can create a separate
deposit
transaction with the same amount of thewithdraw transaction. We may overload the
refunded` field to indicate a refund transaction.or use the
memo
field to indicate if this is a refund.Pros:
Cons:
deposit
transaction not initiated from the wallet.Plan C: Create a separate
deposit
transaction withmemo
The anchor may create a separate
deposit
transaction with amemo
that links to the withdraw transaction.Pros:
Cons:
Plan D: Add extra field in the existing
transaction
schemaAdd an extra field such as
sub_transactions
orrefund_transactions
to the Transaction schema to subsequent transactions related to the original one.Example:
Pros
Cons
Plan E: Add extra field
refund
The text was updated successfully, but these errors were encountered: