Onramp

Create an onramp order

Changed on

Create a new Onramp order or get a quote for an Onramp order. Either paymentAmount or purchaseAmount must be provided.

This API supports two modes:

Headless mode (standard): returns a seamless Apple Pay or Google Pay button that you integrate directly into your app. Your app collects and verifies the user's contact details before calling this endpoint — phoneNumber, email, phoneNumberVerifiedAt, and agreementAcceptedAt are required and enforced server-side.

Embedded mode: returns a webview that collects and verifies the user's contact and identity information, then shows the payment screen. Omit both phoneNumber and email from the request to select this mode. Embedded mode requires account enablement; contact the Onramp team for access.

Read more about the difference between the two modes in the Headless Onramp overview.

This API supports the GUEST_CHECKOUT_APPLE_PAY and GUEST_CHECKOUT_GOOGLE_PAY payment methods.

For detailed integration instructions and to get access to this API, refer to the Guest Checkout Onramp API docs.

post/v2/onramp/orders

Request

  • Base URL
    https://api.cdp.coinbase.com/platform
  • Auth
    HTTP bearer

Headers

X-Onramp-Partner-Id, string uuid

The Onramp-issued identifier of a disclosed end partner, scoped to an aggregator's developer app. Aggregators integrating Onramp on behalf of multiple end partners set this header to attribute a request to one of their registered partners; omit it for standard, non-aggregator integrations. Only honored for developer apps registered as an aggregator — requires Onramp aggregator onboarding, including registration of each end partner. Contact the Onramp team for access.

Request body

object required
agreementAcceptedAt, string date-time

The timestamp of when the user acknowledged that by using Coinbase Onramp they are accepting the Coinbase Terms (https://www.coinbase.com/legal/guest-checkout/us), User Agreement (https://www.coinbase.com/legal/user_agreement), and Privacy Policy (https://www.coinbase.com/legal/privacy).

destinationAddress, string required

The address the purchased crypto will be sent to.

destinationNetwork, string required

The name of the crypto network the purchased currency will be sent on.

Use the Onramp Buy Options API to discover the supported networks for your user's location.

email, string

The verified email address of the user requesting the onramp transaction. This email must be verified by your app (via OTP) before being used with the Onramp API.

isQuote, boolean

If true, this API will return a quote without creating any transaction.

partnerOrderRef, string

Optional partner order reference ID.

partnerUserRef, string required

A unique string that represents the user in your app. This can be used to link individual transactions together so you can retrieve the transaction history for your users. Prefix this string with "sandbox-" (e.g. "sandbox-user-1234") to perform a sandbox transaction which will allow you to test your integration without any real transfer of funds.

This value can be used with the Onramp User Transactions API to retrieve all transactions created by the user.

paymentAmount, string

A string representing the amount of fiat the user wishes to pay in exchange for crypto. When using this parameter, the returned quote will be inclusive of fees i.e. the user will pay this exact amount of the payment currency.

paymentCurrency, string required

The fiat currency to be converted to crypto.

paymentMethod, 'GUEST_CHECKOUT_APPLE_PAY' | 'GUEST_CHECKOUT_GOOGLE_PAY' required

The type of payment method to be used to complete an onramp order.

phoneNumber, string

The phone number of the user requesting the onramp transaction in E.164 format. This phone number must be verified by your app (via OTP) before being used with the Onramp API. Please refer to the Onramp docs for more details on phone number verification requirements and best practices.

phoneNumberVerifiedAt, string date-time

Timestamp of when the user's phone number was verified via OTP. User phone number must be verified every 60 days. If this timestamp is older than 60 days, an error will be returned.

smsVerificationId, string

The SMS verification ID returned by the Submit Onramp Verification endpoint after verifying the user's phone number. When provided, Onramp validates the server-side verification record instead of trusting phoneNumberVerifiedAt.

emailVerificationId, string

The email verification ID returned by the Submit Onramp Verification endpoint after verifying the user's email address.

purchaseAmount, string

A string representing the amount of crypto the user wishes to purchase. When using this parameter the returned quote will be exclusive of fees i.e. the user will receive this exact amount of the purchase currency.

purchaseCurrency, string required

The ticker (e.g. BTC, USDC, SOL) or the Coinbase UUID (e.g. d85dce9b-5b73-5c3c-8978-522ce1d1c1b4) of the crypto asset to be purchased.

Use the Onramp Buy Options API to discover the supported purchase currencies for your user's location.

clientIp, string

The IP address of the end user requesting the onramp transaction.

domain, string

The domain that the Apple Pay or Google Pay button will be rendered on. Required when using the GUEST_CHECKOUT_APPLE_PAY or GUEST_CHECKOUT_GOOGLE_PAY payment method and embedding the payment link in an iframe. Omit this field entirely for mobile iOS Apple Pay via WebView integration.

locale, string

Optional BCP-47 locale tag (e.g. es-ES, pt-BR, en) used to localize the hosted payment page. When provided, it is appended to the returned paymentLink URL and mapped to the closest locale supported by the Apple Pay and Google Pay buttons; unsupported locales fall back to the user's browser language. Any well-formed BCP-47 tag is accepted.

userAuthToken, string

Optional. A reusable token returned by a previous verified order. When provided, a returning user checking out to the same wallet is taken straight to the pay button, skipping OTP (best-effort — an invalid, expired, or different-wallet token still requires verification).

Example request

{
  "agreementAcceptedAt": "2025-04-24T00:00:00Z",
  "destinationAddress": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
  "destinationNetwork": "base",
  "email": "test@example.com",
  "partnerOrderRef": "order-1234",
  "partnerUserRef": "user-1234",
  "paymentAmount": "100.00",
  "paymentCurrency": "USD",
  "paymentMethod": "GUEST_CHECKOUT_APPLE_PAY",
  "phoneNumber": "+12055555555",
  "phoneNumberVerifiedAt": "2025-04-24T00:00:00Z",
  "smsVerificationId": "onramp_verification_a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "emailVerificationId": "onramp_verification_a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "purchaseAmount": "10.000000",
  "purchaseCurrency": "USDC",
  "clientIp": "127.0.0.1",
  "domain": "pay.coinbase.com",
  "locale": "es-ES",
  "userAuthToken": "eyJ2ZXJpZmljYXRpb25JZHMiOlsidl9hYmMxMjMiLCJ2X2RlZjQ1NiJdfQ=="
}

Response

Successfully created an onramp order.

object required
order, OnrampOrder required

An Onramp order.

paymentLink, OnrampPaymentLink

A payment link to pay for an order.

Please refer to the Onramp docs for details on how to integrate with the different payment link types.

userAuthToken, string

Present for embedded orders once the user has verified. Store this and pass it on future orders for the same user to skip OTP verification. Valid for 60 days.

Example response

{
  "order": {
    "orderId": "123e4567-e89b-12d3-a456-426614174000",
    "paymentTotal": "100.75",
    "paymentSubtotal": "100",
    "paymentCurrency": "USD",
    "paymentMethod": "GUEST_CHECKOUT_APPLE_PAY",
    "purchaseAmount": "100.000000",
    "purchaseCurrency": "USDC",
    "fees": [
      {
        "type": "FEE_TYPE_EXCHANGE",
        "amount": "0.5",
        "currency": "USD"
      },
      {
        "type": "FEE_TYPE_NETWORK",
        "amount": "0.25",
        "currency": "USD"
      }
    ],
    "exchangeRate": "1",
    "destinationAddress": "0x71C7656EC7ab88b098defB751B7401B5f6d8976F",
    "destinationNetwork": "base",
    "status": "ONRAMP_ORDER_STATUS_COMPLETED",
    "txHash": "0x363cd3b3d4f49497cf5076150cd709307b90e9fc897fdd623546ea7b9313cecb",
    "createdAt": "2025-04-24T00:00:00Z",
    "updatedAt": "2025-04-24T00:00:00Z",
    "partnerUserRef": "user123",
    "partnerId": "1f1c19e8-d0e9-6443-b706-92a4d033d043"
  },
  "paymentLink": {
    "url": "https://pay.coinbase.com/v2/api-onramp/apple-pay?sessionToken=MWYwNWQwODktZTZlYy02OTdlLTgzZTYtMTI3NzcyOWJhNjM3",
    "paymentLinkType": "PAYMENT_LINK_TYPE_APPLE_PAY_BUTTON"
  },
  "userAuthToken": "eyJ2ZXJpZmljYXRpb25JZHMiOlsidl9hYmMxMjMiLCJ2X2RlZjQ1NiJdfQ=="
}

Changes

    • warning

      added the new policy_not_applicable enum value to the errorType response property for the response status

    • warning

      added the new policy_not_applicable enum value to the errorType response property for the response status

    • warning

      added the new policy_not_applicable enum value to the errorType response property for the response status

    2 more changes in this revision