Skip to main content
POST
/
public
/
v1
/
submit
/
init_fiat_on_ramp

Authorizations

X-Stamp
string
required
Cryptographically signed (stamped) request to be passed in as a header. For more info, see here.

Body

type
enum<string>
required
Enum options: ACTIVITY_TYPE_INIT_FIAT_ON_RAMP
timestampMs
string
required
Timestamp (in milliseconds) of the request, used to verify liveness of user requests.
organizationId
string
required
Unique identifier for a given Organization.
parameters
object
required

The parameters object containing the specific intent data for this activity.

generateAppProofs
boolean
Enable to have your activity generate and return App Proofs, enabling verifiability.

Response

A successful response returns the following fields:
activity
object
required
The activity object containing type, intent, and result
curl --request POST \
  --url https://api.turnkey.com/public/v1/submit/init_fiat_on_ramp \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --header "X-Stamp: <string> (see Authorizations)" \
  --data '{
    "type": "ACTIVITY_TYPE_INIT_FIAT_ON_RAMP",
    "timestampMs": "<string> (e.g. 1746736509954)",
    "organizationId": "<string> (Your Organization ID)",
    "parameters": {
        "onrampProvider": "<FIAT_ON_RAMP_PROVIDER_COINBASE>",
        "walletAddress": "<string>",
        "network": "<FIAT_ON_RAMP_BLOCKCHAIN_NETWORK_BITCOIN>",
        "cryptoCurrencyCode": "<FIAT_ON_RAMP_CRYPTO_CURRENCY_BTC>",
        "fiatCurrencyCode": "<FIAT_ON_RAMP_CURRENCY_AUD>",
        "fiatCurrencyAmount": "<string>",
        "paymentMethod": "<FIAT_ON_RAMP_PAYMENT_METHOD_CREDIT_DEBIT_CARD>",
        "countryCode": "<string>",
        "countrySubdivisionCode": "<string>",
        "sandboxMode": "<boolean>",
        "urlForSignature": "<string>"
    }
}'
import { Turnkey } from "@turnkey/sdk-server";

const turnkeyClient = new Turnkey({
  apiBaseUrl: "https://api.turnkey.com",
  apiPublicKey: process.env.API_PUBLIC_KEY!,
  apiPrivateKey: process.env.API_PRIVATE_KEY!,
  defaultOrganizationId: process.env.ORGANIZATION_ID!,
});

const response = await turnkeyClient.apiClient().initFiatOnRamp({
  onrampProvider: "<FIAT_ON_RAMP_PROVIDER_COINBASE>" // onrampProvider field,
  walletAddress: "<string> (Destination wallet address for the buy transaction.)",
  network: "<FIAT_ON_RAMP_BLOCKCHAIN_NETWORK_BITCOIN>" // network field,
  cryptoCurrencyCode: "<FIAT_ON_RAMP_CRYPTO_CURRENCY_BTC>" // cryptoCurrencyCode field,
  fiatCurrencyCode: "<FIAT_ON_RAMP_CURRENCY_AUD>" // fiatCurrencyCode field,
  fiatCurrencyAmount: "<string> (Specifies a preset fiat amount for the transaction, e.g., '100'. Must be greater than '20'. If not provided, the user will be prompted to enter an amount.)",
  paymentMethod: "<FIAT_ON_RAMP_PAYMENT_METHOD_CREDIT_DEBIT_CARD>" // paymentMethod field,
  countryCode: "<string> (ISO 3166-1 two-digit country code for Coinbase representing the purchasing user’s country of residence, e.g., US, GB.)",
  countrySubdivisionCode: "<string> (ISO 3166-2 two-digit country subdivision code for Coinbase representing the purchasing user’s subdivision of residence within their country, e.g. NY. Required if country_code=US.)",
  sandboxMode: true // Optional flag to indicate whether to use the sandbox mode to simulate transactions for the on-ramp provider. Default is false.,
  urlForSignature: "<string> (Optional MoonPay Widget URL to sign when using MoonPay client SDKs with URL Signing enabled.)"
});
{
  "activity": {
    "id": "<activity-id>",
    "status": "ACTIVITY_STATUS_COMPLETED",
    "type": "ACTIVITY_TYPE_INIT_FIAT_ON_RAMP",
    "organizationId": "<organization-id>",
    "timestampMs": "<timestamp> (e.g. 1746736509954)",
    "result": {
      "activity": {
        "id": "<string>",
        "organizationId": "<string>",
        "status": "<string>",
        "type": "<string>",
        "intent": {
          "initFiatOnRampIntent": {
            "onrampProvider": "<FIAT_ON_RAMP_PROVIDER_COINBASE>",
            "walletAddress": "<string>",
            "network": "<FIAT_ON_RAMP_BLOCKCHAIN_NETWORK_BITCOIN>",
            "cryptoCurrencyCode": "<FIAT_ON_RAMP_CRYPTO_CURRENCY_BTC>",
            "fiatCurrencyCode": "<FIAT_ON_RAMP_CURRENCY_AUD>",
            "fiatCurrencyAmount": "<string>",
            "paymentMethod": "<FIAT_ON_RAMP_PAYMENT_METHOD_CREDIT_DEBIT_CARD>",
            "countryCode": "<string>",
            "countrySubdivisionCode": "<string>",
            "sandboxMode": "<boolean>",
            "urlForSignature": "<string>"
          }
        },
        "result": {
          "initFiatOnRampResult": {
            "onRampUrl": "<string>",
            "onRampTransactionId": "<string>",
            "onRampUrlSignature": "<string>"
          }
        },
        "votes": "<array>",
        "fingerprint": "<string>",
        "canApprove": "<boolean>",
        "canReject": "<boolean>",
        "createdAt": "<string>",
        "updatedAt": "<string>"
      }
    }
  }
}