hardHallucinated APIsStripe API
The fake endpoint
A developer asked an AI assistant to refund half of a Stripe charge programmatically. The suggested code calls a method that looks like it belongs to the Stripe Node SDK, but throws the instant it's invoked in a live billing job.
refunds.js
const stripe = require('stripe')(process.env.STRIPE_SECRET_KEY);
async function partialRefund(chargeId, amountCents) {
return stripe.charges.partialRefund(chargeId, {
amount: amountCents,
});
}What's wrong with this Stripe integration?
stripe.charges.partialRefund does not exist — partial refunds use the general refunds.create method with an amount field.
amountCents should be passed as a string, not a number, per the Stripe API.
chargeId must be prefixed with 'pi_' instead of 'ch_'.
process.env.STRIPE_SECRET_KEY is undefined at import time.