const axios = require('axios'); const fs = require('fs'); async function createPaymentLink() { // Read file and remove BOM if present let jsonContent = fs.readFileSync('c:/laragon/www/core-midtrans-cifo/tmp-createtransaksi.json', 'utf8'); // Remove BOM if (jsonContent.charCodeAt(0) === 0xFEFF) { jsonContent = jsonContent.slice(1); } const payload = JSON.parse(jsonContent); try { console.log('Creating payment link...'); console.log('Payload:', JSON.stringify(payload, null, 2)); const response = await axios.post('http://localhost:8000/createtransaksi', payload, { headers: { 'Content-Type': 'application/json', 'X-API-KEY': 'dev-key' } }); console.log('\nāœ“ Success!'); console.log('Response:', JSON.stringify(response.data, null, 2)); console.log('\nšŸ”— Payment URL:', response.data.data.url); } catch (error) { console.log('āœ— Error:', error.response?.status, error.response?.data); console.log('Full error:', error.message); } } createPaymentLink();