From 8141c9b7ffa6fa51b3a289af804359efa3e90956 Mon Sep 17 00:00:00 2001 From: Tierri Monteiro Date: Tue, 10 Feb 2026 14:38:47 +0000 Subject: [PATCH] Add webhooks docs for user flow --- docs/browser-events.md | 2 +- docs/customization.md | 2 +- docs/digital-wallets/_category_.json | 2 +- docs/environments.md | 2 +- docs/events/_category_.json | 4 + docs/events/crypto-offramp.mdx | 658 ++++++++++++++++++++++++++ docs/events/crypto-onramp.mdx | 553 ++++++++++++++++++++++ docs/events/user.mdx | 81 ++++ docs/flows/crypto-offramp.mdx | 671 +-------------------------- docs/flows/crypto-onramp.mdx | 562 +--------------------- docs/kyc-sharing.md | 2 +- docs/mobile.md | 2 +- docs/rest-api.md | 2 +- docs/security.md | 2 +- docs/single-sign-on.md | 2 +- docs/web-sdk.md | 2 +- docs/{webhooks.md => webhooks.mdx} | 41 +- 17 files changed, 1332 insertions(+), 1258 deletions(-) create mode 100644 docs/events/_category_.json create mode 100644 docs/events/crypto-offramp.mdx create mode 100644 docs/events/crypto-onramp.mdx create mode 100644 docs/events/user.mdx rename docs/{webhooks.md => webhooks.mdx} (86%) diff --git a/docs/browser-events.md b/docs/browser-events.md index 8ead607..c8517fb 100644 --- a/docs/browser-events.md +++ b/docs/browser-events.md @@ -1,5 +1,5 @@ --- -sidebar_position: 6 +sidebar_position: 7 --- # Browser events diff --git a/docs/customization.md b/docs/customization.md index c256e93..b7ac3dc 100644 --- a/docs/customization.md +++ b/docs/customization.md @@ -1,5 +1,5 @@ --- -sidebar_position: 8 +sidebar_position: 9 --- # Customization diff --git a/docs/digital-wallets/_category_.json b/docs/digital-wallets/_category_.json index d9e9517..7a71900 100644 --- a/docs/digital-wallets/_category_.json +++ b/docs/digital-wallets/_category_.json @@ -1,4 +1,4 @@ { "label": "Digital Wallets", - "position": 9 + "position": 10 } diff --git a/docs/environments.md b/docs/environments.md index 971cf5d..fb4605c 100644 --- a/docs/environments.md +++ b/docs/environments.md @@ -1,5 +1,5 @@ --- -sidebar_position: 4 +sidebar_position: 5 --- # Environments diff --git a/docs/events/_category_.json b/docs/events/_category_.json new file mode 100644 index 0000000..dc2a628 --- /dev/null +++ b/docs/events/_category_.json @@ -0,0 +1,4 @@ +{ + "label": "Events", + "position": 4 +} diff --git a/docs/events/crypto-offramp.mdx b/docs/events/crypto-offramp.mdx new file mode 100644 index 0000000..15456e0 --- /dev/null +++ b/docs/events/crypto-offramp.mdx @@ -0,0 +1,658 @@ +--- +sidebar_position: 2 +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# Crypto off-ramp + +| Event | Trigger | +| - | - | +| [`order:crypto-offramp:committed`](#ordercrypto-offrampcommitted) | User placed an order. | +| [`order:crypto-offramp:funds-sent`](#ordercrypto-offrampfunds-sent) | User has sent funds for their order. | +| [`order:crypto-offramp:funds-received`](#ordercrypto-offrampfunds-received) | User has sent funds for their order and we have received them. | +| [`order:crypto-offramp:completed`](#ordercrypto-offrampcompleted) | User's order has completed. | +| [`order:crypto-offramp:failed`](#ordercrypto-offrampfailed) | User's order has failed. | +| [`order:crypto-offramp:refund:completed`](#ordercrypto-offramprefundcompleted) | User's order has been successfully refunded. | + +## `order:crypto-offramp:committed` + +Triggered when a user has placed an order. + + + + +- `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 will send. + - `amount`: Amount the user will send. + - `rate`: Rate used to calculate the amount. + - `asset`: Cryptoasset the user will send. + - `network`: Network of the sending asset. + - `depositAddress`: Object containing information related to the deposit. + - `expiredAt`: Timestamp at which the deposit expires. + - `remindAt`: Timestamp at which the user is reminded. + - `tag`: Tag of the crypto transaction, used to complement the address. + - `type`: Tag type. + - `value`: Tag value. + - `value`: Address to which the user sends the funds. +- `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). +::: + + + + +```js +{ + "name": "order:crypto-offramp:committed", + "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", + "depositAddress": { + "expiredAt": "2023-06-12T17:21:21.240Z", + "remindAt": "2023-06-12T17:21:21.240Z", + "value": "0xb794F5eA0ba39494cE839613fffBA74279579268" + } + }, + "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 + } +} +``` + + + + +## `order:crypto-offramp:funds-sent` + +Triggered when a user has sent funds for their order. + + + + +- `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. + - `depositAddress`: Object containing information related to the deposit. + - `expiredAt`: Timestamp at which the deposit expires. + - `remindAt`: Timestamp at which the user is reminded. + - `tag`: Tag of the crypto transaction, used to complement the address. + - `type`: Tag type. + - `value`: Tag value. + - `value`: Address to which the user sends the funds. +- `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). +::: + + + + +```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", + "depositAddress": { + "expiredAt": "2023-06-12T17:21:21.240Z", + "remindAt": "2023-06-12T17:21:21.240Z", + "value": "0xb794F5eA0ba39494cE839613fffBA74279579268" + } + }, + "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 + } +} +``` + + + + +## `order:crypto-offramp:funds-received` + +Triggered when a user has sent funds for their order and we have received them. + + + + +- `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. + - `depositAddress`: Object containing information related to the deposit. + - `expiredAt`: Timestamp at which the deposit expires. + - `remindAt`: Timestamp at which the user is reminded. + - `tag`: Tag of the crypto transaction, used to complement the address. + - `type`: Tag type. + - `value`: Tag value. + - `value`: Address to which the user sends the funds. +- `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). +::: + + + + +```js +{ + "name": "order:crypto-offramp:funds-received", + "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", + "depositAddress": { + "expiredAt": "2023-06-12T17:21:21.240Z", + "remindAt": "2023-06-12T17:21:21.240Z", + "value": "0xb794F5eA0ba39494cE839613fffBA74279579268" + } + }, + "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 + } +} +``` + + + + +## `order:crypto-offramp:completed` + +Triggered when a user's order has completed. + + + + +- `id`: UUID of the order. +- `status`: Status of the order (`completed`). +- `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. + - `depositAddress`: Object containing information related to the deposit. + - `expiredAt`: Timestamp at which the deposit expires. + - `remindAt`: Timestamp at which the user is reminded. + - `tag`: Tag of the crypto transaction, used to complement the address. + - `type`: Tag type. + - `value`: Tag value. + - `value`: Address to which the user sends the funds. +- `destination`: Object containing information about what the user received. + - `amount`: Amount the user received. + - `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). +::: + + + + +```js +{ + "name": "order:crypto-offramp:completed", + "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", + "depositAddress": { + "expiredAt": "2023-06-12T17:21:21.240Z", + "remindAt": "2023-06-12T17:21:21.240Z", + "value": "0xb794F5eA0ba39494cE839613fffBA74279579268" + } + }, + "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 + } +} +``` + + + + +## `order:crypto-offramp:failed` + +Triggered when a user's order has failed. + + + + +- `id`: UUID of the order. +- `status`: Status of the order (`failed`). +- `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. + - `depositAddress`: Object containing information related to the deposit. + - `expiredAt`: Timestamp at which the deposit expires. + - `remindAt`: Timestamp at which the user is reminded. + - `tag`: Tag of the crypto transaction, used to complement the address. + - `type`: Tag type. + - `value`: Tag value. + - `value`: Address to which the user sends the funds. +- `destination`: Object containing information about what the user would have received. + - `amount`: Amount the user would have received. + - `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. +- `error`: Indicates specific error information. + - `reason`: Indicates the reason for the error, possible values are `fraud`. + +:::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). +::: + + + + +```js +{ + "name": "order:crypto-offramp:failed", + "id": "00a991cf-a870-43af-88b8-43c51532831d", + "bootstrapTokenId": "141bfa06-481e-4684-96eb-cec4ad529616", + "data": { + // highlight-start + "id": "966b8e24-6a65-442a-942e-577f16288789", + "status": "failed", + "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", + "depositAddress": { + "expiredAt": "2023-06-12T17:21:21.240Z", + "remindAt": "2023-06-12T17:21:21.240Z", + "value": "0xb794F5eA0ba39494cE839613fffBA74279579268" + } + }, + "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" + }, + "error": { + "reason": "fraud" + } + // highlight-end + } +} +``` + + + + +## `order:crypto-offramp:refund:completed` + +Triggered when a user's order has been successfully refunded. + + + + +- `id`: UUID of the order. +- `status`: Status of the order (`failed`). +- `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. + - `depositAddress`: Object containing information related to the deposit. + - `expiredAt`: Timestamp at which the deposit expires. + - `remindAt`: Timestamp at which the user is reminded. + - `tag`: Tag of the crypto transaction, used to complement the address. + - `type`: Tag type. + - `value`: Tag value. + - `value`: Address to which the user sends the funds. +- `destination`: Object containing information about what the user would have received. + - `amount`: Amount the user would have received. + - `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`). +- `refund`: Object containing information about how much was refunded to the user. + - `amount`: Amount the user received. + - `rate`: Rate used to calculate the amount. + - `asset`: Cryptoasset the user received. + - `network`: Network of the receiving asset. + - `address`: User's wallet address to receive funds. + - `priority`: Priority of the crypto transaction. + - `tag`: Tag of the crypto transaction, used to complement the address. + - `type`: Tag type (e.g.: `memo` or `destination-tag`). + - `value`: Tag value. +- `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). +::: + + + + +```js +{ + "name": "order:crypto-offramp:refund:completed", + "id": "00a991cf-a870-43af-88b8-43c51532831d", + "bootstrapTokenId": "141bfa06-481e-4684-96eb-cec4ad529616", + "data": { + // highlight-start + "id": "966b8e24-6a65-442a-942e-577f16288789", + "status": "failed", + "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", + "depositAddress": { + "expiredAt": "2023-06-12T17:21:21.240Z", + "remindAt": "2023-06-12T17:21:21.240Z", + "value": "0xb794F5eA0ba39494cE839613fffBA74279579268" + } + }, + "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" + } + ], + "refund": { + "amount": "0.047116964221968237", + "rate": "0.00056488387749632223", + "asset": "ETH", + "network": "ethereum", + "address": "0xb794F5eA0ba39494cE839613fffBA74279579268", + "priority": "normal" + }, + "widget": { + "id": "998544f2-5b01-4062-9394-22827ff5db6c", + "name": "ACME", + "flow": "crypto_offramp" + } + // highlight-end + } +} +``` + + + diff --git a/docs/events/crypto-onramp.mdx b/docs/events/crypto-onramp.mdx new file mode 100644 index 0000000..90add1d --- /dev/null +++ b/docs/events/crypto-onramp.mdx @@ -0,0 +1,553 @@ +--- +sidebar_position: 1 +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# Crypto on-ramp + +| Event | Trigger | +| - | - | +| [`order:crypto-onramp:committed`](#ordercrypto-onrampcommitted) | User placed an order. | +| [`order:crypto-onramp:charged`](#ordercrypto-onrampcharged) | User has been charged for their order. | +| [`order:crypto-onramp:completed`](#ordercrypto-onrampcompleted) | User's order has completed. | +| [`order:crypto-onramp:failed`](#ordercrypto-onrampfailed) | User's order has failed. | +| [`order:crypto-onramp:refund:completed`](#ordercrypto-onramprefundcompleted) | User's order has been successfully refunded. | + +## `order:crypto-onramp:committed` + +Triggered when a user has placed an order. + + + + +- `id`: UUID of the order. +- `status`: Status of the order (`pending`). +- `createdAt`: Timestamp at which the order was created. +- `updatedAt`: Timestamp at which the order was last updated. +- `origin`: Object containing information about how the user paid. + - `amount`: Amount the user will pay. + - `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 make the payment. + - `paymentMethod`: Object containing information about the payment method used. + - `type`: Type of payment method. +- `destination`: Object containing information about what the user will receive. + - `amount`: Amount the user will receive. + - `rate`: Rate used to calculate the amount. + - `asset`: Cryptoasset the user will receive. + - `network`: Network of the receiving asset. + - `address`: Recipient wallet address. + - `tag` (_optional_): Tag of the crypto transaction, used to complement the `address`. + - `type`: Tag type (e.g.: `memo` or `destination-tag`). + - `value`: Tag value. + - `priority` (_optional_): Priority of the crypto transaction. +- `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 `origin.paymentMethod.type` can be found using our [REST API](../rest-api.md), via the [payment methods endpoint](https://api.topperpay.com/payment-methods/crypto-onramp). +::: + + + + +```js +{ + "name": "order:crypto-onramp:committed", + "id": "00a991cf-a870-43af-88b8-43c51532831d", + "bootstrapTokenId": "141bfa06-481e-4684-96eb-cec4ad529616", + "data": { + // highlight-start + "id": "966b8e24-6a65-442a-942e-577f16288789", + "status": "pending", + "createdAt": "2023-06-12T17:21:21.240Z", + "updatedAt": "2023-06-12T17:21:21.240Z", + "origin": { + "amount": "100.00", + "rate": "1770.27534301775263314892", + "asset": "USD", + "paymentMethod": { + "type": "credit-card" + } + }, + "destination": { + "amount": "0.047116964221968237", + "rate": "0.00056488387749632223", + "asset": "ETH", + "network": "ethereum", + "address": "0xb794F5eA0ba39494cE839613fffBA74279579268" + }, + "fees": [ + { + "amount": "14.17", + "asset": "USD", + "normalized": "14.17", + "type": "network" + }, + { + "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_onramp" + } + // highlight-end + } +} +``` + + + + +## `order:crypto-onramp:charged` + +Triggered when a user has been charged. + + + + +- `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 how the user paid. + - `amount`: Amount the user paid. + - `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 make the payment. + - `paymentMethod`: Object containing information about the payment method used. + - `type`: Type of payment method. +- `destination`: Object containing information about what the user will receive. + - `amount`: Amount the user will receive. + - `rate`: Rate used to calculate the amount. + - `asset`: Cryptoasset the user will receive. + - `network`: Network of the receiving asset. + - `address`: Recipient wallet address. + - `tag` (_optional_): Tag of the crypto transaction, used to complement the `address`. + - `type`: Tag type (e.g.: `memo` or `destination-tag`). + - `value`: Tag value. + - `priority` (_optional_): Priority of the crypto transaction. +- `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 `origin.paymentMethod.type` can be found using our [REST API](../rest-api.md), via the [payment methods endpoint](https://api.topperpay.com/payment-methods/crypto-onramp). +::: + + + + +```js +{ + "name": "order:crypto-onramp:charged", + "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": "100.00", + "rate": "1770.27534301775263314892", + "asset": "USD", + "paymentMethod": { + "type": "credit-card" + } + }, + "destination": { + "amount": "0.047116964221968237", + "rate": "0.00056488387749632223", + "asset": "ETH", + "network": "ethereum", + "address": "0xb794F5eA0ba39494cE839613fffBA74279579268" + }, + "fees": [ + { + "amount": "14.17", + "asset": "USD", + "normalized": "14.17", + "type": "network" + }, + { + "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_onramp" + } + // highlight-end + } +} +``` + + + + +## `order:crypto-onramp:completed` + +Triggered when a user's order has completed. + + + + +- `id`: UUID of the order. +- `status`: Status of the order (`completed`). +- `createdAt`: Timestamp at which the order was created. +- `updatedAt`: Timestamp at which the order was last updated. +- `origin`: Object containing information about how the user paid. + - `amount`: Amount the user paid. + - `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 make the payment. + - `paymentMethod`: Object containing information about the payment method used. + - `type`: Type of payment method. +- `destination`: Object containing information about what the user received. + - `amount`: Amount the user received. + - `rate`: Rate used to calculate the amount. + - `asset`: Cryptoasset the user received. + - `blockchainUrl` (_deprecated_): URL to view the transaction details on a blockchain explorer. + - `network`: Network of the receiving asset. + - `address`: Recipient wallet address. + - `tag` (_optional_): Tag of the crypto transaction, used to complement the `address`. + - `type`: Tag type (e.g.: `memo` or `destination-tag`). + - `value`: Tag value. + - `priority` (_optional_): Priority of the crypto transaction. + - `ledger` (_optional_): Object containing information about the transaction on the ledger. + - `txid`: Transaction ID on the ledger. + - `url`: URL to view the transaction details on a blockchain explorer. +- `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 `origin.paymentMethod.type` can be found using our [REST API](../rest-api.md), via the [payment methods endpoint](https://api.topperpay.com/payment-methods/crypto-onramp). +::: + + + + +```js +{ + "name": "order:crypto-onramp:completed", + "id": "00a991cf-a870-43af-88b8-43c51532831d", + "bootstrapTokenId": "141bfa06-481e-4684-96eb-cec4ad529616", + "data": { + // highlight-start + "id": "966b8e24-6a65-442a-942e-577f16288789", + "status": "completed", + "createdAt": "2023-06-12T17:21:21.240Z", + "updatedAt": "2023-06-12T17:21:21.240Z", + "origin": { + "amount": "100.00", + "rate": "1770.27534301775263314892", + "asset": "USD", + "paymentMethod": { + "type": "credit-card" + } + }, + "destination": { + "amount": "0.047116964221968237", + "rate": "0.00056488387749632223", + "asset": "ETH", + "ledger": { + "txid": "0xdfa1ea4ddb841af466a5ca78c6e1f0edfaef5e54e79a28238d2a5bb2da4f1911", + "url": "https://etherscan.io/tx/0xdfa1ea4ddb841af466a5ca78c6e1f0edfaef5e54e79a28238d2a5bb2da4f1911" + }, + "network": "ethereum", + "address": "0xb794F5eA0ba39494cE839613fffBA74279579268" + }, + "fees": [ + { + "amount": "14.17", + "asset": "USD", + "normalized": "14.17", + "type": "network" + }, + { + "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_onramp" + } + // highlight-end + } +} +``` + + + + +## `order:crypto-onramp:failed` + +Triggered when a user's order has failed. + + + + +- `id`: UUID of the order. +- `status`: Status of the order (`failed`). +- `createdAt`: Timestamp at which the order was created. +- `updatedAt`: Timestamp at which the order was last updated. +- `origin`: Object containing information about how the user paid. + - `amount`: Amount the user paid. + - `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 make the payment. + - `paymentMethod`: Object containing information about the payment method used. + - `type`: Type of payment method. +- `destination`: Object containing information about what the user would have received. + - `amount`: Amount the user would have received. + - `rate`: Rate used to calculate the amount. + - `asset`: Cryptoasset the user would have received. + - `network`: Network of the receiving asset. + - `address`: Recipient wallet address. + - `tag` (_optional_): Tag of the crypto transaction, used to complement the `address`. + - `type`: Tag type (e.g.: `memo` or `destination-tag`). + - `value`: Tag value. + - `priority` (_optional_): Priority of the crypto transaction. +- `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. +- `error`: Indicates specific error information. + - `reason`: Indicates the reason for the error, possible values are `fraud`. + +:::note +The values for `origin.paymentMethod.type` can be found using our [REST API](../rest-api.md), via the [payment methods endpoint](https://api.topperpay.com/payment-methods/crypto-onramp). +::: + + + + +```js +{ + "name": "order:crypto-onramp:failed", + "id": "00a991cf-a870-43af-88b8-43c51532831d", + "bootstrapTokenId": "141bfa06-481e-4684-96eb-cec4ad529616", + "data": { + // highlight-start + "id": "966b8e24-6a65-442a-942e-577f16288789", + "status": "failed", + "createdAt": "2023-06-12T17:21:21.240Z", + "updatedAt": "2023-06-12T17:21:21.240Z", + "origin": { + "amount": "100.00", + "rate": "1770.27534301775263314892", + "asset": "USD", + "paymentMethod": { + "type": "credit-card" + } + }, + "destination": { + "amount": "0.047116964221968237", + "rate": "0.00056488387749632223", + "asset": "ETH", + "network": "ethereum", + "address": "0xb794F5eA0ba39494cE839613fffBA74279579268" + }, + "fees": [ + { + "amount": "14.17", + "asset": "USD", + "normalized": "14.17", + "type": "network" + }, + { + "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_onramp" + }, + "error": { + "reason": "fraud" + } + // highlight-end + } +} +``` + + + + +## `order:crypto-onramp:refund:completed` + +Triggered when a user's order has been successfully refunded. + + + + +- `id`: UUID of the order. +- `status`: Status of the order (`refunded`). +- `createdAt`: Timestamp at which the order was created. +- `updatedAt`: Timestamp at which the order was last updated. +- `origin`: Object containing information about how the user paid. + - `amount`: Amount the user paid. + - `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 make the payment. + - `paymentMethod`: Object containing information about the payment method used. + - `type`: Type of payment method. +- `destination`: Object containing information about what the user would have received. + - `amount`: Amount the user would have received. + - `rate`: Rate used to calculate the amount. + - `asset`: Cryptoasset the user would have received. + - `network`: Network of the receiving asset. + - `address`: Recipient wallet address. + - `tag` (_optional_): Tag of the crypto transaction, used to complement the `address`. + - `type`: Tag type (e.g.: `memo` or `destination-tag`). + - `value`: Tag value. + - `priority` (_optional_): Priority of the crypto transaction. +- `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`). +- `refund`: Object containing information about how much was refunded to the user. + - `formattedAmount`: Amount refunded to the user + - `asset`: Currency code in the [ISO 4217](https://www.iso.org/iso-4217-currency-codes.html) format used to make the payment. + - `rate`: Rate used to calculate the amount. +- `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 `origin.paymentMethod.type` can be found using our [REST API](../rest-api.md), via the [payment methods endpoint](https://api.topperpay.com/payment-methods/crypto-onramp). +::: + + + + +```js +{ + "name": "order:crypto-onramp:refund:completed", + "id": "00a991cf-a870-43af-88b8-43c51532831d", + "bootstrapTokenId": "141bfa06-481e-4684-96eb-cec4ad529616", + "data": { + // highlight-start + "id": "966b8e24-6a65-442a-942e-577f16288789", + "status": "refunded", + "createdAt": "2023-06-12T17:21:21.240Z", + "updatedAt": "2023-06-12T17:21:21.240Z", + "origin": { + "amount": "100.00", + "rate": "1770.27534301775263314892", + "asset": "USD", + "paymentMethod": { + "type": "credit-card" + } + }, + "destination": { + "amount": "0.047116964221968237", + "rate": "0.00056488387749632223", + "asset": "ETH", + "network": "ethereum", + "address": "0xb794F5eA0ba39494cE839613fffBA74279579268" + }, + "fees": [ + { + "amount": "14.17", + "asset": "USD", + "normalized": "14.17", + "type": "network" + }, + { + "amount": "2.42", + "asset": "USD", + "normalized": "2.42", + "type": "deposit" + }, + { + "amount": "1.00", + "asset": "USD", + "normalized": "1.00", + "type": "partner" + } + ], + "refund": { + "asset": "USD", + "formattedAmount": "$ 100.00", + "rate": "1770.27534301775263314892" + }, + "widget": { + "id": "998544f2-5b01-4062-9394-22827ff5db6c", + "name": "ACME", + "flow": "crypto_onramp" + } + // highlight-end + } +} +``` + + + diff --git a/docs/events/user.mdx b/docs/events/user.mdx new file mode 100644 index 0000000..37bcb0c --- /dev/null +++ b/docs/events/user.mdx @@ -0,0 +1,81 @@ +--- +sidebar_position: 3 +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# User + +| Event | Trigger | +| - | - | +| [`user:created`](#usercreated) | User created a new account. | +| [`user:logged-in`](#userlogged-in) | User logged in. | + +## `user:created` + +Triggered when a new user is created. + + + + +- `user`: User object. + - `id`: UUID of the user. + - `createdAt`: Timestamp at which the user was created. + + + + +```js +{ + "name": "user:created", + "id": "00a991cf-a870-43af-88b8-43c51532831d", + "bootstrapTokenId": "141bfa06-481e-4684-96eb-cec4ad529616", + "data": { + // highlight-start + "user": { + "id": "b9fe022b-f436-49e1-bb89-6f2e8eabf336", + "createdAt": "2023-06-12T17:21:21.240Z" + } + // highlight-end + } +} +``` + + + + +## `user:logged-in` + +Triggered when a user logs in. + + + + +- `authenticationMethod`: Authentication method used (`otp` or `sso`). +- `user`: User object. + - `id`: UUID of the user. + - `confirmedAt`: Timestamp at which the user was confirmed. + + + + +```js +{ + "name": "user:logged-in", + "id": "00a991cf-a870-43af-88b8-43c51532831d", + "bootstrapTokenId": "141bfa06-481e-4684-96eb-cec4ad529616", + "data": { + // highlight-start + "authenticationMethod": "otp", + "user": { + "id": "b9fe022b-f436-49e1-bb89-6f2e8eabf336", + "confirmedAt": "2023-06-12T17:21:21.240Z" + } + // highlight-end + } +} +``` + + + diff --git a/docs/flows/crypto-offramp.mdx b/docs/flows/crypto-offramp.mdx index f9beb26..8f44851 100644 --- a/docs/flows/crypto-offramp.mdx +++ b/docs/flows/crypto-offramp.mdx @@ -120,673 +120,4 @@ We recommend that you use `XRP` for testing purposes when integrating Topper sin ## Events -### `order:crypto-offramp:committed` - -Triggered when a user has placed an order. - - - - -- `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 will send. - - `amount`: Amount the user will send. - - `rate`: Rate used to calculate the amount. - - `asset`: Cryptoasset the user will send. - - `network`: Network of the sending asset. - - `depositAddress`: Object containing information related to the deposit. - - `expiredAt`: Timestamp at which the deposit expires. - - `remindAt`: Timestamp at which the user is reminded. - - `tag`: Tag of the crypto transaction, used to complement the address. - - `type`: Tag type. - - `value`: Tag value. - - `value`: Address to which the user sends the funds. -- `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`). -- `user`: An object containing user related information. - - `country`: country of the user. -- `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). -::: - - - - -```js -{ - "name": "order:crypto-offramp:committed", - "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", - "depositAddress": { - "expiredAt": "2023-06-12T17:21:21.240Z", - "remindAt": "2023-06-12T17:21:21.240Z", - "value": "0xb794F5eA0ba39494cE839613fffBA74279579268" - } - }, - "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" - } - ], - "user": { - "country": "US" - }, - "widget": { - "id": "998544f2-5b01-4062-9394-22827ff5db6c", - "name": "ACME", - "flow": "crypto_offramp" - } - // highlight-end - } -} -``` - - - - -### `order:crypto-offramp:funds-sent` - -Triggered when a user has sent funds for their order. - - - - -- `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. - - `depositAddress`: Object containing information related to the deposit. - - `expiredAt`: Timestamp at which the deposit expires. - - `remindAt`: Timestamp at which the user is reminded. - - `tag`: Tag of the crypto transaction, used to complement the address. - - `type`: Tag type. - - `value`: Tag value. - - `value`: Address to which the user sends the funds. -- `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`). -- `user`: An object containing user related information. - - `country`: country of the user. -- `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). -::: - - - - -```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", - "depositAddress": { - "expiredAt": "2023-06-12T17:21:21.240Z", - "remindAt": "2023-06-12T17:21:21.240Z", - "value": "0xb794F5eA0ba39494cE839613fffBA74279579268" - } - }, - "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" - } - ], - "user": { - "country": "US" - }, - "widget": { - "id": "998544f2-5b01-4062-9394-22827ff5db6c", - "name": "ACME", - "flow": "crypto_offramp" - } - // highlight-end - } -} -``` - - - - -### `order:crypto-offramp:funds-received` - -Triggered when a user has sent funds for their order and we have received them. - - - - -- `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. - - `depositAddress`: Object containing information related to the deposit. - - `expiredAt`: Timestamp at which the deposit expires. - - `remindAt`: Timestamp at which the user is reminded. - - `tag`: Tag of the crypto transaction, used to complement the address. - - `type`: Tag type. - - `value`: Tag value. - - `value`: Address to which the user sends the funds. -- `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`). -- `user`: An object containing user related information. - - `country`: country of the user. -- `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). -::: - - - - -```js -{ - "name": "order:crypto-offramp:funds-received", - "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", - "depositAddress": { - "expiredAt": "2023-06-12T17:21:21.240Z", - "remindAt": "2023-06-12T17:21:21.240Z", - "value": "0xb794F5eA0ba39494cE839613fffBA74279579268" - } - }, - "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" - } - ], - "user": { - "country": "US" - }, - "widget": { - "id": "998544f2-5b01-4062-9394-22827ff5db6c", - "name": "ACME", - "flow": "crypto_offramp" - } - // highlight-end - } -} -``` - - - - -### `order:crypto-offramp:completed` - -Triggered when a user's order has completed. - - - - -- `id`: UUID of the order. -- `status`: Status of the order (`completed`). -- `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. - - `depositAddress`: Object containing information related to the deposit. - - `expiredAt`: Timestamp at which the deposit expires. - - `remindAt`: Timestamp at which the user is reminded. - - `tag`: Tag of the crypto transaction, used to complement the address. - - `type`: Tag type. - - `value`: Tag value. - - `value`: Address to which the user sends the funds. -- `destination`: Object containing information about what the user received. - - `amount`: Amount the user received. - - `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`). -- `user`: An object containing user related information. - - `country`: country of the user. -- `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). -::: - - - - -```js -{ - "name": "order:crypto-offramp:completed", - "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", - "depositAddress": { - "expiredAt": "2023-06-12T17:21:21.240Z", - "remindAt": "2023-06-12T17:21:21.240Z", - "value": "0xb794F5eA0ba39494cE839613fffBA74279579268" - } - }, - "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" - } - ], - "user": { - "country": "US" - }, - "widget": { - "id": "998544f2-5b01-4062-9394-22827ff5db6c", - "name": "ACME", - "flow": "crypto_offramp" - } - // highlight-end - } -} -``` - - - - -### `order:crypto-offramp:failed` - -Triggered when a user's order has failed. - - - - -- `id`: UUID of the order. -- `status`: Status of the order (`failed`). -- `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. - - `depositAddress`: Object containing information related to the deposit. - - `expiredAt`: Timestamp at which the deposit expires. - - `remindAt`: Timestamp at which the user is reminded. - - `tag`: Tag of the crypto transaction, used to complement the address. - - `type`: Tag type. - - `value`: Tag value. - - `value`: Address to which the user sends the funds. -- `destination`: Object containing information about what the user would have received. - - `amount`: Amount the user would have received. - - `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`). -- `user`: An object containing user related information. - - `country`: country of the user. -- `widget`: Widget associated with the session. - - `id` UUID of the widget. - - `name`: Name of the widget. - - `flow`: Flow associated with the widget. -- `error`: Indicates specific error information. - - `reason`: Indicates the reason for the error, possible values are `fraud`. - -:::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). -::: - - - - -```js -{ - "name": "order:crypto-offramp:failed", - "id": "00a991cf-a870-43af-88b8-43c51532831d", - "bootstrapTokenId": "141bfa06-481e-4684-96eb-cec4ad529616", - "data": { - // highlight-start - "id": "966b8e24-6a65-442a-942e-577f16288789", - "status": "failed", - "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", - "depositAddress": { - "expiredAt": "2023-06-12T17:21:21.240Z", - "remindAt": "2023-06-12T17:21:21.240Z", - "value": "0xb794F5eA0ba39494cE839613fffBA74279579268" - } - }, - "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" - } - ], - "user": { - "country": "US" - }, - "widget": { - "id": "998544f2-5b01-4062-9394-22827ff5db6c", - "name": "ACME", - "flow": "crypto_offramp" - }, - "error": { - "reason": "fraud" - } - // highlight-end - } -} -``` - - - - -### `order:crypto-offramp:refund:completed` - -Triggered when a user's order has been successfully refunded. - - - - -- `id`: UUID of the order. -- `status`: Status of the order (`failed`). -- `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. - - `depositAddress`: Object containing information related to the deposit. - - `expiredAt`: Timestamp at which the deposit expires. - - `remindAt`: Timestamp at which the user is reminded. - - `tag`: Tag of the crypto transaction, used to complement the address. - - `type`: Tag type. - - `value`: Tag value. - - `value`: Address to which the user sends the funds. -- `destination`: Object containing information about what the user would have received. - - `amount`: Amount the user would have received. - - `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`). -- `refund`: Object containing information about how much was refunded to the user. - - `amount`: Amount the user received. - - `rate`: Rate used to calculate the amount. - - `asset`: Cryptoasset the user received. - - `network`: Network of the receiving asset. - - `address`: User's wallet address to receive funds. - - `priority`: Priority of the crypto transaction. - - `tag`: Tag of the crypto transaction, used to complement the address. - - `type`: Tag type (e.g.: `memo` or `destination-tag`). - - `value`: Tag value. -- `user`: An object containing user related information. - - `country`: country of the user. -- `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). -::: - - - - -```js -{ - "name": "order:crypto-offramp:refund:completed", - "id": "00a991cf-a870-43af-88b8-43c51532831d", - "bootstrapTokenId": "141bfa06-481e-4684-96eb-cec4ad529616", - "data": { - // highlight-start - "id": "966b8e24-6a65-442a-942e-577f16288789", - "status": "failed", - "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", - "depositAddress": { - "expiredAt": "2023-06-12T17:21:21.240Z", - "remindAt": "2023-06-12T17:21:21.240Z", - "value": "0xb794F5eA0ba39494cE839613fffBA74279579268" - } - }, - "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" - } - ], - "refund": { - "amount": "0.047116964221968237", - "rate": "0.00056488387749632223", - "asset": "ETH", - "network": "ethereum", - "address": "0xb794F5eA0ba39494cE839613fffBA74279579268", - "priority": "normal" - }, - "user": { - "country": "US" - }, - "widget": { - "id": "998544f2-5b01-4062-9394-22827ff5db6c", - "name": "ACME", - "flow": "crypto_offramp" - } - // highlight-end - } -} -``` - - - +Full information about the available events and their associated payloads can be found on the [events page](../events/crypto-offramp.mdx). diff --git a/docs/flows/crypto-onramp.mdx b/docs/flows/crypto-onramp.mdx index 4e13187..9812dbe 100644 --- a/docs/flows/crypto-onramp.mdx +++ b/docs/flows/crypto-onramp.mdx @@ -200,564 +200,4 @@ When `recipientEditMode` is `only-asset-same-network`, the user can't change `ne ## Events -### `order:crypto-onramp:committed` - -Triggered when a user has placed an order. - - - - -- `id`: UUID of the order. -- `status`: Status of the order (`pending`). -- `createdAt`: Timestamp at which the order was created. -- `updatedAt`: Timestamp at which the order was last updated. -- `origin`: Object containing information about how the user paid. - - `amount`: Amount the user will pay. - - `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 make the payment. - - `paymentMethod`: Object containing information about the payment method used. - - `type`: Type of payment method. -- `destination`: Object containing information about what the user will receive. - - `amount`: Amount the user will receive. - - `rate`: Rate used to calculate the amount. - - `asset`: Cryptoasset the user will receive. - - `network`: Network of the receiving asset. - - `address`: Recipient wallet address. - - `tag` (_optional_): Tag of the crypto transaction, used to complement the `address`. - - `type`: Tag type (e.g.: `memo` or `destination-tag`). - - `value`: Tag value. - - `priority` (_optional_): Priority of the crypto transaction. -- `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`). -- `user`: An object containing user related information. - - `country`: country of the user. -- `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 `origin.paymentMethod.type` can be found using our [REST API](../rest-api.md), via the [payment methods endpoint](https://api.topperpay.com/payment-methods/crypto-onramp). -::: - - - - -```js -{ - "name": "order:crypto-onramp:committed", - "id": "00a991cf-a870-43af-88b8-43c51532831d", - "bootstrapTokenId": "141bfa06-481e-4684-96eb-cec4ad529616", - "data": { - // highlight-start - "id": "966b8e24-6a65-442a-942e-577f16288789", - "status": "pending", - "createdAt": "2023-06-12T17:21:21.240Z", - "updatedAt": "2023-06-12T17:21:21.240Z", - "origin": { - "amount": "100.00", - "rate": "1770.27534301775263314892", - "asset": "USD", - "paymentMethod": { - "type": "credit-card" - } - }, - "destination": { - "amount": "0.047116964221968237", - "rate": "0.00056488387749632223", - "asset": "ETH", - "network": "ethereum", - "address": "0xb794F5eA0ba39494cE839613fffBA74279579268" - }, - "fees": [ - { - "amount": "14.17", - "asset": "USD", - "normalized": "14.17", - "type": "network" - }, - { - "amount": "2.42", - "asset": "USD", - "normalized": "2.42", - "type": "deposit" - }, - { - "amount": "1.00", - "asset": "USD", - "normalized": "1.00", - "type": "partner" - } - ], - "user": { - "country": "US" - }, - "widget": { - "id": "998544f2-5b01-4062-9394-22827ff5db6c", - "name": "ACME", - "flow": "crypto_onramp" - } - // highlight-end - } -} -``` - - - - -### `order:crypto-onramp:charged` - -Triggered when a user has been charged. - - - - -- `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 how the user paid. - - `amount`: Amount the user paid. - - `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 make the payment. - - `paymentMethod`: Object containing information about the payment method used. - - `type`: Type of payment method. -- `destination`: Object containing information about what the user will receive. - - `amount`: Amount the user will receive. - - `rate`: Rate used to calculate the amount. - - `asset`: Cryptoasset the user will receive. - - `network`: Network of the receiving asset. - - `address`: Recipient wallet address. - - `tag` (_optional_): Tag of the crypto transaction, used to complement the `address`. - - `type`: Tag type (e.g.: `memo` or `destination-tag`). - - `value`: Tag value. - - `priority` (_optional_): Priority of the crypto transaction. -- `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`). -- `user`: An object containing user related information. - - `country`: country of the user. -- `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 `origin.paymentMethod.type` can be found using our [REST API](../rest-api.md), via the [payment methods endpoint](https://api.topperpay.com/payment-methods/crypto-onramp). -::: - - - - -```js -{ - "name": "order:crypto-onramp:charged", - "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": "100.00", - "rate": "1770.27534301775263314892", - "asset": "USD", - "paymentMethod": { - "type": "credit-card" - } - }, - "destination": { - "amount": "0.047116964221968237", - "rate": "0.00056488387749632223", - "asset": "ETH", - "network": "ethereum", - "address": "0xb794F5eA0ba39494cE839613fffBA74279579268" - }, - "fees": [ - { - "amount": "14.17", - "asset": "USD", - "normalized": "14.17", - "type": "network" - }, - { - "amount": "2.42", - "asset": "USD", - "normalized": "2.42", - "type": "deposit" - }, - { - "amount": "1.00", - "asset": "USD", - "normalized": "1.00", - "type": "partner" - } - ], - "user": { - "country": "US" - }, - "widget": { - "id": "998544f2-5b01-4062-9394-22827ff5db6c", - "name": "ACME", - "flow": "crypto_onramp" - } - // highlight-end - } -} -``` - - - - -### `order:crypto-onramp:completed` - -Triggered when a user's order has completed. - - - - -- `id`: UUID of the order. -- `status`: Status of the order (`completed`). -- `createdAt`: Timestamp at which the order was created. -- `updatedAt`: Timestamp at which the order was last updated. -- `origin`: Object containing information about how the user paid. - - `amount`: Amount the user paid. - - `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 make the payment. - - `paymentMethod`: Object containing information about the payment method used. - - `type`: Type of payment method. -- `destination`: Object containing information about what the user received. - - `amount`: Amount the user received. - - `rate`: Rate used to calculate the amount. - - `asset`: Cryptoasset the user received. - - `blockchainUrl` (_deprecated_): URL to view the transaction details on a blockchain explorer. - - `network`: Network of the receiving asset. - - `address`: Recipient wallet address. - - `tag` (_optional_): Tag of the crypto transaction, used to complement the `address`. - - `type`: Tag type (e.g.: `memo` or `destination-tag`). - - `value`: Tag value. - - `priority` (_optional_): Priority of the crypto transaction. - - `ledger` (_optional_): Object containing information about the transaction on the ledger. - - `txid`: Transaction ID on the ledger. - - `url`: URL to view the transaction details on a blockchain explorer. -- `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`). -- `user`: An object containing user related information. - - `country`: country of the user. -- `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 `origin.paymentMethod.type` can be found using our [REST API](../rest-api.md), via the [payment methods endpoint](https://api.topperpay.com/payment-methods/crypto-onramp). -::: - - - - -```js -{ - "name": "order:crypto-onramp:completed", - "id": "00a991cf-a870-43af-88b8-43c51532831d", - "bootstrapTokenId": "141bfa06-481e-4684-96eb-cec4ad529616", - "data": { - // highlight-start - "id": "966b8e24-6a65-442a-942e-577f16288789", - "status": "completed", - "createdAt": "2023-06-12T17:21:21.240Z", - "updatedAt": "2023-06-12T17:21:21.240Z", - "origin": { - "amount": "100.00", - "rate": "1770.27534301775263314892", - "asset": "USD", - "paymentMethod": { - "type": "credit-card" - } - }, - "destination": { - "amount": "0.047116964221968237", - "rate": "0.00056488387749632223", - "asset": "ETH", - "ledger": { - "txid": "0xdfa1ea4ddb841af466a5ca78c6e1f0edfaef5e54e79a28238d2a5bb2da4f1911", - "url": "https://etherscan.io/tx/0xdfa1ea4ddb841af466a5ca78c6e1f0edfaef5e54e79a28238d2a5bb2da4f1911" - }, - "network": "ethereum", - "address": "0xb794F5eA0ba39494cE839613fffBA74279579268" - }, - "fees": [ - { - "amount": "14.17", - "asset": "USD", - "normalized": "14.17", - "type": "network" - }, - { - "amount": "2.42", - "asset": "USD", - "normalized": "2.42", - "type": "deposit" - }, - { - "amount": "1.00", - "asset": "USD", - "normalized": "1.00", - "type": "partner" - } - ], - "user": { - "country": "US" - }, - "widget": { - "id": "998544f2-5b01-4062-9394-22827ff5db6c", - "name": "ACME", - "flow": "crypto_onramp" - } - // highlight-end - } -} -``` - - - - -### `order:crypto-onramp:failed` - -Triggered when a user's order has failed. - - - - -- `id`: UUID of the order. -- `status`: Status of the order (`failed`). -- `createdAt`: Timestamp at which the order was created. -- `updatedAt`: Timestamp at which the order was last updated. -- `origin`: Object containing information about how the user paid. - - `amount`: Amount the user paid. - - `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 make the payment. - - `paymentMethod`: Object containing information about the payment method used. - - `type`: Type of payment method. -- `destination`: Object containing information about what the user would have received. - - `amount`: Amount the user would have received. - - `rate`: Rate used to calculate the amount. - - `asset`: Cryptoasset the user would have received. - - `network`: Network of the receiving asset. - - `address`: Recipient wallet address. - - `tag` (_optional_): Tag of the crypto transaction, used to complement the `address`. - - `type`: Tag type (e.g.: `memo` or `destination-tag`). - - `value`: Tag value. - - `priority` (_optional_): Priority of the crypto transaction. -- `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`). -- `user`: An object containing user related information. - - `country`: country of the user. -- `widget`: Widget associated with the session. - - `id` UUID of the widget. - - `name`: Name of the widget. - - `flow`: Flow associated with the widget. -- `error`: Indicates specific error information. - - `reason`: Indicates the reason for the error, possible values are `fraud`. - -:::note -The values for `origin.paymentMethod.type` can be found using our [REST API](../rest-api.md), via the [payment methods endpoint](https://api.topperpay.com/payment-methods/crypto-onramp). -::: - - - - -```js -{ - "name": "order:crypto-onramp:failed", - "id": "00a991cf-a870-43af-88b8-43c51532831d", - "bootstrapTokenId": "141bfa06-481e-4684-96eb-cec4ad529616", - "data": { - // highlight-start - "id": "966b8e24-6a65-442a-942e-577f16288789", - "status": "failed", - "createdAt": "2023-06-12T17:21:21.240Z", - "updatedAt": "2023-06-12T17:21:21.240Z", - "origin": { - "amount": "100.00", - "rate": "1770.27534301775263314892", - "asset": "USD", - "paymentMethod": { - "type": "credit-card" - } - }, - "destination": { - "amount": "0.047116964221968237", - "rate": "0.00056488387749632223", - "asset": "ETH", - "network": "ethereum", - "address": "0xb794F5eA0ba39494cE839613fffBA74279579268" - }, - "fees": [ - { - "amount": "14.17", - "asset": "USD", - "normalized": "14.17", - "type": "network" - }, - { - "amount": "2.42", - "asset": "USD", - "normalized": "2.42", - "type": "deposit" - }, - { - "amount": "1.00", - "asset": "USD", - "normalized": "1.00", - "type": "partner" - } - ], - "user": { - "country": "US" - }, - "widget": { - "id": "998544f2-5b01-4062-9394-22827ff5db6c", - "name": "ACME", - "flow": "crypto_onramp" - }, - "error": { - "reason": "fraud" - } - // highlight-end - } -} -``` - - - - -### `order:crypto-onramp:refund:completed` - -Triggered when a user's order has been successfully refunded. - - - - -- `id`: UUID of the order. -- `status`: Status of the order (`refunded`). -- `createdAt`: Timestamp at which the order was created. -- `updatedAt`: Timestamp at which the order was last updated. -- `origin`: Object containing information about how the user paid. - - `amount`: Amount the user paid. - - `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 make the payment. - - `paymentMethod`: Object containing information about the payment method used. - - `type`: Type of payment method. -- `destination`: Object containing information about what the user would have received. - - `amount`: Amount the user would have received. - - `rate`: Rate used to calculate the amount. - - `asset`: Cryptoasset the user would have received. - - `network`: Network of the receiving asset. - - `address`: Recipient wallet address. - - `tag` (_optional_): Tag of the crypto transaction, used to complement the `address`. - - `type`: Tag type (e.g.: `memo` or `destination-tag`). - - `value`: Tag value. - - `priority` (_optional_): Priority of the crypto transaction. -- `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`). -- `refund`: Object containing information about how much was refunded to the user. - - `formattedAmount`: Amount refunded to the user - - `asset`: Currency code in the [ISO 4217](https://www.iso.org/iso-4217-currency-codes.html) format used to make the payment. - - `rate`: Rate used to calculate the amount. -- `user`: An object containing user related information. - - `country`: country of the user. -- `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 `origin.paymentMethod.type` can be found using our [REST API](../rest-api.md), via the [payment methods endpoint](https://api.topperpay.com/payment-methods/crypto-onramp). -::: - - - - -```js -{ - "name": "order:crypto-onramp:refund:completed", - "id": "00a991cf-a870-43af-88b8-43c51532831d", - "bootstrapTokenId": "141bfa06-481e-4684-96eb-cec4ad529616", - "data": { - // highlight-start - "id": "966b8e24-6a65-442a-942e-577f16288789", - "status": "refunded", - "createdAt": "2023-06-12T17:21:21.240Z", - "updatedAt": "2023-06-12T17:21:21.240Z", - "origin": { - "amount": "100.00", - "rate": "1770.27534301775263314892", - "asset": "USD", - "paymentMethod": { - "type": "credit-card" - } - }, - "destination": { - "amount": "0.047116964221968237", - "rate": "0.00056488387749632223", - "asset": "ETH", - "network": "ethereum", - "address": "0xb794F5eA0ba39494cE839613fffBA74279579268" - }, - "fees": [ - { - "amount": "14.17", - "asset": "USD", - "normalized": "14.17", - "type": "network" - }, - { - "amount": "2.42", - "asset": "USD", - "normalized": "2.42", - "type": "deposit" - }, - { - "amount": "1.00", - "asset": "USD", - "normalized": "1.00", - "type": "partner" - } - ], - "refund": { - "asset": "USD", - "formattedAmount": "$ 100.00", - "rate": "1770.27534301775263314892", - }, - "user": { - "country": "US" - }, - "widget": { - "id": "998544f2-5b01-4062-9394-22827ff5db6c", - "name": "ACME", - "flow": "crypto_onramp" - } - // highlight-end - } -} -``` - - - +Full information about the available events and their associated payloads can be found on the [events page](../events/crypto-onramp.mdx). diff --git a/docs/kyc-sharing.md b/docs/kyc-sharing.md index da9da7a..310b7a1 100644 --- a/docs/kyc-sharing.md +++ b/docs/kyc-sharing.md @@ -1,5 +1,5 @@ --- -sidebar_position: 14 +sidebar_position: 15 --- # KYC sharing diff --git a/docs/mobile.md b/docs/mobile.md index 97e07ed..b22ce95 100644 --- a/docs/mobile.md +++ b/docs/mobile.md @@ -1,5 +1,5 @@ --- -sidebar_position: 10 +sidebar_position: 11 --- # Mobile diff --git a/docs/rest-api.md b/docs/rest-api.md index 1f62a98..8f5469b 100644 --- a/docs/rest-api.md +++ b/docs/rest-api.md @@ -1,5 +1,5 @@ --- -sidebar_position: 7 +sidebar_position: 8 --- # REST API diff --git a/docs/security.md b/docs/security.md index 8e562dc..5f4574f 100644 --- a/docs/security.md +++ b/docs/security.md @@ -1,5 +1,5 @@ --- -sidebar_position: 12 +sidebar_position: 13 --- # Security diff --git a/docs/single-sign-on.md b/docs/single-sign-on.md index ec7a087..8d2756c 100644 --- a/docs/single-sign-on.md +++ b/docs/single-sign-on.md @@ -1,5 +1,5 @@ --- -sidebar_position: 11 +sidebar_position: 12 --- # Single Sign-On diff --git a/docs/web-sdk.md b/docs/web-sdk.md index 27619dc..ffed145 100644 --- a/docs/web-sdk.md +++ b/docs/web-sdk.md @@ -1,5 +1,5 @@ --- -sidebar_position: 13 +sidebar_position: 14 --- # Web SDK diff --git a/docs/webhooks.md b/docs/webhooks.mdx similarity index 86% rename from docs/webhooks.md rename to docs/webhooks.mdx index 7dba042..99dc3a1 100644 --- a/docs/webhooks.md +++ b/docs/webhooks.mdx @@ -1,5 +1,5 @@ --- -sidebar_position: 5 +sidebar_position: 6 --- import Tabs from '@theme/Tabs'; @@ -22,28 +22,35 @@ A webhook request will include the following data: ## Events -Full information about the available events and their associated payloads can be found on the associated **Flows** page. +Full information about the available events and their associated payloads can be found on the [events](./events/crypto-onramp) page. -### Onramp flow +### Onramp events | 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. | +| [`order:crypto-onramp:committed`](./events/crypto-onramp.mdx#ordercrypto-onrampcommitted) | User placed an order. | +| [`order:crypto-onramp:charged`](./events/crypto-onramp.mdx#ordercrypto-onrampcharged) | User has been charged for their order. | +| [`order:crypto-onramp:completed`](./events/crypto-onramp.mdx#ordercrypto-onrampcompleted) | User's order has completed. | +| [`order:crypto-onramp:failed`](./events/crypto-onramp.mdx#ordercrypto-onrampfailed) | User's order has failed. | +| [`order:crypto-onramp:refund:completed`](./events/crypto-onramp.mdx#ordercrypto-onramprefundcompleted) | User's order has been successfully refunded. | -### Offramp flow +### Offramp events | 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. | +| [`order:crypto-offramp:committed`](./events/crypto-offramp.mdx#ordercrypto-offrampcommitted) | User placed an order. | +| [`order:crypto-offramp:funds-sent`](./events/crypto-offramp.mdx#ordercrypto-offrampfunds-sent) | User has sent funds for their order. | +| [`order:crypto-offramp:funds-received`](./events/crypto-offramp.mdx#ordercrypto-offrampfunds-received) | User has sent funds for their order and we have received them. | +| [`order:crypto-offramp:completed`](./events/crypto-offramp.mdx#ordercrypto-offrampcompleted) | User's order has completed. | +| [`order:crypto-offramp:failed`](./events/crypto-offramp.mdx#ordercrypto-offrampfailed) | User's order has failed. | +| [`order:crypto-offramp:refund:completed`](./events/crypto-offramp.mdx#ordercrypto-offramprefundcompleted) | User's order has been successfully refunded. | + +### User events + +| Event | Trigger | +| - | - | +| [`user:created`](./events/user.mdx#usercreated) | User created a new account. | +| [`user:logged-in`](./events/user.mdx#userlogged-in) | User logged in. | ## Verifying a request @@ -264,7 +271,7 @@ def createWebhookVerifier(pubJwk): jwsSplited = topperJwsSig.split('.') header, signature = jwsSplited[0], jwsSplited[2] payload = base64url_encode(bytes(body, encoding="utf-8")) - + token = f"{header}.{payload.decode("utf-8")}.{signature}" # Verify the token. @@ -284,7 +291,7 @@ body = '{"foo":"bar"}' # X-Topper-JWS-Signature request header example. topperJwsSig = 'eyJhbGciOiJFUzI1NiJ9..2H0Ypm5sVzuSpgyZySdAJan05lYxctqhmO8btghFQQzkisvSlNvNWzQ1kqTPXTLP_dR4zQZrTsSsShAK51I4EQ' -if __name__ == "__main__": +if __name__ == "__main__": # Example of verifying a webhook request. verifyWebhook = createWebhookVerifier(pubJwk) verified = verifyWebhook(body, topperJwsSig)