Creates an instance of BaseService.
The SDK configuration options
Options for request retry behavior
Creates a new charge in the Coinbase Commerce platform
The charge creation parameters
A promise that resolves to the created charge
Retrieves a specific charge by ID from the Coinbase Commerce platform
The unique identifier of the charge to retrieve
A promise that resolves to the charge details
Retrieves a list of charges from the Coinbase Commerce platform
Optional
params: GetChargesParamsOptional parameters for the list request
A promise that resolves to a paginated list of charges
Hydrates an existing charge with Web3 data
The unique identifier of the charge to hydrate
The hydration parameters
A promise that resolves to the hydrated charge
Processes a payment for a charge using Web3
The payment parameters
A promise that resolves to the payment transaction details
const { data: charge } = await commerce.charges.hydrateCharge('charge_id', {
sender: walletClient.account.address,
chain_id: 1
});
const paymentResult = await commerce.charges.payCharge({
charge: charge.data,
walletClient,
currency: {
contractAddress: '0x...' // ERC20 token address
}
});
console.log(`Transaction submitted: ${paymentResult.transactionHash}`);
Service for managing Charges within the SDK Provides functionality for creating and configuring charges