phpeasypost

Unable to refund EasyPost test shipments


I am working on a shipping application using EasyPost, and I am at the point where I need to test refunding shipment orders.

Before I started on building an implementation in my application, I wanted to test refunding the shipments via the EasyPost Test Mode dashboard. I made sure to set the tracking code of a given shipment to one of the EasyPost test codes (although I'm not sure if I'm doing that right; see below) but even when the shipment is in pre-transit and click the 'refund' button and a message says my refund request was submitted, the shipments never refund and are always delivered.

// Using PHP 7.4.6
// There must be a better way to do this, but for some reason
// I couldn't find one in the documentation
$shipment->tracking_code = 'EZ1000000001';
$shipment->tracker->tracking_code = 'EZ1000000001';

I don't know if I'm setting the tracking code incorrectly and that is messing up my later attempts at refunds, or if the shipments are being 'delivered' too quickly for the refund requests to go through, but I've finally run out of other options and had to resort to Stack Overflow.

If anyone needs more information, I would be happy to provide, but I can't think of what else to add at the moment.


Solution

  • Feel free to hit us up at support@easypost.com for any future questions. We have a dedicated US-based support team that is trained to review and answer common coding questions.

    It is true that our test environment quickly sets a shipment status to "in_transit" and then "delivered" soon after the test shipment is created. This means a test shipment cannot be refunded successfully unless you immediately refund that test shipment right after it is created and while the shipment status is still "pre_transit".

    I can assure you that refund functionality works as expected in our production environment. But I understand the desire to be able to test out the functionality beforehand. I'll submit a recommendation to our product team to review.

    Thanks, Logan Simonsen EasyPost API Support Team Lead