Testing

This guide covers how to test your Bedrock integration.

Test Environment

Bedrock provides testnet support for development and testing.

Testnet Chains

Chain
Chain ID
Faucet

Base Sepolia

84532

Optimism Sepolia

11155420

Arbitrum Sepolia

421614

Getting Testnet USDC

  1. Get testnet ETH from a faucet

  2. Use a testnet USDC faucet or mint function

  3. For Base Sepolia USDC: 0x036CbD53842c5426634e7929541eC2318f3dCF7e

Testing Workflow

1. Create a Test Charge

curl -X POST https://api.bedrock.io/v1/charges \
  -H "X-API-Key: sk_test_your_test_key" \
  -H "Content-Type: application/json" \
  -d '{
    "orderId": "test-order-001",
    "amount": "1.00"
  }'

2. Open Payment Page

Visit the paymentUrl in your browser.

3. Select a Testnet Chain

Choose Base Sepolia or another testnet.

4. Send Test USDC

Connect a wallet with testnet USDC and complete the payment.

5. Verify Webhook

Check that your webhook endpoint received the charge.completed event.

Testing Webhooks Locally

Use ngrok to expose your local server:

Then configure the ngrok URL as your webhook URL in Bedrock Settings.

Mock Webhook Events

For unit testing, you can mock webhook payloads:

Testing Signature Verification

Generate test signatures:

Checklist

Before going to production:

Common Issues

Webhook not received

  1. Check webhook URL is correct in Settings

  2. Verify URL is publicly accessible

  3. Check your server logs for errors

  4. Ensure you're returning 200 status

Signature verification failing

  1. Use the raw request body, not parsed JSON

  2. Check you're using the correct webhook secret

  3. Ensure no middleware is modifying the body

Payment not detected

  1. Verify you sent to the correct clone address

  2. Check you're on the correct chain

  3. Ensure you sent USDC (not ETH)

  4. Wait a few seconds for blockchain confirmation

Last updated