Documentation Index
Fetch the complete documentation index at: https://docs.dynamic.xyz/docs/llms.txt
Use this file to discover all available pages before exploring further.
This guide covers Coinbase’s Apple Pay Guest Checkout for purchases under $500 without KYC. For the default Coinbase onramp experience with full features, see Default Onramps and Customizing the Onramp Experience.
This guide is for JavaScript only.
Overview
Coinbase onramp integration allows users to purchase cryptocurrency directly within your application using Coinbase’s payment infrastructure. This integration supports Apple Pay Guest Checkout, enabling US users without a Coinbase account to deposit up to $500 per week.Dashboard setup
To enable Coinbase onramp:- Go to the Funding tab in your Dynamic developer dashboard
- Under “Fiat on-ramps”, toggle on Coinbase
- Accept any additional terms and conditions
- Save the settings
Coinbase-specific functions
The following functions are specific to Coinbase onramp and provide advanced control over the onramp flow.createCoinbaseOnrampOrder
Creates a Coinbase onramp order programmatically. This function is useful when you want full control over the order creation process, such as for Apple Pay Guest Checkout.See Coinbase’s create an onramp order documentation for reference.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
agreementAcceptedAt | Date | Yes | Timestamp when user accepted Coinbase Terms, User Agreement, and Privacy Policy |
destinationAddress | string | Yes | Wallet address where purchased crypto will be sent |
destinationNetwork | string | Yes | Network name (e.g., “base”, “ethereum”) |
paymentCurrency | string | Yes | Fiat currency code (e.g., “USD”) |
paymentMethod | string | Yes | Payment method type (e.g., “GUEST_CHECKOUT_APPLE_PAY”) |
purchaseCurrency | string | Yes | Crypto ticker or Coinbase UUID (e.g., “USDC”, “ETH”) |
paymentAmount | string | No | Fiat amount to pay (inclusive of fees) |
purchaseAmount | string | No | Crypto amount to receive (exclusive of fees) |
isSandbox | boolean | No | Create a sandbox order for testing |
partnerUserRef | string | No | Unique user identifier for transaction linking |
domain | string | No | Domain for Apple Pay button rendering in iframes |
isQuote | boolean | No | Return a quote without creating a transaction |
Response
getMissingVerificationForCoinbaseOnrampOrder
Checks if the user has the required verified credentials (email and phone number) to create a Coinbase onramp order. This is useful for pre-validating users before attempting to create an order.Error codes
| Error Code | Description |
|---|---|
MISSING_INFORMATION | The data still needs to be collected from the user |
MISSING_VERIFICATION | The data has been collected but not verified |
VERIFICATION_EXPIRED | The data was verified but needs re-verification (phone numbers must be verified within the last 60 days) |
addCoinbaseOnrampOrderEventListener
Listens to Coinbase onramp order events to track when an order is canceled, confirmed, completed, or fails. Use this after triggering an order to provide real-time feedback to users.Event types
| Event Name | Description |
|---|---|
onramp_api.cancel | User canceled the order |
onramp_api.commit_success | Payment was authorized successfully, waiting for transaction to complete |
onramp_api.commit_error | Payment authorization failed |
onramp_api.polling_success | Transaction completed successfully |
onramp_api.polling_failed | Transaction failed after authorization |
Return value
The function returns a cleanup function that removes the event listener. Call this when you no longer need to listen for events (e.g., when the user closes the dialog or navigates away).Order status values
| Status | Description |
|---|---|
ONRAMP_ORDER_STATUS_CREATED | Order has been created |
ONRAMP_ORDER_STATUS_IN_PROGRESS | Order is being processed |
ONRAMP_ORDER_STATUS_COMPLETED | Order completed successfully |
ONRAMP_ORDER_STATUS_FAILED | Order failed |
ONRAMP_ORDER_STATUS_CANCELLED | Order was cancelled |
Testing in sandbox
To test Coinbase onramp without real transactions:- Set
isSandbox: truewhen creating orders - Or prefix your
partnerUserRefwith “sandbox-” (e.g., “sandbox-user-1234”)
&useApplePaySandbox=true.
Requirements
For Apple Pay Guest Checkout, users must have:- A verified email address
- A verified phone number (verified within the last 60 days)
getMissingVerificationForCoinbaseOnrampOrder to check these requirements before creating an order.
Collecting and verifying user credentials
Dynamic sends the phone number and email associated with the Dynamic user when creating an onramp order. You can use the following functions to collect and verify user credentials.Collecting email and phone number
UseupdateUser to store collected email or phone number in the user’s verified credentials. This function returns OTP verification details if verification is required.
Verifying with OTP
After updating user credentials, useverifyOTP to complete the verification process with the code sent to the user.
Re-verifying expired phone numbers
Coinbase requires phone numbers to be verified within the last 60 days. If a user’s phone verification has expired, usesendSmsOTP to trigger re-verification, then complete with verifyOTP.
Supported countries and payment methods
Coinbase onramp supports various countries and payment methods. The United States has the most comprehensive support, including Apple Pay for Guest Checkout. See the Customizing the Onramp Experience page for a complete list of supported countries and payment methods.Related
- Default Onramps - General onramp setup
- Customizing the Onramp Experience - Customize onramp options