# Payment Simulation

The Payment Simulation allows partners to simulate inbound payment messages across various payment rails, including Faster Payments, BACS, CHAPS, and internal payment systems.&#x20;

This API enables testing and validation of payment flows without processing real transactions. By initiating simulated payments, partners can verify integration, ensure correct handling of different payment types, and troubleshoot potential issues before going live. This tool is crucial for development and quality assurance in a controlled, risk-free environment.

{% hint style="warning" %}
Please note that this API only valid for non-production environments.
{% endhint %}

The payload for the source counterparty in the *Payment Simulation* API must include valid details that align with the chosen simulated payment rail.&#x20;

For example, when simulating a payment via Faster Payments, the source counterparty must provide an account number and sort code that pass the UK Modulus Check, ensuring they are legitimate UK bank details.  [Please refer to Counterpary Validation section for more information.](https://developer.algbralabs.com/partner-banking/concepts/payments/counterparty-validation)

Each rail—whether it's Faster Payments, BACS, CHAPS, or internal systems—requires specific combinations of information, and the system will validate the provided data to ensure compatibility with the respective payment rail's requirements. This ensures accurate simulation and testing of different payment scenarios.

## POST /v1/partner/payments/customers/{customerId}/simulate-inbound-payment

> Simulate payment using customer

```json
{"openapi":"3.0.0","info":{"title":"Horizon Link - API Docs","version":"1.0"},"servers":[{"url":"api-url"}],"paths":{"/v1/partner/payments/customers/{customerId}/simulate-inbound-payment":{"post":{"operationId":"PaymentController_simulateInboundPayment","summary":"Simulate payment using customer","parameters":[{"name":"customerId","required":true,"in":"path","schema":{"type":"string"}},{"name":"authorization","in":"header","description":"Authorization header containing your API Token","schema":{"type":"string"}},{"name":"x-alg-nonce","in":"header","description":"Nonce used to generate the payload signature","schema":{"type":"string"}},{"name":"x-alg-signature","in":"header","description":"Payload signature","schema":{"type":"string"}},{"name":"date","in":"header","description":"Date of the request un UTC/GMT","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PartnerSimulateInboundPaymentPayload"}}}},"responses":{"200":{"description":"Simulate payment"},"400":{"description":"Input validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PartnerCommonErrorResponse"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PartnerCommonErrorResponse"}}}},"408":{"description":"Request timeout","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PartnerCommonErrorResponse"}}}},"422":{"description":"Unprocessable entity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PartnerCommonErrorResponse"}}}},"503":{"description":"Service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PartnerCommonErrorResponse"}}}}},"tags":["Payments"]}}},"components":{"schemas":{"PartnerSimulateInboundPaymentPayload":{"type":"object","properties":{"rails":{"type":"string","default":"FASTER_PAYMENTS","description":"The payment rail to simulate (e.g. Faster Payments)","enum":["FASTER_PAYMENTS","CHAPS","BACS","INTERNAL","INTERNATIONAL"]},"payload":{"description":"Simulation details specific to the selected payment rail","oneOf":[{"$ref":"#/components/schemas/PartnerSimulateFpsPayload"},{"$ref":"#/components/schemas/PartnerSimulateInternationalPayload"}]}},"required":["rails","payload"]},"PartnerCommonErrorResponse":{"type":"object","properties":{"errorType":{"type":"string","enum":["VALIDATION_ERROR","FORBIDDEN","NOT_FOUND","UNAUTHORIZED","PRECONDITION_FAILED","REQUEST_TIMEOUT","SERVICE_UNAVAILABLE"]},"reason":{"type":"string","nullable":true},"validationFailures":{"nullable":true,"type":"array","items":{"$ref":"#/components/schemas/PartnerValidationFieldError"}}},"required":["errorType"]},"PartnerValidationFieldError":{"type":"object","properties":{"message":{"type":"string"},"path":{"type":"string","nullable":true}},"required":["message"]}}}}
```

## POST /v1/partner/payments/account/simulate-inbound-payment

> Simulate payment using account

```json
{"openapi":"3.0.0","info":{"title":"Horizon Link - API Docs","version":"1.0"},"servers":[{"url":"api-url"}],"paths":{"/v1/partner/payments/account/simulate-inbound-payment":{"post":{"operationId":"PaymentController_simulateInboundPaymentForAccount","summary":"Simulate payment using account","parameters":[{"name":"authorization","in":"header","description":"Authorization header containing your API Token","schema":{"type":"string"}},{"name":"x-alg-nonce","in":"header","description":"Nonce used to generate the payload signature","schema":{"type":"string"}},{"name":"x-alg-signature","in":"header","description":"Payload signature","schema":{"type":"string"}},{"name":"date","in":"header","description":"Date of the request un UTC/GMT","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PartnerSimulateInboundPaymentPayload"}}}},"responses":{"200":{"description":"Simulate payment"},"400":{"description":"Input validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PartnerCommonErrorResponse"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PartnerCommonErrorResponse"}}}},"408":{"description":"Request timeout","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PartnerCommonErrorResponse"}}}},"422":{"description":"Unprocessable entity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PartnerCommonErrorResponse"}}}},"503":{"description":"Service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PartnerCommonErrorResponse"}}}}},"tags":["Payments"]}}},"components":{"schemas":{"PartnerSimulateInboundPaymentPayload":{"type":"object","properties":{"rails":{"type":"string","default":"FASTER_PAYMENTS","description":"The payment rail to simulate (e.g. Faster Payments)","enum":["FASTER_PAYMENTS","CHAPS","BACS","INTERNAL","INTERNATIONAL"]},"payload":{"description":"Simulation details specific to the selected payment rail","oneOf":[{"$ref":"#/components/schemas/PartnerSimulateFpsPayload"},{"$ref":"#/components/schemas/PartnerSimulateInternationalPayload"}]}},"required":["rails","payload"]},"PartnerCommonErrorResponse":{"type":"object","properties":{"errorType":{"type":"string","enum":["VALIDATION_ERROR","FORBIDDEN","NOT_FOUND","UNAUTHORIZED","PRECONDITION_FAILED","REQUEST_TIMEOUT","SERVICE_UNAVAILABLE"]},"reason":{"type":"string","nullable":true},"validationFailures":{"nullable":true,"type":"array","items":{"$ref":"#/components/schemas/PartnerValidationFieldError"}}},"required":["errorType"]},"PartnerValidationFieldError":{"type":"object","properties":{"message":{"type":"string"},"path":{"type":"string","nullable":true}},"required":["message"]}}}}
```
