Skip to content

Commit

Permalink
Add offramp funds sent webhook
Browse files Browse the repository at this point in the history
  • Loading branch information
andrerei-nqda committed Oct 28, 2024
1 parent d17d660 commit 3a1ad01
Show file tree
Hide file tree
Showing 2 changed files with 111 additions and 12 deletions.
91 changes: 91 additions & 0 deletions docs/flows/crypto-offramp.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,97 @@ The values for `destination.paymentMethod.type` can be found using our [REST API
</TabItem>
</Tabs>

### `order:crypto-offramp:funds-sent`

Triggered when a user has sent funds for their order.

<Tabs>
<TabItem label="Schema" value="schema" default>

- `id`: UUID of the order.
- `status`: Status of the order (`processing`).
- `createdAt`: Timestamp at which the order was created.
- `updatedAt`: Timestamp at which the order was last updated.
- `origin`: Object containing information about what the user sent.
- `amount`: Amount the user sent.
- `rate`: Rate used to calculate the amount.
- `asset`: Cryptoasset the user sent.
- `network`: Network of the sending asset.
- `destination`: Object containing information about what the user will receive.
- `amount`: Amount the user will receive.
- `rate`: Rate used to calculate the amount.
- `asset`: Currency code in the [ISO 4217](https://www.iso.org/iso-4217-currency-codes.html) format used to receive the funds.
- `paymentMethod`: Object containing information about the payment method used.
- `type`: Type of payment method.
- `fees`: Array containing fees associated with the order.
- `amount`: Amount user was charged for this fee.
- `asset`: Asset used to charge the fee.
- `normalized`: Amount in USD that the user was charged for this fee.
- `type`: Type of fee (`network`, `deposit` or `partner`).
- `widget`: Widget associated with the session.
- `id` UUID of the widget.
- `name`: Name of the widget.
- `flow`: Flow associated with the widget.

:::note
The values for `destination.paymentMethod.type` can be found using our [REST API](../rest-api.md), via the [payment methods endpoint](https://api.topperpay.com/payment-methods/crypto-offramp).
:::

</TabItem>
<TabItem label="Example" value="example">

```js
{
"name": "order:crypto-offramp:funds-sent",
"id": "00a991cf-a870-43af-88b8-43c51532831d",
"bootstrapTokenId": "141bfa06-481e-4684-96eb-cec4ad529616",
"data": {
// highlight-start
"id": "966b8e24-6a65-442a-942e-577f16288789",
"status": "processing",
"createdAt": "2023-06-12T17:21:21.240Z",
"updatedAt": "2023-06-12T17:21:21.240Z",
"origin": {
"amount": "0.047116964221968237",
"rate": "0.00056488387749632223",
"asset": "ETH",
"network": "ethereum"
},
"destination": {
"amount": "100.00",
"rate": "1770.27534301775263314892",
"asset": "USD",
"paymentMethod": {
"type": "credit-card"
}
},
"fees": [
{
"amount": "2.42",
"asset": "USD",
"normalized": "2.42",
"type": "deposit"
},
{
"amount": "1.00",
"asset": "USD",
"normalized": "1.00",
"type": "partner"
}
],
"widget": {
"id": "998544f2-5b01-4062-9394-22827ff5db6c",
"name": "ACME",
"flow": "crypto_offramp"
}
// highlight-end
}
}
```

</TabItem>
</Tabs>

### `order:crypto-offramp:funds-received`

Triggered when a user has sent funds for their order and we have received them.
Expand Down
32 changes: 20 additions & 12 deletions docs/webhooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,26 @@ A webhook request will include the following data:

Full information about the available events and their associated payloads can be found on the associated **Flows** page.

| Flow | Event | Trigger |
| - | - | - |
| [crypto_onramp](./flows/crypto-onramp.mdx) | [`order:crypto-onramp:committed`](./flows/crypto-onramp.mdx#ordercrypto-onrampcommitted) | User placed an order. |
| [crypto_onramp](./flows/crypto-onramp.mdx) | [`order:crypto-onramp:charged`](./flows/crypto-onramp.mdx#ordercrypto-onrampcharged) | User has been charged for their order. |
| [crypto_onramp](./flows/crypto-onramp.mdx) | [`order:crypto-onramp:completed`](./flows/crypto-onramp.mdx#ordercrypto-onrampcompleted) | User's order has completed. |
| [crypto_onramp](./flows/crypto-onramp.mdx) | [`order:crypto-onramp:failed`](./flows/crypto-onramp.mdx#ordercrypto-onrampfailed) | User's order has failed. |
| [crypto_onramp](./flows/crypto-onramp.mdx) | [`order:crypto-onramp:refund:completed`](./flows/crypto-onramp.mdx#ordercrypto-onramprefundcompleted) | User's order has been successfully refunded. |
| [crypto_offramp](./flows/crypto-offramp.mdx) | [`order:crypto-offramp:committed`](./flows/crypto-offramp.mdx#ordercrypto-offrampcommitted) | User placed an order. |
| [crypto_offramp](./flows/crypto-offramp.mdx) | [`order:crypto-offramp:funds-received`](./flows/crypto-offramp.mdx#ordercrypto-offrampfunds-received) | User has sent funds for their order and we have received them. |
| [crypto_offramp](./flows/crypto-offramp.mdx) | [`order:crypto-offramp:completed`](./flows/crypto-offramp.mdx#ordercrypto-offrampcompleted) | User's order has completed. |
| [crypto_offramp](./flows/crypto-offramp.mdx) | [`order:crypto-offramp:failed`](./flows/crypto-offramp.mdx#ordercrypto-offrampfailed) | User's order has failed. |
| [crypto_offramp](./flows/crypto-offramp.mdx) | [`order:crypto-offramp:refund:completed`](./flows/crypto-offramp.mdx#ordercrypto-offramprefundcompleted) | User's order has been successfully refunded. |
### Onramp flow

| Event | Trigger |
| - | - |
| [`order:crypto-onramp:committed`](./flows/crypto-onramp.mdx#ordercrypto-onrampcommitted) | User placed an order. |
| [`order:crypto-onramp:charged`](./flows/crypto-onramp.mdx#ordercrypto-onrampcharged) | User has been charged for their order. |
| [`order:crypto-onramp:completed`](./flows/crypto-onramp.mdx#ordercrypto-onrampcompleted) | User's order has completed. |
| [`order:crypto-onramp:failed`](./flows/crypto-onramp.mdx#ordercrypto-onrampfailed) | User's order has failed. |
| [`order:crypto-onramp:refund:completed`](./flows/crypto-onramp.mdx#ordercrypto-onramprefundcompleted) | User's order has been successfully refunded. |

### Offramp flow

| Event | Trigger |
| - | - |
| [`order:crypto-offramp:committed`](./flows/crypto-offramp.mdx#ordercrypto-offrampcommitted) | User placed an order. |
| [`order:crypto-offramp:funds-sent`](./flows/crypto-offramp.mdx#ordercrypto-offrampfunds-sent) | User has sent funds for their order. |
| [`order:crypto-offramp:funds-received`](./flows/crypto-offramp.mdx#ordercrypto-offrampfunds-received) | User has sent funds for their order and we have received them. |
| [`order:crypto-offramp:completed`](./flows/crypto-offramp.mdx#ordercrypto-offrampcompleted) | User's order has completed. |
| [`order:crypto-offramp:failed`](./flows/crypto-offramp.mdx#ordercrypto-offrampfailed) | User's order has failed. |
| [`order:crypto-offramp:refund:completed`](./flows/crypto-offramp.mdx#ordercrypto-offramprefundcompleted) | User's order has been successfully refunded. |

## Verifying a request

Expand Down

0 comments on commit 3a1ad01

Please sign in to comment.