Skip to content
This repository has been archived by the owner on Feb 25, 2020. It is now read-only.

how to use this source process order? #63

Closed
juragandotid opened this issue Jul 4, 2018 · 1 comment
Closed

how to use this source process order? #63

juragandotid opened this issue Jul 4, 2018 · 1 comment

Comments

@juragandotid
Copy link

can u give me an example step to make order using this source?

search product -> getproductID -> checkout product -> guestcheckout -> payment -> suceess or failed.

@juragandotid
Copy link
Author

this is my script for first initiate checkout session :

`<?php

/**

  • Copyright 2016 David T. Sadler
  • Licensed under the Apache License, Version 2.0 (the "License");
  • you may not use this file except in compliance with the License.
  • You may obtain a copy of the License at
  • http://www.apache.org/licenses/LICENSE-2.0
  • Unless required by applicable law or agreed to in writing, software
  • distributed under the License is distributed on an "AS IS" BASIS,
  • WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  • See the License for the specific language governing permissions and
  • limitations under the License.
    */

/**

  • Include the SDK by using the autoloader from Composer.
    */
    require_once'vendor/autoload.php';

/**

  • Include the configuration values.
  • Ensure that you have edited the configuration.php file
  • to include your application keys.
    */
    $config = require_once 'config.php';

/**

  • The namespaces provided by the SDK.
    */
    use \DTS\eBaySDK\Order\Services;
    use \DTS\eBaySDK\Order\Types;
    use \DTS\eBaySDK\Order\Enums;

$service = new Services\OrderService([
'credentials' => $config['production']['credentials']
]);

/**

  • Create the request object.
    */
    $request = new Types\InitiateGuestCheckoutSessionRestRequest();

$request->contactEmail = 'nike.yogesh@gmail.com';
$request->contactFirstName = 'Yogesh';
$request->contactLastName = 'Naik';
$request->shippingAddress->recipient = 'Yogesh Naik';
$request->shippingAddress->phoneNumber = '617 817 7449 ';
$request->shippingAddress->addressLine1 = '600 Epic Way #566';
$request->shippingAddress->city = 'San Jose';
$request->shippingAddress->stateOrProvince = 'CA';
$request->shippingAddress->postalCode = '95134';
$request->shippingAddress->country = 'US';
$request->lineItemInputs->quantity = '1';
$request->lineItemInputs->itemId = 'v1|330008507440|0';

$response = $service->initiateGuestCheckoutSession($request);

/**

  • Output the result of calling the service operation.
    */
    if (isset($response->Errors)) {
    foreach ($response->Errors as $error) {
    printf(
    "%s: %s\n%s\n\n",
    $error->SeverityCode === Enums\SeverityCodeType::C_ERROR ? 'Error' : 'Warning',
    $error->ShortMessage,
    $error->LongMessage
    );
    }
    }

if ($response->Ack !== 'Failure') {

$SessionId = $response->checkoutSessionId;
print($SessionId);

}`

and i got this error respon :

`PHP Fatal error: Uncaught InvalidArgumentException: Missing required configuration options:

authorization in F:\ebay\vendor\dts\ebay-sdk-php\src\ConfigurationResolver.php:145
Stack trace:
#0 F:\ebay\vendor\dts\ebay-sdk-php\src\ConfigurationResolver.php(52): DTS\eBaySDK\ConfigurationResolver->throwRequired(Array)
#1 F:\ebay\vendor\dts\ebay-sdk-php\src\Services\BaseRestService.php(53): DTS\eBaySDK\ConfigurationResolver->resolve(Array)
#2 F:\ebay\vendor\dts\ebay-sdk-php\src\Order\Services\OrderBaseService.php(37): DTS\eBaySDK\Services\BaseRestService->__construct(Array)
#3 F:\ebay\vendor\dts\ebay-sdk-php\src\Order\Services\OrderService.php(196): DTS\eBaySDK\Order\Services\OrderBaseService->__construct(Array)
#4 F:\ebay\initiateGuestCheckoutSession.php(40): DTS\eBaySDK\Order\Services\OrderService->__construct(Array)
#5 {main}
thrown in F:\ebay\vendor\dts\ebay-sdk-php\src\ConfigurationResolver.php on line 145

Fatal error: Uncaught InvalidArgumentException: Missing required configuration options:

authorization in F:\ebay\vendor\dts\ebay-sdk-php\src\ConfigurationResolver.php:145
Stack trace:
#0 F:\ebay\vendor\dts\ebay-sdk-php\src\ConfigurationResolver.php(52): DTS\eBaySDK\ConfigurationResolver->throwRequired(Array)
#1 F:\ebay\vendor\dts\ebay-sdk-php\src\Services\BaseRestService.php(53): DTS\eBaySDK\ConfigurationResolver->resolve(Array)
#2 F:\ebay\vendor\dts\ebay-sdk-php\src\Order\Services\OrderBaseService.php(37): DTS\eBaySDK\Services\BaseRestService->__construct(Array)
#3 F:\ebay\vendor\dts\ebay-sdk-php\src\Order\Services\OrderService.php(196): DTS\eBaySDK\Order\Services\OrderBaseService->__construct(Array)
#4 F:\ebay\initiateGuestCheckoutSession.php(40): DTS\eBaySDK\Order\Services\OrderService->__construct(Array)
#5 {main}
thrown in F:\ebay\vendor\dts\ebay-sdk-php\src\ConfigurationResolver.php on line 145`

Thank you.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants