https://github.com/localgovdrupal/govuk-pay-client-php
SwaggerClient-php for the GOV.UK Pay REST API
https://github.com/localgovdrupal/govuk-pay-client-php
Last synced: 5 months ago
JSON representation
SwaggerClient-php for the GOV.UK Pay REST API
- Host: GitHub
- URL: https://github.com/localgovdrupal/govuk-pay-client-php
- Owner: localgovdrupal
- Created: 2026-01-12T11:23:01.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2026-01-12T11:29:29.000Z (5 months ago)
- Last Synced: 2026-01-12T19:22:26.467Z (5 months ago)
- Language: PHP
- Size: 97.7 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# SwaggerClient-php
The GOV.UK Pay REST API. Read [our documentation](https://docs.payments.service.gov.uk/) for more details.
This PHP package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
- API version: 1.0.3
- Build package: io.swagger.codegen.v3.generators.php.PhpClientCodegen
## Requirements
PHP 5.5 and later
## Installation & Usage
### Composer
To install the bindings via [Composer](http://getcomposer.org/), add the following to `composer.json`:
```
{
"repositories": [
{
"type": "git",
"url": "https://github.com/git_user_id/git_repo_id.git"
}
],
"require": {
"git_user_id/git_repo_id": "*@dev"
}
}
```
Then run `composer install`
### Manual Installation
Download the files and include `autoload.php`:
```php
require_once('/path/to/SwaggerClient-php/vendor/autoload.php');
```
## Tests
To run the unit tests:
```
composer install
./vendor/bin/phpunit
```
## Getting Started
Please follow the [installation procedure](#installation--usage) and then run the following:
```php
cancelAnAgreement($agreement_id);
} catch (Exception $e) {
echo 'Exception when calling AgreementsApi->cancelAnAgreement: ', $e->getMessage(), PHP_EOL;
}
$apiInstance = new Swagger\Client\Api\AgreementsApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client(),
$config
);
$body = new \Swagger\Client\Model\CreateAgreementRequest(); // \Swagger\Client\Model\CreateAgreementRequest | requestPayload
try {
$result = $apiInstance->createAnAgreement($body);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling AgreementsApi->createAnAgreement: ', $e->getMessage(), PHP_EOL;
}
$apiInstance = new Swagger\Client\Api\AgreementsApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client(),
$config
);
$agreement_id = "agreement_id_example"; // string | Returns the agreement with the matching `agreement_id`. GOV.UK Pay generated an `agreement_id` when you created the agreement.
try {
$result = $apiInstance->getAnAgreement($agreement_id);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling AgreementsApi->getAnAgreement: ', $e->getMessage(), PHP_EOL;
}
$apiInstance = new Swagger\Client\Api\AgreementsApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client(),
$config
);
$reference = "reference_example"; // string | Returns agreements with a `reference` that exactly matches the value you sent. This parameter is not case sensitive. A `reference` was associated with the agreement when that agreement was created.
$status = "status_example"; // string | Returns agreements in a matching `status`. `status` reflects where an agreement is in its lifecycle. You can [read more about the meanings of the different agreement status values](https://docs.payments.service.gov.uk/recurring_payments/#understanding-agreement-status).
$page = "page_example"; // string | Returns a specific page of results. Defaults to `1`. You can [read about search pagination](https://docs.payments.service.gov.uk/api_reference/#pagination)
$display_size = "display_size_example"; // string | The number of agreements returned per results page. Defaults to `500`. Maximum value is `500`. You can [read about search pagination](https://docs.payments.service.gov.uk/api_reference/#pagination)
try {
$result = $apiInstance->searchAgreements($reference, $status, $page, $display_size);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling AgreementsApi->searchAgreements: ', $e->getMessage(), PHP_EOL;
}
?>
```
## Documentation for API Endpoints
All URIs are relative to *https://publicapi.payments.service.gov.uk*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*AgreementsApi* | [**cancelAnAgreement**](docs/Api/AgreementsApi.md#cancelanagreement) | **POST** /v1/agreements/{agreementId}/cancel | Cancel an agreement for recurring payments
*AgreementsApi* | [**createAnAgreement**](docs/Api/AgreementsApi.md#createanagreement) | **POST** /v1/agreements | Create an agreement for recurring payments
*AgreementsApi* | [**getAnAgreement**](docs/Api/AgreementsApi.md#getanagreement) | **GET** /v1/agreements/{agreementId} | Get information about a single agreement for recurring payments
*AgreementsApi* | [**searchAgreements**](docs/Api/AgreementsApi.md#searchagreements) | **GET** /v1/agreements | Search agreements for recurring payments
*AuthoriseCardPaymentsApi* | [**authoriseAMOTOPayment**](docs/Api/AuthoriseCardPaymentsApi.md#authoriseamotopayment) | **POST** /v1/auth | Send card details to authorise a MOTO payment
*CardPaymentsApi* | [**cancelAPayment**](docs/Api/CardPaymentsApi.md#cancelapayment) | **POST** /v1/payments/{paymentId}/cancel | Cancel payment
*CardPaymentsApi* | [**captureAPayment**](docs/Api/CardPaymentsApi.md#captureapayment) | **POST** /v1/payments/{paymentId}/capture | Take a delayed payment
*CardPaymentsApi* | [**createAPayment**](docs/Api/CardPaymentsApi.md#createapayment) | **POST** /v1/payments | Create a payment
*CardPaymentsApi* | [**getAPayment**](docs/Api/CardPaymentsApi.md#getapayment) | **GET** /v1/payments/{paymentId} | Get information about a single payment
*CardPaymentsApi* | [**getEventsForAPayment**](docs/Api/CardPaymentsApi.md#geteventsforapayment) | **GET** /v1/payments/{paymentId}/events | Get a payment's events
*CardPaymentsApi* | [**searchPayments**](docs/Api/CardPaymentsApi.md#searchpayments) | **GET** /v1/payments | Search payments
*DisputesApi* | [**searchDisputes**](docs/Api/DisputesApi.md#searchdisputes) | **GET** /v1/disputes | Search disputes
*RefundingCardPaymentsApi* | [**getAPaymentRefund**](docs/Api/RefundingCardPaymentsApi.md#getapaymentrefund) | **GET** /v1/payments/{paymentId}/refunds/{refundId} | Check the status of a refund
*RefundingCardPaymentsApi* | [**getAllRefundsForAPayment**](docs/Api/RefundingCardPaymentsApi.md#getallrefundsforapayment) | **GET** /v1/payments/{paymentId}/refunds | Get information about a payment’s refunds
*RefundingCardPaymentsApi* | [**searchRefunds**](docs/Api/RefundingCardPaymentsApi.md#searchrefunds) | **GET** /v1/refunds | Search refunds
*RefundingCardPaymentsApi* | [**submitARefundForAPayment**](docs/Api/RefundingCardPaymentsApi.md#submitarefundforapayment) | **POST** /v1/payments/{paymentId}/refunds | Refund a payment
## Documentation For Models
- [Address](docs/Model/Address.md)
- [Agreement](docs/Model/Agreement.md)
- [AgreementSearchResults](docs/Model/AgreementSearchResults.md)
- [AuthorisationRequest](docs/Model/AuthorisationRequest.md)
- [AuthorisationSummary](docs/Model/AuthorisationSummary.md)
- [CardDetails](docs/Model/CardDetails.md)
- [CardDetailsFromResponse](docs/Model/CardDetailsFromResponse.md)
- [CreateAgreementRequest](docs/Model/CreateAgreementRequest.md)
- [CreateCardPaymentRequest](docs/Model/CreateCardPaymentRequest.md)
- [CreatePaymentResult](docs/Model/CreatePaymentResult.md)
- [DisputeDetailForSearch](docs/Model/DisputeDetailForSearch.md)
- [DisputeLinksForSearch](docs/Model/DisputeLinksForSearch.md)
- [DisputesSearchResults](docs/Model/DisputesSearchResults.md)
- [EmbeddedRefunds](docs/Model/EmbeddedRefunds.md)
- [ErrorResponse](docs/Model/ErrorResponse.md)
- [Exemption](docs/Model/Exemption.md)
- [ExternalMetadata](docs/Model/ExternalMetadata.md)
- [Link](docs/Model/Link.md)
- [Outcome](docs/Model/Outcome.md)
- [PaymentDetailForSearch](docs/Model/PaymentDetailForSearch.md)
- [PaymentEvent](docs/Model/PaymentEvent.md)
- [PaymentEventLink](docs/Model/PaymentEventLink.md)
- [PaymentEvents](docs/Model/PaymentEvents.md)
- [PaymentInstrument](docs/Model/PaymentInstrument.md)
- [PaymentLinks](docs/Model/PaymentLinks.md)
- [PaymentLinksForEvents](docs/Model/PaymentLinksForEvents.md)
- [PaymentLinksForSearch](docs/Model/PaymentLinksForSearch.md)
- [PaymentRefundRequest](docs/Model/PaymentRefundRequest.md)
- [PaymentSearchResults](docs/Model/PaymentSearchResults.md)
- [PaymentSettlementSummary](docs/Model/PaymentSettlementSummary.md)
- [PaymentState](docs/Model/PaymentState.md)
- [PaymentWithAllLinks](docs/Model/PaymentWithAllLinks.md)
- [PostLink](docs/Model/PostLink.md)
- [PrefilledCardholderDetails](docs/Model/PrefilledCardholderDetails.md)
- [Refund](docs/Model/Refund.md)
- [RefundDetailForSearch](docs/Model/RefundDetailForSearch.md)
- [RefundForSearchResult](docs/Model/RefundForSearchResult.md)
- [RefundLinksForSearch](docs/Model/RefundLinksForSearch.md)
- [RefundSearchResults](docs/Model/RefundSearchResults.md)
- [RefundSettlementSummary](docs/Model/RefundSettlementSummary.md)
- [RefundSummary](docs/Model/RefundSummary.md)
- [RefundsResponse](docs/Model/RefundsResponse.md)
- [RequestError](docs/Model/RequestError.md)
- [SearchNavigationLinks](docs/Model/SearchNavigationLinks.md)
- [SettlementSummary](docs/Model/SettlementSummary.md)
- [ThreeDSecure](docs/Model/ThreeDSecure.md)
## Documentation For Authorization
## BearerAuth
- **Type**: HTTP bearer authentication
## Author