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": "USD",
            "amount": "10",
            "paymentType": "bank_transfer",
            "amount: "200"
        },
        "destination": {
            "currency": "USDTPOLYGON",
            "walletAddress": "0xDEADBEEF123456768345345kjDEF",
        }
    }'
    {
        "status": "success",
        "data": {
            "flow": "FIAT_PAYIN",
            "orderId": "OR-2509291454262384294",
            "payUrl": "https://sandbox-pay-widget.transfi.com/pay?paytoken=6c237e7e-4a55-4503-81b0-41b348d54a6d"
        },
    }
  • **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": "USD",
            "amount": "10",
            "paymentType": "bank_transfer",
            "paymentCode": "swift",
            "amount: "200"
            "additionalPaymentDetails": {
                "phoneCode": "+91",
                "phone": "12341234123",
                "street": "abcd",
                "city": "abcd",
                "state": "abcd",
                "documentType": "passport",
                "documentNumber": "abcde",
                "dob": "01-01-2000"
            }
        },
        "destination": {
            "currency": "USDTPOLYGON",
            "walletAddress": "0xDEADBEEF123456768345345kjDEF"
    
        }
    }'
    {
        "status": "success",
        "data": {
            "flow": "ONRAMP",
            "orderId": "OR-2509301236402255398",
            "payUrl": "https://sandbox-pay-widget.transfi.com/pay?paytoken=basdfba4a34-53245-234-2341d6a7e1"
        }
    }

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.