Payment Constraints is currently available in Private Beta. See Glossary for more information.
Introduction
The constraints API can help improve your success rates for payment initiation by allowing you to fulfil institution specific requirements and rules. Examples of institution specific requirements, or constraints, include:- User credentials (such as their user id and password for the bank’s digital channels) must be provided
- The users payment account must be indicated through its IBAN
- The maximum length of a payment reference must be 18 characters
- As a knowledge base to reference during the build of your application
- To dynamically control behaviour in your application - such as front end validation and data transformation
- To validate that your intended initiation request to the Yapily Payments API meets all of the institution’s requirements
How it works
The constraints API works as follows:- You make a request to the payment constraints endpoint specifying the type of payment that you wish to initiate and the institution you wish to initiate it with
- The response will include a JSON schema that defines all of the data requirements for this institution
- The data requirements are expressed in an identical manner as the Yapily Payments API and can be used to directly construct and validate the request messages to it
- It’s a standardised solution with many readily-available tools / libraries to help you process the information provided and perform validation against it
Current Scope
The payment constraints API currently supports Single Domestic Payments (including Instant) for German institutions. This will later be expanded to include other countries and payment types. The same mechanism will also be used in future versions to share Yapily Data related constraints.Tutorial
1. Request Constraint Information
Call Get Constraints to request constraint information for the institution of your user and the operation that you wish to perform. This is done through the below query parameters:| Query Parameter | Description | Mandatory? | Example |
|---|---|---|---|
institutionIds | The unique id(s) of the Institution(s) that you wish to retrieve the Payment Constraints for. Multiple institutionIds need to be separated by , | Yes | commerzbank |
institutionCountryCode | The country code in which the institution(s) operates and that you wish to gain the constraints for | Yes | DE |
paymentType | The payment type that you wish to gain the constraints for | Yes | DOMESTIC_PAYMENT |
endpointPath | The endpoint path on the Yapily API to which the constraints apply | No | /payment-auth-requests |
endpointMethod | The endpoint method on the Yapily API to which the constraints apply | No | POST |
2. Receive Constraint Information
The response provides an array of results with one item for everyinstitutionId you have requested.
Each array item includes:
- The key identifiers of the payment scenario (playing back the parameters you have passed in) - e.g.
institutionIdandpaymentType - A
requestblock that includes a detailed json schema for the requestheadersand another schema for the requestbody. This JSON schema describes what a request to theendpointPathneeds to conform to in order to be successful
The response example below has been shortened and is to indicate the structure of the response only.
Constraint Types
Possible Constraints
JSON schema allows for a large number of keywords to describe the desired structure and validation of data. To provide more predictability & reduce the range of constraints your application will need to handle, the information provided by the constraints API will always:- Conform to the Yapily API schema (described in the Open API Specification and API reference) for the same endpoint. E.g. The properties included and their types will always align
- Have tighter validation than the Yapily API schema (and never more relaxed). E.g. An optional property may become mandatory, but a mandatory property will not become optional
- Contain only the below validation keywords:
- required
- type
- format
- minimum
- exclusiveMinimum
- maximum
- exclusiveMaximum
- pattern
- enum
allOf keyword may be used to reference the complex conditions that apply.
Complex Conditions
Some data requirements are more complex and conditional in nature meaning that they cannot be communicated using the more simple keywords described above. Where this is the case a condition is used to describe the validation rule. Each of these conditions has a unique name, which is also used as the name of the sub-schema that defines it. This sub-schema definition ($defs) is referenced ($ref) from the property to which it applies
This unique name:
- Aids human identification of these complex conditions
- Offers a predictable, limited and documented set of conditions that may be provided (and that you may wish for your application to handle)
Example
The below extract includes two named conditions:- An
IBAN_REQUIREDcondition that applies to theaccountIdentificationsarray - An
IBAN_FORMATcondition that applies to each item within theaccountIdentificationsarray
Complex Conditions Catalogue
ACCOUNT_NUMBER_FORMAT
ACCOUNT_NUMBER_FORMAT
Describes the required format of a provided Account Number.That is, the required pattern of the identification value for an item in the accountIdentifications array where type = ACCOUNT_NUMBERThis requirement will be associated with the payer or payee details
ACCOUNT_NUMBER_REQUIRED
ACCOUNT_NUMBER_REQUIRED
Indicates that an Account Number must be provided in the request.That is, an item must be provided in the accountIdentifications array where type = ACCOUNT_NUMBERThis requirement will be associated with the payer or payee details
BBAN_FORMAT
BBAN_FORMAT
Describes the required format of a provided BBAN.That is, the required pattern of the identification value for an item in the accountIdentificiations array where type = BBANThis requirement will be associated with the payer or payee details
IBAN_FORMAT
IBAN_FORMAT
Describes the required format of a provided IBAN.That is, the required pattern of the identification value for an item in the accountIdentificiations array where type = IBANThis requirement will be associated with the payer or payee details
IBAN_OR_BBAN_REQUIRED
IBAN_OR_BBAN_REQUIRED
Indicates that at least one of an IBAN or a BBAN must be provided in the request.That is, an item must be provided in the accountIdentifications array where type = IBAN or type = BBANThis requirement will be associated with the payer or payee details
IBAN_REQUIRED
IBAN_REQUIRED
Indicates that an IBAN must be provided in the request.That is, an item must be provided in the accountIdentifications array where type = IBANThis requirement will be associated with the payer or payee details
SORT_CODE_FORMAT
SORT_CODE_FORMAT
Describes the required format of a provided Sort Code.That is, the required pattern of the identification value for an item in the accountIdentificiations array where type = SORT_CODEThis requirement will be associated with the payer or payee details
SORT_CODE_REQUIRED
SORT_CODE_REQUIRED
Indicates that an Sort Code must be provided in the request.That is, an item must be provided in the accountIdentifications array where type = SORT_CODEThis requirement will be associated with the payer or payee details