Skip to content

Latest commit

 

History

History
264 lines (193 loc) · 15.4 KB

File metadata and controls

264 lines (193 loc) · 15.4 KB

PaymentLinks

Overview

Available Operations

  • create - Add a payment link
  • list - List all payment links
  • expire - Expire a payment link
  • get - Get payment link

create

Create a new payment link.

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use Gr4vy;

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

$paymentLinkCreate = new Gr4vy\PaymentLinkCreate(
    amount: 1299,
    country: 'DE',
    currency: 'EUR',
    store: true,
);

$response = $sdk->paymentLinks->create(
    paymentLinkCreate: $paymentLinkCreate
);

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

Parameters

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

Response

?AddPaymentLinkResponse

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

list

List all created payment links.

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use Gr4vy;

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



$responses = $sdk->paymentLinks->list(
    limit: 20
);


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

Parameters

Parameter Type Required Description Example
cursor ?string A pointer to the page of results to return. ZXhhbXBsZTE
limit ?int The maximum number of items that are returned. 20
buyerSearch array<string> Filters the results to only get the items for which some of the buyer data contains exactly the provided buyer_search values. [
"John",
"London"
]
merchantAccountId ?string The ID of the merchant account to use for this request. default

Response

?ListPaymentLinksResponse

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

expire

Expire an existing payment link.

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->paymentLinks->expire(
    paymentLinkId: 'a1b2c3d4-5678-90ab-cdef-1234567890ab'
);

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

Parameters

Parameter Type Required Description Example
paymentLinkId string ✔️ The unique identifier for the payment link. a1b2c3d4-5678-90ab-cdef-1234567890ab
merchantAccountId ?string The ID of the merchant account to use for this request. default

Response

?ExpirePaymentLinkResponse

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

Fetch the details for a payment link.

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->paymentLinks->get(
    paymentLinkId: 'a1b2c3d4-5678-90ab-cdef-1234567890ab'
);

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

Parameters

Parameter Type Required Description Example
paymentLinkId string ✔️ The unique identifier for the payment link. a1b2c3d4-5678-90ab-cdef-1234567890ab
merchantAccountId ?string The ID of the merchant account to use for this request. default

Response

?GetPaymentLinkResponse

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