Creating an Onramp Transfer

Creating onramp order (API link):

  • Minimal payload :
    curl --location 'https://sandbox-api.transfi.com/v3/orders' \
    --header 'Content-Type: application/json' \
    --header 'Authorization: Basic ==' \
    --header 'mid: SAH1N3_NA_NA' \
    --data '{
        "userId": "UX-2123123123123",
        "orderType": "onramp",
        "purposeCode": "company_expenses",
        "source": {
            "currency": "IDR",
            "paymentType": "bank_transfer",
            "amount: "150000"
        },
        "destination": {
            "currency": "USDCSOL",
            "walletAddress": "0xDEADBEEF123456768345345kjDEF",
            "additionalPaymentDetails": {
                "walletOwner": "exchange"
             }
        }
    }'
    {
        "status": "success",
        "data": {
            "flow": "ONRAMP",
            "flowType": "user-self",
            "orderId": "OR-260824102254413842979109867",
            "payUrl": "https://pay-widget.transfi.com//pay?paytoken=0d537d2d-c3c9-4d6b-ae6e-8e2c48a58752",
            "feeData": {
                "depositAmount": 150000,
                "withdrawAmount": 8.207718,
                "exchangeRate": 0.00005645696765948078,
                "totalFee": 4619.93
            },
            "quoteHistory": {
                "refreshCount": 0,
                "orderCreationQuote": {
                    "isRefreshed": false,
                    "usedQuotes": {
                        "sourceCurrency": "IDR",
                        "sourceAmount": 150000,
                        "sourceAmountInUsd": 8.47,
                        "sourceCurrencyType": "fiat",
                        "destinationCurrency": "USDCSOL",
                        "destinationAmount": 8.207718,
                        "destinationAmountInUsd": 8.21,
                        "destinationCurrencyType": "crypto",
                        "conversionRate": 0.00005645696765948078,
                        "minLimit": 91236,
                        "maxLimit": 1771566949.77,
                        "direction": "forward",
                        "processingFee": 4500,
                        "processingFeeRate": 0.03,
                        "customerFee": 0,
                        "customerFeeRate": 0,
                        "rrFeeRate": 0,
                        "discount": 0,
                        "discountRate": 0,
                        "additionalFee": 0,
                        "fixedFee": {
                            "totalFixedFees": 0,
                            "totalFixedTfFees": 0,
                            "totalFixedCxFees": 0,
                            "fixedFeesCurrency": "IDR",
                            "fixedFeeDetails": {
                                "baseFeeFixedRate": 0,
                                "tfFeeFixedRate": 0,
                                "cxFeeFixedRate": 0,
                                "currency": ""
                            }
                        },
                        "totalFee": 4619.93,
                        "feeMode": "percentage",
                        "rateType": "live",
                        "quoteId": "QUOTE-593d9ea1-b46f-45e1-b281-6bc90b3ca141",
                        "networkFee": 119.93
                    }
                }
            }
        },
        "traceId": "4f6eaf57-1407-4a35-a172-bff06ee7a875"
    }
  • Full payload:
    curl --location 'https://sandbox-api.transfi.com/v3/orders' \
    --header 'Content-Type: application/json' \
    --header 'Authorization: Basic ==' \
    --header 'mid: SAH1N3_NA_NA' \
    --data '{
        "userId": "UX-2123123123123",
        "orderType": "onramp",
        "purposeCode": "company_expenses",
        "purposeCodeReason": "Personal payment",
        "successRedirectUrl": "https://yourapp.com/success",
        "failureRedirectUrl": "https://yourapp.com/failure",
    	"headlessMode": true,
        "sourceUrl": "https://yourapp.com/source"
        "partnerId": "1234567890",
        "customerMetaData": {
            "customerId": "1234567890",
            "customerName": "John Doe",
            "customerEmail": "[email protected]"
        },
        "deviceDetails": {
            "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)",
            "ipInfo": {
                "ip": "123.123.123.123",
                "countryCode3": "IND"
            }
        },  
        "source": {
            "currency": "IDR",
            "paymentType": "local_wallet",
            "paymentCode": "ovo",
            "amount: "150000"
            "additionalPaymentDetails": {
                "phoneCode": "+62",
                "phone": "12341234123",
                "street": "abcd",
                "city": "abcd",
                "state": "abcd",
                "documentType": "passport",
                "documentNumber": "abcde",
                "dob": "01-01-2000"
            }
        },
        "destination": {
            "currency": "USDCSOL",
            "walletAddress": "0xDEADBEEF123456768345345kjDEF",
            "additionalPaymentDetails": {
                "walletOwner": "exchange",
                "exchangeName": "binance"
             }
        },
         "customization": {
            "locale": "id"
         },
    }'
    {
        "status": "success",
        "data": {
            "flow": "ONRAMP",
            "flowType": "user-self",
            "orderId": "OR-260824102617944714300543731",
            "amount": 150000,
            "payUrl": "https://pay-widget.transfi.com//pay?paytoken=953f1289-dfbd-4af1-8fd7-1dc827eedf2b",
            "paymentsData": {
                "type": "qrCode",
                "qrCode": "00020101021226670016COM.NOBUBANK.WWW01189360050300000909160214122400006958510303UME51440014ID.CO.QRIS.WWW0215ID20243658498090303UME52045817530336054061500005802ID5904MOBI6015JAKARTA SELATAN61051295062610114417261838836440624202608241726181865f38a920703A010804POSP630473F5"
            },
            "feeData": {
                "depositAmount": 150000,
                "withdrawAmount": 8.21245,
                "exchangeRate": 0.00005646342371501418,
                "totalFee": 4552.75
            },
            "quoteHistory": {
                "refreshCount": 0,
                "orderCreationQuote": {
                    "isRefreshed": false,
                    "usedQuotes": {
                        "sourceCurrency": "IDR",
                        "sourceAmount": 150000,
                        "sourceAmountInUsd": 8.47,
                        "sourceCurrencyType": "fiat",
                        "destinationCurrency": "USDCSOL",
                        "destinationAmount": 8.21245,
                        "destinationAmountInUsd": 8.21,
                        "destinationCurrencyType": "crypto",
                        "conversionRate": 0.00005646342371501418,
                        "minLimit": 91226,
                        "maxLimit": 20000000,
                        "direction": "forward",
                        "processingFee": 4500,
                        "processingFeeRate": 0.03,
                        "customerFee": 0,
                        "customerFeeRate": 0,
                        "rrFeeRate": 0,
                        "discount": 0,
                        "discountRate": 0,
                        "additionalFee": 0,
                        "fixedFee": {
                            "totalFixedFees": 0,
                            "totalFixedTfFees": 0,
                            "totalFixedCxFees": 0,
                            "fixedFeesCurrency": "IDR",
                            "fixedFeeDetails": {
                                "baseFeeFixedRate": 0,
                                "tfFeeFixedRate": 0,
                                "cxFeeFixedRate": 0,
                                "currency": ""
                            }
                        },
                        "totalFee": 4552.75,
                        "feeMode": "percentage",
                        "rateType": "live",
                        "quoteId": "QUOTE-3e5e1290-063a-43f8-a81a-ea47e9bc861f",
                        "networkFee": 52.75
                    }
                }
            }
        },
        "traceId": "35fa5d39-77b5-46c8-bd8b-9cb237523c12"
    }

In the successful response from the api-call you will get the paymentUrl, to which you need to redirect your user to complete the payment. After redirecting, there's nothing to do but wait!

Once the user completes the payment, we will initiate the crypto transfer to the users wallet.


Note: Amount to be transferred can be passed in either source or destination.

Examples:

{
    "source": {
        "currency": "EUR",
        "amount": "100"
    },
    "destination": {
        "currency": "USDC"
    }
}
{
    "source": {
        "currency": "EUR"
    },
    "destination": {
        "currency": "USDC",
        "amount": "100"
    }
}
  1. Amount is sent in source object: In this case, user needs to do payin of 100 EUR. Amount of USDC that will be sent to user will be calculated (~105 USDC). (This is usually preferred)
  2. Amount is sent in destination object: In this case, amount of EUR that user needs to send will be calculated (~94.5 EUR) and 100 USDC will be sent to user.

Did this page help you?