Create On-Ramp Transaction
This method allows you to add a new transaction to your on-ramp transaction list in Rampable.
Method Signature
async create(request: CreateOnRampRequest): Promise<OnRampTransaction>
Parameters
request
: CreateOnRampRequest
- An object with the following properties:
Required Properties
receiverWalletAddress
:string
- The wallet address of the receiveracceptanceMethod
:string
- The acceptance (payment) method for the fiat currencypaymentPhoneNumber
:string
- Phone number used for e-wallet payment methodsinputAmount
:number
- The amount of the on-ramp transaction in fiat currencyinputCurrency
:string
- The input (fiat) currency codeoutputCurrency
:string
- The crypto ID for the output currencyrampableAccessToken
:string
(optional) - The Rampable access token
A rampableAccessToken
is required if you want to use rampable operations and not setup HTTP Signature Authentication (Personal Token)
Optional Properties
reason
:string
- The reason for the on-ramp transactiondescription
:string
- Additional description for the transactionmemo
:string
- Memo field (required for some blockchains, e.g., Stellar)
Returns
Promise<OnRampTransaction>
- An object containing the created on-ramp transaction details.
Example Usage
const request = {
receiverWalletAddress: '0x1234567890123456789012345678901234567890',
acceptanceMethod: 'virtual_account_bni',
paymentPhoneNumber: '+1234567890',
inputAmount: 16000,
inputCurrency: 'IDR',
outputCurrency: 'usdc-stellar',
reason: 'Investment',
description: 'Monthly crypto purchase',
rampableAccessToken: 'your-rampable-access-token'
};
const transaction = await sdk.onRamp.create(request);
console.log(transaction);
Response Example
{
"onrampId": "e5b11a32-XXXX-XXXX-XXXXX-ed0d0ec9c1b7",
"acceptanceMethod": "virtual_account_bni",
"feeDetail": {
"rate_amount": 15676.51352,
"total_fee_amount": 224.5397227839727,
"total_fee_amount_in_currency": 3520000.0000000005
},
"receiver": {
"id": "64c422d5e78XXXXXXXXXXXXX",
"name": "",
"email": "",
"phoneNumber": "",
"walletAddress": "GDC2QZWDOW4IQXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
},
"inputAmount": 16000,
"inputAmountExact": 16000,
"inputCurrency": "IDR",
"outputCurrency": "usdc",
"outputAmount": 1.0201160925777184,
"outputAmountExact": 0.8798501298482821,
"reason": "Test Create",
"description": "Test create",
"status": "pending",
"organizationId": "-",
"organizationName": "-",
"blockchain": "stellar",
"userId": "req-igv",
"externalOrderId": "1706992XXXXXXXX",
"expiredDate": "2024-02-03T20:44:35.473Z",
"cryptoId": "usdc-stellar",
"useSmartContract": false,
"blockchainType": "STELLAR",
"memo": "",
"activityHistory": [
{
"activity": "Paid by Payee",
"status": "pending",
"description": "Waiting for payment from sender",
"_id": "65bea4878fc071c5583ab9dd",
"updatedAt": "2024-02-03T20:39:35.476Z"
},
{
"activity": "Converted to",
"status": "pending",
"description": "Waiting for fiat money to be received by system, to be converted to crypto asset afterward",
"_id": "65bea4878fc071c5583ab9de",
"updatedAt": "2024-02-03T20:39:35.476Z"
},
{
"activity": "Sent to recipient wallet",
"status": "pending",
"description": "Transaction is under process and will be transferred out to the recipient after conversion is done",
"_id": "65bea4878fc071c5583ab9df",
"updatedAt": "2024-02-03T20:39:35.476Z"
},
{
"activity": "Received by recipient",
"status": "pending",
"description": "Transaction is executed successfully and closed",
"_id": "65bea4878fc071c5583ab9e0",
"updatedAt": "2024-02-03T20:39:35.476Z"
}
],
"acceptanceDetail": {
"is_custom_page": true,
"va_number": "",
"frontend_url": "https://app-dev.rampable.co/fm?data=eyJ0cmFuc1XXXXXXXXXXXXXXXXXfQ=="
},
"clientName": "Xellar",
"clientId": "65383b6d2361032a06bd4f55",
"createdAt": "2024-02-03T20:39:35.484Z",
"updatedAt": "2024-02-03T20:39:35.484Z",
"id": "65bea4878fc071c5583ab9dc"
}
A recipient must be created before using this endpoint. See Create Recipient documentation for more information.
Users need to send the fiat currency to the payment details provided in the acceptanceDetail
. If the response contains txData
, the user must sign the transaction on-chain using the provided txData
.
Additional Information
- After creation, the on-ramp transaction will be in
pending
status - The transaction will be processed automatically after payment is completed
- Users are limited to 5 pending on-ramp transactions at any time
- The transaction status will update to
processed
upon successful completion
For more information, see the Rampable Create On-Ramp API Documentation (opens in a new tab).