Skip to content

Commit 6d6d73d

Browse files
committed
Add partner validation documentation
1 parent 17f03b1 commit 6d6d73d

2 files changed

Lines changed: 58 additions & 4 deletions

File tree

docs/flows/crypto-offramp.mdx

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@ The crypto off-ramp flow allows a user to sell cryptocurrency and convert it int
2323
- `displayName` (_optional_): Partner name to be displayed to the user.
2424
- `fee` (_optional_): An object configuring the partner fee to be charged.
2525
- `percentage`: Percentage of the total source amount (the maximum allowed value is "5").
26+
- `validation` (_optional_): Custom request validation parameters.
27+
- `device`: (_optional_): Device parameters to validate.
28+
- `ip` (_optional_): User IP on partner's side that we should validate remains the same.
29+
- `user-agent` (_optional_): User agent used on partner's side that we should validate remains the same.
30+
- `encrypted` (_optional_): Encrypted parameters to validate.
31+
- `ip` (_optional_): Encrypted user IP on partner's side that we should validate remains the same.
32+
- `user-agent` (_optional_): Encrypted user agent used on partner's side that we should validate remains the same.
2633
- `refund` (_optional_): An object configuring the refund details. The asset and network of the refund will be the same as the source asset and network.
2734
- `address`: Address to which the refund will be sent.
2835
- `tag` (_optional_): Tag of the crypto transaction, used to complement the `address`.
@@ -83,6 +90,12 @@ We recommend that you use `XRP` for testing purposes when integrating Topper sin
8390
"displayName": "ACME",
8491
"fee": {
8592
"percentage": "1"
93+
},
94+
validation: {
95+
device:{
96+
ip:'1.2.3.4',
97+
'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)'
98+
}
8699
}
87100
},
88101
"refund": {
@@ -118,6 +131,20 @@ We recommend that you use `XRP` for testing purposes when integrating Topper sin
118131
</TabItem>
119132
</Tabs>
120133

134+
### Custom partner validation
135+
136+
To increase customer security we support an extra layer of validations that can be customizable by our partners. This layer includes validations from customer's device, like IP and user agent, that we ensure is the same as the one provided by you. In case of any mismatch, the user request to initiate a widget session will fail.
137+
We accept this validation parameters as a plain string or as an encrypted string. If you send us encrypted parameters, we'll fetch the same parameters we receive from the user request, encrypt them and compare if both hashs are equal. For this the encryption secret will need to be shared between Topper and the partner.
138+
If you plan on using encrypted validation, please check the example below to see how you should encrypt your data.
139+
140+
```js
141+
import { createHmac } from 'node:crypto';
142+
143+
await createHmac('sha256', <secretKey>)
144+
.update(<parameter>)
145+
.digest('hex');
146+
```
147+
121148
## Events
122149

123150
Full information about the available events and their associated payloads can be found on the [events page](../events/crypto-offramp.mdx).

docs/flows/crypto-onramp.mdx

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,21 @@ The crypto on-ramp flow allows a user to add funds from a credit or debit card t
1515
<TabItem label="Schema" value="schema" default>
1616

1717
- `partner` (_optional_): Partner object.
18+
- `continueUrl` (_optional_): URL to redirect the user to after the order is placed.
19+
- `continueUrlTarget` (_optional_): In which tab should the `continueUrl` be opened.
1820
- `displayName` (_optional_): Partner name to be displayed to the user.
1921
- `fee` (_optional_): An object configuring the partner fee to be charged.
2022
- `percentage`: Percentage of the total source amount (the maximum allowed value is "5").
21-
- `continueUrl` (_optional_): URL to redirect the user to after the order is placed.
22-
- `continueUrlTarget` (_optional_): In which tab should the `continueUrl` be opened.
2323
- `new-tab`: Open in a new tab.
2424
- `same-tab`: Open in the same tab or iframe (default).
2525
- `parent-tab`: Useful only in an iframe: open in the tab that contains the iframe.
26+
- `validation` (_optional_): Custom request validation parameters.
27+
- `device`: (_optional_): Device parameters to validate.
28+
- `ip` (_optional_): User IP on partner's side that we should validate remains the same.
29+
- `user-agent` (_optional_): User agent used on partner's side that we should validate remains the same.
30+
- `encrypted` (_optional_): Encrypted parameters to validate.
31+
- `ip` (_optional_): Encrypted user IP on partner's side that we should validate remains the same.
32+
- `user-agent` (_optional_): Encrypted user agent used on partner's side that we should validate remains the same.
2633
- `partnerFee` (_deprecated_): Use `partner.fee` instead.
2734
- `simulation` (_optional_): Simulation object.
2835
- `country` (_optional_): Country to use during simulations, in alpha-2 code format; It will be ignored after the user is authenticated and the user's country will be used.
@@ -71,12 +78,18 @@ We recommend that you use `XRP` for testing purposes when integrating Topper sin
7178
"sub": "b9fe022b-f436-49e1-bb89-6f2e8eabf336",
7279
// highlight-start
7380
"partner": {
81+
"continueUrl": "https://example.com",
82+
"continueUrlTarget": "new-tab",
7483
"displayName": "ACME",
7584
"fee": {
7685
"percentage": "1"
7786
},
78-
"continueUrl": "https://example.com",
79-
"continueUrlTarget": "new-tab"
87+
validation: {
88+
device:{
89+
ip:'1.2.3.4',
90+
'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)'
91+
}
92+
}
8093
},
8194
"simulation": {
8295
"country": "US"
@@ -109,6 +122,20 @@ We recommend that you use `XRP` for testing purposes when integrating Topper sin
109122
</TabItem>
110123
</Tabs>
111124

125+
### Custom partner validation
126+
127+
To increase customer security we support an extra layer of validations that can be customizable by our partners. This layer includes validations from customer's device, like IP and user agent, that we ensure is the same as the one provided by you. In case of any mismatch, the user request to initiate a widget session will fail.
128+
We accept this validation parameters as a plain string or as an encrypted string. If you send us encrypted parameters, we'll fetch the same parameters we receive from the user request, encrypt them and compare if both hashs are equal. For this the encryption secret will need to be shared between Topper and the partner.
129+
If you plan on using encrypted validation, please check the example below to see how you should encrypt your data.
130+
131+
```js
132+
import { createHmac } from 'node:crypto';
133+
134+
await createHmac('sha256', <secretKey>)
135+
.update(<parameter>)
136+
.digest('hex');
137+
```
138+
112139
### Recipient edit mode
113140

114141
<Tabs>

0 commit comments

Comments
 (0)