Skip to content

Latest commit

 

History

History
480 lines (358 loc) · 23.7 KB

File metadata and controls

480 lines (358 loc) · 23.7 KB

PaymentServices

Overview

Available Operations

  • list - List payment services
  • create - Configure a payment service
  • get - Get payment service
  • update - Update a configured payment service
  • delete - Delete a configured payment service
  • verify - Verify payment service credentials
  • session - Create a session for a payment service definition

list

List the configured payment services.

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\ListPaymentServicesRequest(
    method: 'card',
    cursor: 'ZXhhbXBsZTE',
    deleted: true,
);

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


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

Parameters

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

Response

?ListPaymentServicesResponse

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

Configures a new payment service for use by merchants.

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use Gr4vy;

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

$paymentServiceCreate = new Gr4vy\PaymentServiceCreate(
    displayName: 'Stripe',
    paymentServiceDefinitionId: 'stripe-card',
    fields: [
        new Gr4vy\Field(
            key: 'api_key',
            value: 'key-12345',
        ),
    ],
    acceptedCurrencies: [
        'USD',
        'EUR',
        'GBP',
    ],
    acceptedCountries: [
        'US',
        'DE',
        'GB',
    ],
    threeDSecureEnabled: true,
    settlementReportingEnabled: true,
);

$response = $sdk->paymentServices->create(
    paymentServiceCreate: $paymentServiceCreate
);

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

Parameters

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

Response

?CreatePaymentServiceResponse

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

Get the details of a configured payment service.

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->paymentServices->get(
    paymentServiceId: 'fffd152a-9532-4087-9a4f-de58754210f0'
);

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

Parameters

Parameter Type Required Description Example
paymentServiceId string ✔️ the ID of the payment service fffd152a-9532-4087-9a4f-de58754210f0
merchantAccountId ?string The ID of the merchant account to use for this request. default

Response

?GetPaymentServiceResponse

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 the configuration of a payment service.

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use Gr4vy;

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

$paymentServiceUpdate = new Gr4vy\PaymentServiceUpdate(
    settlementReportingEnabled: true,
);

$response = $sdk->paymentServices->update(
    paymentServiceId: 'fffd152a-9532-4087-9a4f-de58754210f0',
    paymentServiceUpdate: $paymentServiceUpdate

);

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

Parameters

Parameter Type Required Description Example
paymentServiceId string ✔️ the ID of the payment service fffd152a-9532-4087-9a4f-de58754210f0
paymentServiceUpdate PaymentServiceUpdate ✔️ N/A
merchantAccountId ?string The ID of the merchant account to use for this request. default

Response

?UpdatePaymentServiceResponse

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

Deletes all the configuration of a payment service.

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->paymentServices->delete(
    paymentServiceId: 'fffd152a-9532-4087-9a4f-de58754210f0'
);

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

Parameters

Parameter Type Required Description Example
paymentServiceId string ✔️ the ID of the payment service fffd152a-9532-4087-9a4f-de58754210f0
merchantAccountId ?string The ID of the merchant account to use for this request. default

Response

?DeletePaymentServiceResponse

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 */*

verify

Verify the credentials of a configured payment service

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use Gr4vy;

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

$verifyCredentials = new Gr4vy\VerifyCredentials(
    paymentServiceDefinitionId: 'stripe-card',
    fields: [],
);

$response = $sdk->paymentServices->verify(
    verifyCredentials: $verifyCredentials
);

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

Parameters

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

Response

?VerifyPaymentServiceCredentialsResponse

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 */*

session

Creates a session for a payment service that supports sessions.

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->paymentServices->session(
    paymentServiceId: 'fffd152a-9532-4087-9a4f-de58754210f0',
    requestBody: [

    ]

);

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

Parameters

Parameter Type Required Description Example
paymentServiceId string ✔️ the ID of the payment service fffd152a-9532-4087-9a4f-de58754210f0
requestBody array<string, mixed> ✔️ N/A
merchantAccountId ?string The ID of the merchant account to use for this request. default

Response

?CreatePaymentServiceSessionResponse

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 */*