const axios = require('axios');

async function testSnapToken() {
  const payload = {
    transaction_details: {
      order_id: 'test-order-123',
      gross_amount: 100000
    },
    customer_details: {
      first_name: 'Test User',
      email: 'test@example.com',
      phone: '08123456789'
    },
    item_details: [{
      id: 'test-order-123',
      name: 'Test Payment',
      price: 100000,
      quantity: 1
    }]
  };

  try {
    console.log('Testing Snap token creation...');
    console.log('Payload:', JSON.stringify(payload, null, 2));

    const response = await axios.post('http://localhost:8000/api/payments/snap/token', payload);
    console.log('Success:', response.data);
  } catch (error) {
    console.log('Error:', error.response?.status, error.response?.data);
    console.log('Full error:', error.message);
  }
}

testSnapToken();