Companies House Payments API
![Go Report Card](https://goreportcard.com/badge/github.com/companieshouse/payments.api.ch.gov.uk)
The Companies House API for handling payments.
Requirements
In order to run this API locally you will need to install the following:
Getting Started
- Clone this repository:
go get github.com/companieshouse/payments.api.ch.gov.uk
- Build the executable:
make build
Configuration
Variable | Default | Description |
---|
BIND_ADDR | | Payments API Port |
MONGODB_URL | | MongoDB URL |
MONGODB_DATABASE | payments | MongoDB database name |
MONGODB_COLLECTION | payments | MongoDB collection name |
DOMAIN_WHITELIST | | List of valid domains for the Resource URL |
PAYMENTS_WEB_URL | | URL for the Payments Web service |
PAYMENTS_API_URL | | URL for the Payments API |
GOV_PAY_URL | | URL for GOV.UK Pay |
GOV_PAY_BEARER_TOKEN | | Bearer Token for GOV.UK Pay |
EXPIRY_TIME_IN_MINUTES | | Number of minutes before a payment session expires |
KAFKA_BROKER_ADDR | | Kafka Broker address |
SCHEMA_REGISTRY_URL | | Schema Registry URL |
Endpoints
Method | Path | Description |
---|
GET | /healthcheck | Checks the health of the service |
POST | /payments | Create Payment Session |
GET | /payments/{payment_id} | Get Payment Session |
PATCH | /private/payments/{payment_id} | Patch Payment Session |
POST | /private/payments/{payment_id}/external-journey | Returns URL for external Payment Provider |
GET | /callback/payments/govpay/{payment_id} | GOV.UK Pay callback |
The Create Payment Session
POST endpoint receives a body
in the following format:
{
"redirect_uri": "string",
"reference": "string",
"resource": "string",
"state": "string"
}
and returns a Payment Resource in the response:
{
"amount": "string",
"available_payment_methods": [
"string"
],
"completed_at": "date-time",
"created_at": "date-time",
"created_by": {
"email": "string",
"forename": "string",
"id": "string",
"surname": "string"
},
"description": "string",
"links": {
"journey": "string",
"resource": "string",
"self": "string"
},
"payment_method": "string",
"reference": "string",
"status": "string"
}
External Payment Providers
The only external payment provider currently supported is GOV.UK Pay.