Skip to content

Commit acda92b

Browse files
committed
Add success-redirect field to 1.1 spec
1 parent 165594b commit acda92b

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

SPEC1.1.md

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ A standard URL protocol for requesting native SOL transfers, SPL Token transfers
1212

1313
These URLs may be encoded in QR codes or NFC tags, or sent between users and applications to request payment and compose transactions.
1414

15-
Applications should ensure that a transaction has been confirmed and is valid before they release goods or services being sold, or grant access to objects or events.
15+
Applications should ensure that a transaction has been confirmed and is valid before they release goods or services being sold, or grant access to objects or events.
1616

1717
Mobile wallets should register to handle the URL scheme to provide a seamless yet secure experience when Solana Pay URLs are encountered in the environment.
1818

@@ -29,6 +29,7 @@ solana:<recipient>
2929
&label=<label>
3030
&message=<message>
3131
&memo=<memo>
32+
&success-redirect=<success-redirect>
3233
```
3334

3435
The request is non-interactive because the parameters in the URL are used by a wallet to directly compose a transaction.
@@ -78,6 +79,12 @@ The wallet must [URL-decode](https://developer.mozilla.org/en-US/docs/Web/JavaSc
7879

7980
If the field is provided, the wallet must include a `MemoProgram` instruction as the second to last instruction of the transaction, immediately before the SOL or SPL Token transfer instruction, to avoid ambiguity with other instructions in the transaction.
8081

82+
### Success Redirect
83+
84+
A single `success-redirect` field is allowed as an optional query parameter. The value must be a conditionally [URL-encoded](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent) absolute HTTPS or solana URL.
85+
86+
The wallet must [URL-decode](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/decodeURIComponent) the value. If it is a HTTPS URL then the wallet should display the decoded value to the user. If the transaction is completed successfully and it is a HTTPS URL then the wallet should redirect the user to the URL. If the transaction is completed successfully and it is a solana URL then the wallet should treat it as a new Solana Pay request. If the transaction is not completed successfully then the wallet should not use the URL.
87+
8188
### Examples
8289

8390
##### URL describing a transfer request for 1 SOL.
@@ -95,6 +102,11 @@ solana:mvines9iiHiQTysrwkJjGf2gb9Ex9jXJX8ns3qwf2kN?amount=0.01&spl-token=EPjFWdd
95102
solana:mvines9iiHiQTysrwkJjGf2gb9Ex9jXJX8ns3qwf2kN&label=Michael
96103
```
97104

105+
##### URL describing a transfer request for 1 SOL with a success redirect
106+
```
107+
solana:mvines9iiHiQTysrwkJjGf2gb9Ex9jXJX8ns3qwf2kN?amount=1&label=Michael&message=Thanks%20for%20all%20the%20fish&memo=OrderId12345&success-redirect=https://example.com
108+
```
109+
98110
## Specification: Transaction Request
99111

100112
A Solana Pay transaction request URL describes an interactive request for any Solana transaction.
@@ -187,10 +199,20 @@ The `<message>` value must be a UTF-8 string that describes the nature of the tr
187199

188200
For example, this might be the name of an item being purchased, a discount applied to the purchase, or a thank you note. The wallet should display the value to the user.
189201

202+
The application may also include an optional `successRedirect` field in the response body:
203+
204+
```json
205+
{"successRedirect":"<success-redirect>","transaction":"<transaction>"}
206+
```
207+
208+
The `success-redirect` field must be a conditionally [URL-encoded](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent) absolute HTTPS or solana URL.
209+
210+
The wallet must [URL-decode](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/decodeURIComponent) the value. If it is a HTTPS URL then the wallet should display the decoded value to the user. If the transaction is completed successfully and it is a HTTPS URL then the wallet should redirect the user to the URL. If the transaction is completed successfully and it is a solana URL then the wallet should treat it as a new Solana Pay request. If the transaction is not completed successfully then the wallet should not use the URL.
211+
190212
The wallet and application should allow additional fields in the request body and response body, which may be added by future specification.
191213

192214
#### Error Handling
193-
If the application responds with an HTTP [client](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#client_error_responses) or [server](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) error in response to the POST or PUT operations, the wallet must consider the entire transaction request as failed.
215+
If the application responds with an HTTP [client](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#client_error_responses) or [server](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) error in response to the POST or PUT operations, the wallet must consider the entire transaction request as failed.
194216

195217
Client and server errors may optionally be accompanied by a JSON body containing a UTF-8 string `message` field describing the nature of the error:
196218
```json

0 commit comments

Comments
 (0)