Skip to main content

RampPreview

Host Ramp transaction details for users to review inputted buying and selling information, as well as navigate to ACH payment.

Before using this component, please make sure you are logged-in.

Before using this component, we assume that you are already familiar with the basic configuration of Portkey.

Feature

RampPreview's functions and UIs are as follows:

  • Display the basic information for buy, including fiat currency, types of tokens, quantity, and exchange rate
  • Exchange rate is renewed every 15 seconds
  • Provide a shortcut to navigate to Alchemy Pay to complete the transaction
buy-preview
sell-preview

Usage

import { RampPreview, RampTypeEnum } from '@portkey/did-ui-react';

const App: React.FC = () => (
<RampPreview
initState={{
amount: '200',
country: 'US',
crypto: 'ELF',
fiat: 'USD',
network: 'ELF',
side: RampTypeEnum.BUY,
}}
chainId={'AELF'}
portkeyServiceUrl="https://localtest-applesign.portkey.finance"
overrideAchConfig={{
appId: 'f83Is2y7L425rxl8',
baseUrl: 'https://ramptest.alchemypay.org',
updateAchOrder: '/api/app/thirdPart/order/alchemy',
}}
onBack={function (): void {}}
/>
);
export default App;

API

PropertyDescriptionTypeRequiredDefault
classNameClass name of the top level containerstringfalse
initStateData that controls the initial page displayIRampPreviewInitStatetrue
portkeyServiceUrlPortkey server domain. Can be sent to ACH so ACH can interact with Portkey server domainstringtrue
chainIdChain ID where it happensChainIdfalse'AELF'
overrideAchConfigACH configurationIAchConfigfalseDefault is the Mainnet configuration
isBuySectionShowControl if on-ramp is enabledbooleanfalsetrue
isSellSectionShowControl if off-ramp is enabledbooleanfalsetrue
onBackControl the event to go back to the previous route() => voidtrue
InterfacePropertyDescriptionTypeRequired
IRampPreviewInitState
cryptoCrypto name, eg: ELFstringtrue
netwrokCrypto network eg: AELFstringtrue
fiatFait code, eg: USDstringtrue
countryCountry code, eg: USstringtrue
amountAccount numberstringfalse
sideBusiness typeRampTypeEnum: "BUY" | "SELL"true
IAchConfig
appIdMerchant App Id eg: P0e0l39jipsNYT46number | stringtrue
baseUrlRedirect to ACH url, eg: 'https://ramp.alchemypay.org'stringtrue
updateAchOrderRedirect to ACH path, eg: '/api/app/thirdPart/order/alchemy'stringtrue
Fixed configurationTestnetMainnet
IAchConfigappId: 'f83Is2y7L425rxl8',
baseUrl: 'https://ramptest.alchemypay.org',
updateAchOrder: '/api/app/thirdPart/order/alchemy',
appId: 'P0e0l39jipsNYT46',
baseUrl: 'https://ramp.alchemypay.org',
updateAchOrder: '/api/app/thirdPart/order/alchemy'