Skip to content

Latest commit

 

History

History
325 lines (238 loc) · 15.6 KB

File metadata and controls

325 lines (238 loc) · 15.6 KB

Buyers

Overview

Available Operations

list

List all buyers or search for a specific buyer.

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use Gr4vy;

$sdk = Gr4vy\SDK::builder()
    ->setMerchantAccountId('default')
    ->setSecurity(
        '<YOUR_BEARER_TOKEN_HERE>'
    )
    ->build();

$request = new Gr4vy\ListBuyersRequest(
    cursor: 'ZXhhbXBsZTE',
    search: 'John',
    externalIdentifier: 'buyer-12345',
);

$responses = $sdk->buyers->list(
    request: $request
);


foreach ($responses as $response) {
    if ($response->statusCode === 200) {
        // handle response
    }
}

Parameters

Parameter Type Required Description
$request Gr4vy\ListBuyersRequest ✔️ The request object to use for the request.

Response

?ListBuyersResponse

Errors

Error Type Status Code Content Type
Errors\Error400 400 application/json
Errors\Error401 401 application/json
Errors\Error403 403 application/json
Errors\Error404 404 application/json
Errors\Error405 405 application/json
Errors\Error409 409 application/json
Errors\HTTPValidationError 422 application/json
Errors\Error425 425 application/json
Errors\Error429 429 application/json
Errors\Error500 500 application/json
Errors\Error502 502 application/json
Errors\Error504 504 application/json
errors\APIException 4XX, 5XX */*

create

Create a new buyer record.

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use Gr4vy;

$sdk = Gr4vy\SDK::builder()
    ->setMerchantAccountId('default')
    ->setSecurity(
        '<YOUR_BEARER_TOKEN_HERE>'
    )
    ->build();

$buyerCreate = new Gr4vy\BuyerCreate();

$response = $sdk->buyers->create(
    buyerCreate: $buyerCreate
);

if ($response->buyer !== null) {
    // handle response
}

Parameters

Parameter Type Required Description Example
buyerCreate BuyerCreate ✔️ N/A
merchantAccountId ?string The ID of the merchant account to use for this request. default

Response

?AddBuyerResponse

Errors

Error Type Status Code Content Type
Errors\Error400 400 application/json
Errors\Error401 401 application/json
Errors\Error403 403 application/json
Errors\Error404 404 application/json
Errors\Error405 405 application/json
Errors\Error409 409 application/json
Errors\HTTPValidationError 422 application/json
Errors\Error425 425 application/json
Errors\Error429 429 application/json
Errors\Error500 500 application/json
Errors\Error502 502 application/json
Errors\Error504 504 application/json
errors\APIException 4XX, 5XX */*

get

Fetches a buyer by its ID.

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use Gr4vy;

$sdk = Gr4vy\SDK::builder()
    ->setMerchantAccountId('default')
    ->setSecurity(
        '<YOUR_BEARER_TOKEN_HERE>'
    )
    ->build();



$response = $sdk->buyers->get(
    buyerId: 'fe26475d-ec3e-4884-9553-f7356683f7f9'
);

if ($response->buyer !== null) {
    // handle response
}

Parameters

Parameter Type Required Description Example
buyerId string ✔️ The ID of the buyer to retrieve. fe26475d-ec3e-4884-9553-f7356683f7f9
merchantAccountId ?string The ID of the merchant account to use for this request. default

Response

?GetBuyerResponse

Errors

Error Type Status Code Content Type
Errors\Error400 400 application/json
Errors\Error401 401 application/json
Errors\Error403 403 application/json
Errors\Error404 404 application/json
Errors\Error405 405 application/json
Errors\Error409 409 application/json
Errors\HTTPValidationError 422 application/json
Errors\Error425 425 application/json
Errors\Error429 429 application/json
Errors\Error500 500 application/json
Errors\Error502 502 application/json
Errors\Error504 504 application/json
errors\APIException 4XX, 5XX */*

update

Updates a buyer record.

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use Gr4vy;

$sdk = Gr4vy\SDK::builder()
    ->setMerchantAccountId('default')
    ->setSecurity(
        '<YOUR_BEARER_TOKEN_HERE>'
    )
    ->build();

$buyerUpdate = new Gr4vy\BuyerUpdate();

$response = $sdk->buyers->update(
    buyerId: 'fe26475d-ec3e-4884-9553-f7356683f7f9',
    buyerUpdate: $buyerUpdate

);

if ($response->buyer !== null) {
    // handle response
}

Parameters

Parameter Type Required Description Example
buyerId string ✔️ The ID of the buyer to edit. fe26475d-ec3e-4884-9553-f7356683f7f9
buyerUpdate BuyerUpdate ✔️ N/A
merchantAccountId ?string The ID of the merchant account to use for this request. default

Response

?UpdateBuyerResponse

Errors

Error Type Status Code Content Type
Errors\Error400 400 application/json
Errors\Error401 401 application/json
Errors\Error403 403 application/json
Errors\Error404 404 application/json
Errors\Error405 405 application/json
Errors\Error409 409 application/json
Errors\HTTPValidationError 422 application/json
Errors\Error425 425 application/json
Errors\Error429 429 application/json
Errors\Error500 500 application/json
Errors\Error502 502 application/json
Errors\Error504 504 application/json
errors\APIException 4XX, 5XX */*

delete

Permanently removes a buyer record.

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use Gr4vy;

$sdk = Gr4vy\SDK::builder()
    ->setMerchantAccountId('default')
    ->setSecurity(
        '<YOUR_BEARER_TOKEN_HERE>'
    )
    ->build();



$response = $sdk->buyers->delete(
    buyerId: 'fe26475d-ec3e-4884-9553-f7356683f7f9'
);

if ($response->statusCode === 200) {
    // handle response
}

Parameters

Parameter Type Required Description Example
buyerId string ✔️ The ID of the buyer to delete. fe26475d-ec3e-4884-9553-f7356683f7f9
merchantAccountId ?string The ID of the merchant account to use for this request. default

Response

?DeleteBuyerResponse

Errors

Error Type Status Code Content Type
Errors\Error400 400 application/json
Errors\Error401 401 application/json
Errors\Error403 403 application/json
Errors\Error404 404 application/json
Errors\Error405 405 application/json
Errors\Error409 409 application/json
Errors\HTTPValidationError 422 application/json
Errors\Error425 425 application/json
Errors\Error429 429 application/json
Errors\Error500 500 application/json
Errors\Error502 502 application/json
Errors\Error504 504 application/json
errors\APIException 4XX, 5XX */*