---
agentTools:
  projectIndex: https://crezco-collect.readme.io/llms.txt
---

# Create a custom payment redirect address

Custom redirect URLs allow specification of both the initial and final screen of the payment user's journey:
            
InitialScreen
- DetailsCheck: The standard payment confirmation screen, showing all details of the PayDemand
- BankSelection: The bank selection screen
- ContinueToBank: A screen redirecting the the specified bank
            
**NOTE**: Using *ContinueToBank* also requires *bankId* and *countryIso2Code*. Bank details are available using
the v1/banks/ endpoint
            
FinalScreen
- PaymentStatus: Payment status, shown until payment reaches a finalised state
- PaymentConfirmation: Payment confirmation, allows user to enter email for a receipt
- PaymentFeedback: Payment feedback, allows user to rate the payment experience

Successful payments will be directed to **successCallbackUri** after the *FinalScreen*.
Cancelled or failed payments will be directed to **failureCallbackUri**.

# OpenAPI definition

```json
{
  "openapi": "3.0.1",
  "info": {
    "title": "Crezco Partner Api",
    "description": "﻿\n---\n\n## Authorization\n\nApi key should be sent as a header (Example: 'X-Crezco-Key: *yourkey*').\n\nClick __Authorize__ button to add your key as a header to all calls.\n\nTo get a key, please contact support.\n\n## Support\n\nFor support go to [Crezco support portal](https://crezco.atlassian.net/servicedesk/customer/portal/2/group/7) or e-mail [support@crezco.com](mailto:support@crezco.com).\n\n## Quick start\n\n### Create a user\n\nUse POST on users endpoint in order to create a new user. All pay demands when created will be associated with a particular user, who can be thought of as a beneficiary of the payments.\n\n### Create pay demand\n\nPay demand is a representation of an invoice. It contains instructions of the amount that needs to be paid, any reference (description or purpose) of the payment, as well as details of the beneficiary's bank account.\n\nEvery pay demand, when created, is associated with a specific user. \n\n### Obtain pay demand URL\n\nEach pay demand has a unique URL associated with it. \n\nThis URL may be sent to an individual who must make a payment. It may be sent as a standard URL, or could be embeded in a QR code.",
    "version": "v1"
  },
  "servers": [
    {
      "url": "https://api.sandbox.crezco.com",
      "description": "Sandbox"
    },
    {
      "url": "https://api.crezco.com",
      "description": "Production"
    }
  ],
  "paths": {
    "/v1/users/{userId}/pay-demands/{payDemandId}/payment": {
      "post": {
        "tags": [
          "Payments"
        ],
        "summary": "Create a custom payment redirect address",
        "description": "Custom redirect URLs allow specification of both the initial and final screen of the payment user's journey:\r\n            \r\nInitialScreen\r\n- DetailsCheck: The standard payment confirmation screen, showing all details of the PayDemand\r\n- BankSelection: The bank selection screen\r\n- ContinueToBank: A screen redirecting the the specified bank\r\n            \r\n**NOTE**: Using *ContinueToBank* also requires *bankId* and *countryIso2Code*. Bank details are available using\r\nthe v1/banks/ endpoint\r\n            \r\nFinalScreen\r\n- PaymentStatus: Payment status, shown until payment reaches a finalised state\r\n- PaymentConfirmation: Payment confirmation, allows user to enter email for a receipt\r\n- PaymentFeedback: Payment feedback, allows user to rate the payment experience\r\n\r\nSuccessful payments will be directed to **successCallbackUri** after the *FinalScreen*.\r\nCancelled or failed payments will be directed to **failureCallbackUri**.",
        "operationId": "CreatePaymentAsync",
        "parameters": [
          {
            "name": "userId",
            "in": "path",
            "description": "Unique identifier (UUID) of the user who owns pay demand",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "payDemandId",
            "in": "path",
            "description": "Unique identifier (UUID) of the pay demand",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "initialScreen",
            "in": "query",
            "description": "Initial (Crezco) screen presented to the user",
            "schema": {
              "$ref": "#/components/schemas/InitialScreen"
            }
          },
          {
            "name": "finalScreen",
            "in": "query",
            "description": "Final (Crezco) screen presented to the user",
            "schema": {
              "$ref": "#/components/schemas/FinalScreen"
            }
          },
          {
            "name": "bankId",
            "in": "query",
            "description": "Unique identifier for the payer's bank",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "countryIso2Code",
            "in": "query",
            "description": "Country code (2 characters - ISO 3166-1) corresponding to the payer's bank",
            "schema": {
              "type": "string",
              "default": "GB"
            }
          },
          {
            "name": "successCallbackUri",
            "in": "query",
            "description": "URI that should be used to redirect to after payment is completed",
            "schema": {
              "type": "string",
              "format": "uri"
            }
          },
          {
            "name": "failureCallbackUri",
            "in": "query",
            "description": "URI that should be used to redirect to after payment has failed or been cancelled",
            "schema": {
              "type": "string",
              "format": "uri"
            }
          },
          {
            "name": "amount",
            "in": "query",
            "description": "Optional payment amount overriding the one specified in the pay demand",
            "schema": {
              "type": "number",
              "format": "double"
            }
          },
          {
            "name": "reference",
            "in": "query",
            "description": "Optional payment reference overriding the one specified in the pay demand",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "payerEmail",
            "in": "query",
            "description": "Optional payer's e-mail address if available, to be used for notifications about payment status changes",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentRedirects"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "FinalScreen": {
        "enum": [
          "PaymentStatus",
          "PaymentConfirmation",
          "PaymentFeedback"
        ],
        "type": "string"
      },
      "InitialScreen": {
        "enum": [
          "DetailsCheck",
          "BankSelection",
          "ContinueToBank"
        ],
        "type": "string"
      },
      "PaymentRedirects": {
        "type": "object",
        "properties": {
          "redirect": {
            "type": "string",
            "format": "uri"
          }
        },
        "additionalProperties": false
      },
      "ProblemDetails": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "nullable": true
          },
          "title": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "detail": {
            "type": "string",
            "nullable": true
          },
          "instance": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": {}
      },
      "ValidationProblemDetails": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "nullable": true
          },
          "title": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "detail": {
            "type": "string",
            "nullable": true
          },
          "instance": {
            "type": "string",
            "nullable": true
          },
          "errors": {
            "type": "object",
            "additionalProperties": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          }
        },
        "additionalProperties": {}
      }
    },
    "securitySchemes": {
      "ApiKey": {
        "type": "apiKey",
        "description": "Api key should be sent as header (Example: 'X-Crezco-Key:{yourkey}')\nTo get a key, please e-mail support@crezco.com\n\nFor support go to https://crezco.atlassian.net/servicedesk/customer/portal/2/group/7",
        "name": "X-Crezco-Key",
        "in": "header"
      },
      "Bearer": {
        "type": "http",
        "description": "JWT Authorization header using the Bearer scheme.\nEnter 'Bearer' [space] and then your token in the text input below.\nExample: 'Bearer 12345abcdef'",
        "scheme": "Bearer"
      }
    }
  },
  "security": [
    {
      "ApiKey": []
    },
    {
      "Bearer": []
    }
  ],
  "x-readme": {
    "explorer-enabled": true,
    "proxy-enabled": true
  },
  "_id": {
    "buffer": {
      "0": 101,
      "1": 122,
      "2": 11,
      "3": 8,
      "4": 192,
      "5": 234,
      "6": 80,
      "7": 0,
      "8": 28,
      "9": 194,
      "10": 144,
      "11": 137
    }
  }
}
```