amzn / selling-partner-api-models

This repository contains OpenAPI models for developers to use when developing software to call Selling Partner APIs.
Apache License 2.0
612 stars 739 forks source link

Inbound Plan Instantly Voided #4207

Closed manikandan26 closed 3 weeks ago

manikandan26 commented 1 month ago

Problem description:

When creating a InboundPlan, I will get the below response without an error
{"operationId":"b606ce09-52be-4079-991f-XXXXXX","inboundPlanId":"wfdcade68d-9449-428a-9879-XXXXXX"}

But this plan will get VOIDED immediately when checking getInboundPlan ( [status] => VOIDED)

Error:

This is the output of getInboundPlan API

Array
(
    [createdAt] => 2024-09-30T10:47:08Z
    [marketplaceIds] => Array
        (
            [0] => APJ6JRA9NG5V4
        )

    [packingOptions] => Array
        (
        )

    [sourceAddress] => Array
        (
            [phoneNumber] => +xxxxxxx
            [city] => Wommelgem
            [countryCode] => BE
            [postalCode] => 2160
            [companyName] => XXXXXXXX
            [name] => XXXXXXXXXXXX
            [addressLine1] => Nijverheidsstraat
        )

    [lastUpdatedAt] => 2024-09-30T10:47:14Z
    [name] => Inbound Plan V2 
    [inboundPlanId] => wfdcade68d-9449-428a-9879-XXXXXX
    [placementOptions] => Array
        (
        )

    [shipments] => Array
        (
        )

    [status] => VOIDED
)

Code

This is the input of createInboundPlan API

 <?php  
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

use SellingPartnerApi\SellingPartnerApi;
use SellingPartnerApi\Enums\Endpoint;
use Saloon\Http\Response;
use Saloon\Http\PendingRequest;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
use SellingPartnerApi\Seller\FBAInboundV20240320\Dto;      

require_once(__DIR__ . '/vendor/autoload.php');

$connector = SellingPartnerApi::seller(
    clientId: "amzn1.application-oa2-client.XXXXXXXXXXXXXXXXX",
    clientSecret: "amzn1.oa2-cs.v1.XXXXXXXXXXXXXXXXX",
    refreshToken: "Atzr|IwEBIDBG01Oerdyt2ShWLV9jh0SGVP5hg0i0IOnRs_XXXXXXXXXXXXXXXXX",
    endpoint:  Endpoint::EU
);

    $inboundApi = $connector->FBAInboundV20240320();
try {
    // Step 1: Create an inbound plan
    $shipFromAddress = new Dto\AddressInput(
    addressLine1: "Nijverheidsstraat",
    addressLine2: null,
    city: "Wommelgem",
    companyName: "XXXXXXXXXXXXXXXXX",
    countryCode: "BE",
    email: null, 
    name: "XXXXXXXXXXXXXXXXX",     
    phoneNumber: "XXXXXXXXXXXXXXXXX",
    postalCode: "2160",
    stateOrProvinceCode: null
     );

    // Define the items
    $items = [];

    $item1 = new Dto\ItemInput('SELLER','101999', 'NONE', 2); 
    $items[] = $item1;

    $item2 = new Dto\ItemInput('SELLER','10259','NONE', 5); 
    $items[] = $item2;

    $item3 = new Dto\ItemInput('SELLER','102690', 'NONE', 2);
    $items[] = $item3;

    // Set the items in the request

     $requestParams = new Dto\CreateInboundPlanRequest(
        ['APJ6JRA9NG5V4'],          // destinationMarketplaces IT
        $items,                      // items (now correctly passed as an array)
        $shipFromAddress,            // sourceAddress
        'Inbound Plan V2'       // name (optional)
    );

    $response = $inboundApi->createInboundPlan($requestParams);

    echo "<pre>";
    print_r($response->body());
    echo "</pre>";

} catch (Exception $e) {
    // Handle exceptions
     echo 'Error: ' . $e;
}

?>
maxim-saltanov-skuvault commented 1 month ago

@manikandan26 seems your InboundPlan wasn't created for some reason (due an error or the creation is in progress). You need to check the operation status to see the status and reason - https://developer-docs.amazon.com/sp-api/docs/fulfillment-inbound-api-v2024-03-20-reference#getinboundoperationstatus

Prez5er commented 1 month ago

I have the same issue but I identified that the capacity storage limit was exceeded, the v0 shows the right error, but the v2024-03-20 shows a generic error. so this error made avoided instantly the inbound plan

mafge commented 1 month ago

Hi @manikandan26, thanks for reaching out! As @maxim-saltanov-skuvault mentioned, you need to check the status of the operation as creating the inbound plan is an asynchronous operation. In most cases you will get a error message in the response giving you details about the error. Best, Marc Selling Partner Developer Services

github-actions[bot] commented 3 weeks ago

closed for inactivity