The GOV.UK Pay REST API. Read our documentation for more details.
This PHP package is automatically generated by the Swagger Codegen project:
- API version: 1.0.3
- Build package: io.swagger.codegen.v3.generators.php.PhpClientCodegen
PHP 5.5 and later
To install the bindings via Composer, 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
Download the files and include autoload.php:
require_once('/path/to/SwaggerClient-php/vendor/autoload.php');To run the unit tests:
composer install
./vendor/bin/phpunit
Please follow the installation procedure and then run the following:
<?php
require_once(__DIR__ . '/vendor/autoload.php');
$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 | The `agreement_id` of the agreement you are cancelling
try {
$apiInstance->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;
}
?>All URIs are relative to https://publicapi.payments.service.gov.uk
| Class | Method | HTTP request | Description |
|---|---|---|---|
| AgreementsApi | cancelAnAgreement | POST /v1/agreements/{agreementId}/cancel | Cancel an agreement for recurring payments |
| AgreementsApi | createAnAgreement | POST /v1/agreements | Create an agreement for recurring payments |
| AgreementsApi | getAnAgreement | GET /v1/agreements/{agreementId} | Get information about a single agreement for recurring payments |
| AgreementsApi | searchAgreements | GET /v1/agreements | Search agreements for recurring payments |
| AuthoriseCardPaymentsApi | authoriseAMOTOPayment | POST /v1/auth | Send card details to authorise a MOTO payment |
| CardPaymentsApi | cancelAPayment | POST /v1/payments/{paymentId}/cancel | Cancel payment |
| CardPaymentsApi | captureAPayment | POST /v1/payments/{paymentId}/capture | Take a delayed payment |
| CardPaymentsApi | createAPayment | POST /v1/payments | Create a payment |
| CardPaymentsApi | getAPayment | GET /v1/payments/{paymentId} | Get information about a single payment |
| CardPaymentsApi | getEventsForAPayment | GET /v1/payments/{paymentId}/events | Get a payment's events |
| CardPaymentsApi | searchPayments | GET /v1/payments | Search payments |
| DisputesApi | searchDisputes | GET /v1/disputes | Search disputes |
| RefundingCardPaymentsApi | getAPaymentRefund | GET /v1/payments/{paymentId}/refunds/{refundId} | Check the status of a refund |
| RefundingCardPaymentsApi | getAllRefundsForAPayment | GET /v1/payments/{paymentId}/refunds | Get information about a payment’s refunds |
| RefundingCardPaymentsApi | searchRefunds | GET /v1/refunds | Search refunds |
| RefundingCardPaymentsApi | submitARefundForAPayment | POST /v1/payments/{paymentId}/refunds | Refund a payment |
- Address
- Agreement
- AgreementSearchResults
- AuthorisationRequest
- AuthorisationSummary
- CardDetails
- CardDetailsFromResponse
- CreateAgreementRequest
- CreateCardPaymentRequest
- CreatePaymentResult
- DisputeDetailForSearch
- DisputeLinksForSearch
- DisputesSearchResults
- EmbeddedRefunds
- ErrorResponse
- Exemption
- ExternalMetadata
- Link
- Outcome
- PaymentDetailForSearch
- PaymentEvent
- PaymentEventLink
- PaymentEvents
- PaymentInstrument
- PaymentLinks
- PaymentLinksForEvents
- PaymentLinksForSearch
- PaymentRefundRequest
- PaymentSearchResults
- PaymentSettlementSummary
- PaymentState
- PaymentWithAllLinks
- PostLink
- PrefilledCardholderDetails
- Refund
- RefundDetailForSearch
- RefundForSearchResult
- RefundLinksForSearch
- RefundSearchResults
- RefundSettlementSummary
- RefundSummary
- RefundsResponse
- RequestError
- SearchNavigationLinks
- SettlementSummary
- ThreeDSecure
- Type: HTTP bearer authentication