Create Coinbase onramp URL
Creates a Coinbase Onramp buy URL and optionally returns a session token for reuse.
POST
/onramp/coinbase/onramp-url
Creates a Coinbase Onramp buy URL and optionally returns a session token for reuse.
Request Body required
application/jsonpresetFiatAmount
string
REQUIRED
Preset fiat amount for purchase
fiatCurrency
string
REQUIRED
Fiat currency code
defaultAsset
string
REQUIRED
Default asset to purchase
defaultPaymentMethod
string
REQUIRED
Default payment method identifier
destinationAddress
string
REQUIRED
Destination wallet address
blockchains
string[]
REQUIRED
Supported blockchains for the session
Array of:
country
string
REQUIRED
ISO country code of the end user
orderId
string
REQUIRED
Associated AnySpend order ID
redirectUrl
string
REQUIRED
Redirect URL after completing the purchase
useSessionToken
boolean
Whether to create and embed a session token automatically
Responses
200
Onramp URL created successfully
application/jsonsuccess
boolean
REQUIRED
message
string
REQUIRED
data
object
REQUIRED
Coinbase onramp URL result
url
string
REQUIRED
Coinbase-hosted onramp URL
sessionToken
string
Optional session token created alongside the URL
statusCode
number
REQUIRED
400
Bad request
curl -X POST 'https://mainnet.anyspend.com/onramp/coinbase/onramp-url' \
-H 'Content-Type: application/json' \
-d '{
"presetFiatAmount": "100",
"fiatCurrency": "USD",
"defaultAsset": "USDC",
"defaultPaymentMethod": "CARD",
"destinationAddress": "0x58241893EF1f86C9fBd8109Cd44Ea961fDb474e1",
"blockchains": [
"base"
],
"country": "US",
"orderId": "5392f7a7-d472-4d6b-9848-bd07117fb82d",
"redirectUrl": "https://www.anyspend.com/orders",
"useSessionToken": false
}'
const response = await fetch('https://mainnet.anyspend.com/onramp/coinbase/onramp-url', {
method: 'POST',
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
"presetFiatAmount": "100",
"fiatCurrency": "USD",
"defaultAsset": "USDC",
"defaultPaymentMethod": "CARD",
"destinationAddress": "0x58241893EF1f86C9fBd8109Cd44Ea961fDb474e1",
"blockchains": [
"base"
],
"country": "US",
"orderId": "5392f7a7-d472-4d6b-9848-bd07117fb82d",
"redirectUrl": "https://www.anyspend.com/orders",
"useSessionToken": false
})
});
const data = await response.json();
console.log(data);
import requests
response = requests.post('https://mainnet.anyspend.com/onramp/coinbase/onramp-url', json={
"presetFiatAmount": "100",
"fiatCurrency": "USD",
"defaultAsset": "USDC",
"defaultPaymentMethod": "CARD",
"destinationAddress": "0x58241893EF1f86C9fBd8109Cd44Ea961fDb474e1",
"blockchains": [
"base"
],
"country": "US",
"orderId": "5392f7a7-d472-4d6b-9848-bd07117fb82d",
"redirectUrl": "https://www.anyspend.com/orders",
"useSessionToken": false
})
print(response.json())
200
Response
{
"success": true,
"message": "Onramp URL created successfully",
"data": {
"url": "https://pay.coinbase.com/buy/select-asset?... ",
"sessionToken": "token_123"
},
"statusCode": 200
}
POST
/onramp/coinbase/onramp-url