Crypto.com is currently in limited beta. Please contact support if you’re interested in early access.
Overview
Crypto.com onramp integration allows users to purchase cryptocurrency directly within your application using Crypto.com’s payment infrastructure. This integration supports both widget-based and headless implementations, providing a seamless way for users to fund their wallets with fiat currency.Dashboard Setup
To enable Crypto.com onramp:- Go to the Funding tab in your Dynamic developer dashboard
- Under “Fiat on-ramps”, toggle on Crypto.com
- Save the settings
Secret key
You’ll need to create a merchant account on crypto.com. So, go to the merchant.crypto.com and create an account.
Return and cancel URLs
You’ll need to set the return and cancel URLs in the Dynamic dashboard. These URLs are used to redirect the user after the payment is completed or cancelled.Widget Implementation
Once enabled, users will see Crypto.com as an option in the Dynamic widget’s deposit screen:
Programmatic Implementation
Using the useOnramp Hook
You can trigger Crypto.com onramp programmatically using theuseOnramp
hook. This approach gives you full control over when and how the onramp is displayed:
React
Accessing Provider Information
You can also access provider configuration details through theproviders
array. This is useful for dynamically displaying available onramp options:
React
Providers Array Structure
Theproviders
array contains configuration for each available onramp provider. This allows you to build custom UI components that dynamically show available options:
Field | Type | Description |
---|---|---|
displayName | string | Human-readable name of the provider |
iconUrl | string | URL to the provider’s icon |
id | string | Unique identifier for the provider |
openMode | string | How the onramp opens (iframe or popup ) |
url | string | The onramp URL with pre-configured parameters |
Payment Tracking
Payment ID
Crypto.com provides a payment ID in the onramp URL that you can use to track payment status. This ID is included in the URL parameters when the onramp is opened and is essential for monitoring payment progress.Getting Payment Information
Use the payment ID from the Crypto.com onramp URL to fetch payment details via their API. You’ll need your Crypto.com secret key for authentication:Key Response Fields
The Crypto.com payment API response contains extensive information about the payment. Here are the key fields you’ll commonly use for tracking and displaying payment status:Field | Type | Description |
---|---|---|
id | string | Unique payment identifier |
status | string | Current payment status (pending, completed, failed, cancelled) |
amount | number | Payment amount in fiat currency (e.g., 500 = $500.00) |
original_amount | number | Original payment amount before any adjustments |
currency | string | Fiat currency code (e.g., “USD”) |
crypto_currency | string | Cryptocurrency symbol (e.g., “CRO”, “ETH”) |
crypto_amount | string | Amount of cryptocurrency to be received |
amount_in_usd | string | Payment amount in USD |
amount_in_usdc | string | Payment amount in USDC |
payout_wallet_address | string | Destination wallet address for the crypto |
payout_chain_name | string | Blockchain network name (e.g., “Ethereum”) |
metadata | object | Additional payment metadata including chain and network info |
time_window | number | Payment time window in seconds (e.g., 600 = 10 minutes) |
remaining_time | string | Time remaining for payment completion (e.g., “09:25”) |
expired | boolean | Whether the payment has expired |
expired_at | number | Unix timestamp when payment expires |
created | number | Unix timestamp when payment was created |
settled_at | number | Unix timestamp when payment was settled (0 if not settled) |
payment_url | string | URL for the payment checkout interface |
return_url | string | URL to redirect to after successful payment |
cancel_url | string | URL to redirect to after cancelled payment |
qr_code | string | Base64 encoded QR code for mobile payments |
deep_link | string | Deep link for mobile app payments |
live_mode | boolean | Whether this is a live payment (false for test mode) |
extra_requirements | array | Additional requirements (e.g., [“require_login”, “require_ssn”]) |
ncw_connections | array | Available wallet connection methods |
network_cost | string | Network transaction cost |
Payment Status Values
Status | Description |
---|---|
pending | Payment is being processed |
completed | Payment has been successfully completed |
failed | Payment failed for various reasons |
cancelled | Payment was cancelled by the user |
Extracting Payment ID from URLs
When a user initiates a Crypto.com payment, the payment ID is included in the URL parameters. You can extract it for tracking purposes:React
Implementing Payment Status Tracking
You can implement payment status tracking by:- Extracting Payment ID: Parse the payment ID from the Crypto.com onramp URL
- Polling API: Periodically check payment status using the Crypto.com API
- Webhook Integration: Set up webhooks to receive real-time status updates
React
Supported Parameters
Crypto.com onramp supports the following URL parameters that can be passed when opening the onramp:Parameter | Type | Description |
---|---|---|
walletAddress | string | Destination wallet address for the purchase |
coinAmount | string | Amount of cryptocurrency to purchase |
coinType | string | Cryptocurrency symbol (e.g., “ETH”, “BTC”) |
blockchain | string | Blockchain network (e.g., “ETH”, “BTC”) |
fiatCurrency | string | Fiat currency for payment (e.g., “USD”) |
fiatAmount | string | Amount in fiat currency |
Error Handling
Common error scenarios and how to handle them in your application:Insufficient Funds
- Error: User doesn’t have sufficient funds for the purchase
- Handling: Display appropriate error message and suggest alternative amounts
Invalid Wallet Address
- Error: The provided wallet address is invalid
- Handling: Validate wallet address format before opening onramp
Network Issues
- Error: Network connectivity issues during payment processing
- Handling: Implement retry logic and fallback mechanisms
Best Practices
- Validate Parameters: Always validate wallet addresses and amounts before opening the onramp
- Handle Errors Gracefully: Implement proper error handling for all failure scenarios
- Track Payment Status: Monitor payment status to provide user feedback
- Security: Never expose API keys in client-side code - use server-side endpoints for sensitive operations
- User Experience: Provide clear feedback during payment processing and handle loading states
- Provider Selection: Use the
providers
array to dynamically display available onramp options - Fallback Handling: Implement fallback mechanisms for when specific providers are unavailable
- Amount Validation: Ensure fiat amounts are reasonable and within supported limits
- Currency Support: Verify that the selected currency is supported by Crypto.com in your region
Related
- useOnramp - Programmatic onramp triggering
- usePayWithDynamic - Unified payment flow
- Default Onramps - General onramp setup