# Schedule payment
Schedule payments for a specified future date (`schedule_datetime`). For more information, refer to [Schedule payment overview](https://developers.pismo.io/pismo-docs/docs/scheduled-payments).
The payload for this request is similar to that of the [Post payment](ref:corporate-v2-post-payments) endpoint with the exception of the (`schedule_datetime`) property.
See [Data and reporting](doc:data-reporting-overview) for more information about events and setting up event notifications.
For more information on payments operations, see [Corporate Banking Launch Reference](doc:corporate-banking-launch-reference).
NOTE:
- This endpoint requires an account token - an access token encoded with an external account ID. Tokens can expire quickly, which can result in a `401 Unauthorized` message.
- For scheduled payments, validation of the transaction occurs only during the execution of the scheduled payment.
This endpoint generates the following events:
- [Platform authorization created](https://developers.pismo.io/events/docs/platform-authorization-platform-authorization-1)
- [Account balance changed](https://developers.pismo.io/events/docs/availables-change-available-1)
- [Current scheduled payment status displayed](https://developers.pismo.io/events/docs/corporate-schedule-payment-1)
See [Data and reporting](doc:data-reporting-overview) for more information about events and how to set up event notifications.
# OpenAPI definition
```json
{
"openapi": "3.0.0",
"info": {
"title": "Banking - Transaction banking",
"version": "0.9.0",
"description": "Transaction banking API",
"contact": {
"name": "API Support",
"url": "https://developers.pismo.io/support/"
},
"license": {
"name": "Copyright Pismo"
}
},
"servers": [
{
"url": "https://sandbox.pismolabs.io",
"description": "Sandbox API server for testing"
}
],
"security": [
{
"BearerAuth": []
}
],
"tags": [
{
"name": "Payments",
"description": "Payment endpoints supporting external accounts"
}
],
"components": {
"schemas": {
"Amount": {
"type": "object",
"description": "Amount",
"properties": {
"value": {
"$ref": "#/components/schemas/AmountValue"
},
"currency": {
"$ref": "#/components/schemas/Currency"
}
},
"required": [
"value"
]
},
"AmountValue": {
"type": "number",
"format": "float",
"description": "Amount value",
"exclusiveMinimum": false,
"minimum": 0,
"maximum": 100000000000000000,
"example": 1000.52
},
"BusinessDate": {
"type": "string",
"format": "date",
"description": "Specifying a `business_date` value impacts the account balance history.
\nNotes:\n - The business date is in ISO 8601 format.\n - The business date allows users to designate the balance history cycle in which a payment is posted.\n - You can specify a `business_date` within the current working day or up to one working day before or after.\n",
"example": "2023-03-09"
},
"ChannelCode": {
"description": "Alphanumeric channel code identifier",
"type": "string",
"minLength": 1,
"maxLength": 20,
"pattern": "^[a-zA-Z0-9]+$",
"example": "GDP"
},
"CreditProcessingCode": {
"type": "string",
"description": "Processing code for posting credit transactions. The code must have a credit balance impact. You can retrieve a list of the organization processing codes using [List processing codes](https://developers.pismo.io/pismo-docs/reference/get-processing-code-by-tenant).",
"maxLength": 6,
"example": "220035"
},
"Currency": {
"type": "string",
"description": "3-letter code in ISO 4217-compliant format for the currency used in the transaction.",
"maxLength": 3,
"minLength": 3,
"example": "USD"
},
"DebitProcessingCode": {
"type": "string",
"description": "Processing code to be used for posting the debit transaction. List the organization processing codes in [List processing codes](https://developers.pismo.io/pismo-docs/reference/get-processing-code-by-tenant) endpoint.",
"maxLength": 6,
"example": "220037"
},
"EarmarkIdWithdrawal": {
"type": "string",
"description": "ID of the earmark from which the amount is withdrawn. The earmark ID is generated by the [Create Earmark](https://developers.pismo.io/pismo-docs/reference/post-corporate-v2-earmarks) endpoint.",
"maxLength": 60,
"minLength": 1,
"example": "dadaab22-6e28-4746-8440-0caa030f0f3f"
},
"ErrorCode": {
"description": "Error code\n`minLength: 1`\n`maxLength: 12`\n",
"type": "string",
"minLength": 1,
"maxLength": 12,
"example": "WPMT0017"
},
"ErrorMessage": {
"description": "Error message\n`minLength: 1`\n`maxLength: 1000`\n",
"type": "string",
"minLength": 1,
"maxLength": 1000,
"example": "Invalid JSON payload received: Error unmarshalling request"
},
"ErrorResponse": {
"type": "object",
"properties": {
"code": {
"$ref": "#/components/schemas/ErrorCode"
},
"message": {
"$ref": "#/components/schemas/ErrorMessage"
}
}
},
"ExternalAccountId2": {
"type": "string",
"description": "External ID of the account to which the transaction is posted.",
"maxLength": 60,
"minLength": 1,
"example": "289",
"pattern": "^[a-zA-Z0-9-]+$"
},
"Force": {
"type": "boolean",
"description": "Whether a payment validation rule should be executed in a forced state (`true`) or not (`false`).
\nAllowed for `LEDGER` validation rule.\n",
"example": false
},
"ForcePostPayment": {
"type": "boolean",
"description": "If `true`, the transaction is executed regardless of the accounts balance or state.
\nTo post a forced transfer, you must specify both `credit` and `debit`, and set `force_post` to `true`.
\nReason-based force payments:\n If the account has any reason-based force payment restrictions, and the operation violates any of those restrictions, it fails. The reasons that restrict force credit or debit operations are:\n - `ALL_NO_FORCE_ALLOWED`: Debits and credits are permitted, but force operations are not allowed.\n - `CREDIT_ONLY_NO_FORCE_DEBIT_ALLOWED`: Only credits and force credits are allowed.\n - `FORCE_CREDIT_ONLY`: Debits, credits, and force debits are not allowed.\n - `FORCE_DEBIT_ONLY`: Debits, credits, and force credits are not allowed.\n - `DEBIT_ONLY_NO_FORCE_CREDIT_ALLOWED`: Only debits and force debits are allowed.\n - `NONE_NO_FORCE_ALLOWED`: Debits, credits, force debits, and force credits are not allowed.
\nNOTE: Forced transfers from an earmark balance are not supported when `credit`, `debit`, or `earmark_id` are specified.\n",
"default": false,
"example": false
},
"InstantClearing": {
"type": "boolean",
"description": "Whether the funds are available when the payment is posted (`true`) or not (`false`).",
"example": false
},
"MetadataPayment": {
"type": "object",
"description": "Key-value pairs containing data intended for storage in the Pismo system.
\nNOTES:\n- The `metadata` field includes a `corporate_metadata` object with the following fields:\n - `credit_external_account_id`: Included in the `corporate_metadata` field when it's provided in the credit leg.\n - `debit_external_account_id`: Included in the `corporate_metadata` field when it's provided in the debit leg.\n - `earmark_id`: Included in the `corporate_metadata` field when it's provided in the debit leg.\n- The `corporate_metadata` attribute must be an object. A type mismatch results in an error as mapped in the responses section.\n- To be able to send different `metadata` information for each payment leg in transfer operations, the `metadata` can be included in the primary or leg field. A conflict between the primary and a leg field results in an error as mapped in the responses section.\n",
"example": {
"my-id": 2932
}
},
"Override": {
"type": "boolean",
"description": "Whether to override the validation rule in the payment process (`true`) or not (`false`).
\nAllowed for `ACCOUNT_STATUS` validation rule.\n",
"example": false
},
"PaymentDatetime": {
"type": "string",
"format": "date-time",
"description": "Date and time of the payment. Specifying a `payment_datetime` value impacts the account balance history.
\nNotes:\n - The payment datetime is in ISO 8601 format.\n - You can backdate payments a maximum of 390 calendar days. You can postdate payments a maximum of 10 calendar days.\n",
"example": "2023-03-10T19:05:56.743Z"
},
"PaymentV2Request": {
"title": "PaymentV2Request",
"type": "object",
"required": [
"amount",
"tracking_id"
],
"properties": {
"amount": {
"$ref": "#/components/schemas/Amount"
},
"tracking_id": {
"$ref": "#/components/schemas/TrackingID"
},
"soft_descriptor": {
"$ref": "#/components/schemas/SoftDescriptorPayment"
},
"credit": {
"$ref": "#/components/schemas/RequiredCreditTransaction"
},
"debit": {
"$ref": "#/components/schemas/RequiredDebitTransaction"
},
"metadata": {
"$ref": "#/components/schemas/MetadataPayment"
},
"skip_account_date_validation": {
"$ref": "#/components/schemas/SkipAccountDateValidation"
},
"force_post": {
"$ref": "#/components/schemas/ForcePostPayment"
},
"validation_rules": {
"$ref": "#/components/schemas/ValidationRules"
},
"payment_datetime": {
"$ref": "#/components/schemas/PaymentDatetime"
},
"business_date": {
"$ref": "#/components/schemas/BusinessDate"
},
"channel": {
"$ref": "#/components/schemas/ChannelCode"
},
"instant_clearing": {
"$ref": "#/components/schemas/InstantClearing"
}
}
},
"RequiredCreditTransaction": {
"type": "object",
"description": "Credit transaction. To post a credit, you must provide a `credit` object with a valid credit processing code (`processing_code`) and destination (`external_account_id`).
\nTo post a transfer, you must provide both credit and debit objects, representing the credit and debit legs of the operation, respectively.\n",
"properties": {
"external_account_id": {
"$ref": "#/components/schemas/ExternalAccountId2"
},
"processing_code": {
"$ref": "#/components/schemas/CreditProcessingCode"
},
"soft_descriptor": {
"$ref": "#/components/schemas/SoftDescriptorPayment"
},
"metadata": {
"$ref": "#/components/schemas/MetadataPayment"
}
},
"required": [
"external_account_id"
]
},
"RequiredDebitTransaction": {
"type": "object",
"description": "Debit transaction. To post a debit you must provide a `debit` object. If you provide an `earmark_id` value inside the `debit` object, the payment amount is withdrawn directly from the earmark balance. The earmark ID is generated by the [Create earmark](https://developers.pismo.io/pismo-docs/reference/post-corporate-v2-earmarks) endpoint.
\nTo post a transfer, you must provide both `credit` and `debit` objects, representing the credit and debit legs of the operation, respectively. If you provide an `earmark_id` value inside the `debit` object, the transferred amount is withdrawn directly from the earmark balance.\n",
"properties": {
"external_account_id": {
"$ref": "#/components/schemas/ExternalAccountId2"
},
"processing_code": {
"$ref": "#/components/schemas/DebitProcessingCode"
},
"earmark_id": {
"$ref": "#/components/schemas/EarmarkIdWithdrawal"
},
"soft_descriptor": {
"$ref": "#/components/schemas/SoftDescriptorPayment"
},
"metadata": {
"$ref": "#/components/schemas/MetadataPayment"
}
},
"required": [
"external_account_id"
]
},
"ScheduleDatetime": {
"type": "string",
"format": "date-time",
"description": "The date and time when the transaction is scheduled to occur. Required for scheduled payments. Format = yyyy-mm-dd:hr:mm:ss.",
"example": "2023-03-10T19:05:56.743Z"
},
"ScheduledPaymentID": {
"type": "string",
"description": "ID used to reference the scheduled payment for subsequent operations.",
"example": "d2644122-251b-41fa-b5b5-54cfad097afb"
},
"ScheduledPaymentResponse": {
"title": "ScheduledPaymentResponse",
"type": "object",
"properties": {
"id": {
"$ref": "#/components/schemas/ScheduledPaymentID"
}
}
},
"ScheduledPaymentV2Request": {
"title": "ScheduledPaymentV2Request",
"required": [
"schedule_datetime"
],
"allOf": [
{
"$ref": "#/components/schemas/PaymentV2Request"
},
{
"type": "object",
"properties": {
"schedule_datetime": {
"$ref": "#/components/schemas/ScheduleDatetime"
}
}
}
]
},
"SkipAccountDateValidation": {
"type": "boolean",
"description": "If `FALSE`, the `payment_datetime` is validated against the account creation date and time. If `TRUE`, the validation is skipped.",
"default": false,
"example": false
},
"SoftDescriptorPayment": {
"type": "string",
"description": "Brief description that helps to identify a particular transaction on the bank statement.
\nNOTES:\n- To be able to send different `soft_descriptor` information for each payment leg in transfer operations, the `soft_descriptor` can be included in the primary or leg field. A conflict between the primary and a leg field results in an error as mapped in the responses section.\n",
"maxLength": 100,
"minLength": 0,
"example": "ACME Inc. - Invoice 2938"
},
"TrackingID": {
"type": "string",
"description": "A unique payment tracking number provided by the client. If an existing `tracking_id` already exists in the system, the API returns a `409` error.\n\nThis field is:\n - Unique within the Organization.\n - Immutable — It can't be updated.\n - Not recyclable — You can't reuse a `tracking_id`.\n",
"minLength": 1,
"maxLength": 43,
"example": "0a50c88a-ade8-4bcc-a639-9a0b0f11e244"
},
"ValidationRule": {
"title": "ValidationRule",
"type": "object",
"properties": {
"override": {
"$ref": "#/components/schemas/Override"
},
"force": {
"$ref": "#/components/schemas/Force"
}
}
},
"ValidationRules": {
"title": "ValidationRules",
"type": "object",
"description": "Rules that determine which validations are executed during the payment process.
\nAvailable validation rules:\n - `LEDGER`\n - `ACCOUNT_STATUS`\n",
"additionalProperties": {
"$ref": "#/components/schemas/ValidationRule"
},
"example": {
"ACCOUNT_STATUS": {
"override": false
},
"LEDGER": {
"force": false
}
}
}
},
"responses": {
"403Forbidden": {
"description": "The request has been lost"
},
"500InternalServer": {
"description": "Internal Server Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
},
"examples": {
"Generic internal error": {
"value": {
"code": "ECMN9999",
"message": "Internal error"
}
}
}
}
}
}
},
"securitySchemes": {
"BearerAuth": {
"type": "http",
"scheme": "bearer",
"bearerFormat": "JWT"
}
}
},
"paths": {
"/corporate/v2/scheduled-payments": {
"post": {
"summary": "Schedule payment",
"description": "Schedule payments for a specified future date (`schedule_datetime`). For more information, refer to [Schedule payment overview](https://developers.pismo.io/pismo-docs/docs/scheduled-payments).\n\nThe payload for this request is similar to that of the [Post payment](https://developers.pismo.io/pismo-docs/reference/corporate-v2-post-payments) endpoint with the exception of the (`schedule_datetime`) property.\n\nSee [Data and reporting](https://developers.pismo.io/pismo-docs/docs/data-reporting-overview) for more information about events and setting up event notifications.\n\nFor more information on payments operations, see [Corporate Banking Launch Reference](https://developers.pismo.io/pismo-docs/docs/corporate-banking-launch-reference).\n\nNOTE:\n- This endpoint requires an account token - an access token encoded with an external account ID. Tokens can expire quickly, which can result in a `401 Unauthorized` message.\n- For scheduled payments, validation of the transaction occurs only during the execution of the scheduled payment.\n\nThis endpoint generates the following events:\n- [Platform authorization created](https://developers.pismo.io/events/docs/platform-authorization-platform-authorization-1)\n- [Account balance changed](https://developers.pismo.io/events/docs/availables-change-available-1)\n- [Current scheduled payment status displayed](https://developers.pismo.io/events/docs/corporate-schedule-payment-1)\n\nSee [Data and reporting](https://developers.pismo.io/pismo-docs/docs/data-reporting-overview) for more information about events and how to set up event notifications.",
"parameters": [],
"operationId": "corporate-v2-post-scheduled-payments",
"tags": [
"Payments"
],
"requestBody": {
"description": "Request body",
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ScheduledPaymentV2Request"
},
"examples": {
"Credit transaction": {
"value": {
"credit": {
"external_account_id": "289",
"processing_code": "220035"
},
"amount": {
"currency": "USD",
"value": 100
},
"soft_descriptor": "Debit operation",
"tracking_id": "0a50c88a-ade8-4bcc-a639-9a0b0f11e244",
"schedule_datetime": "2023-03-10T19:05:56.743Z"
}
},
"Debit transaction": {
"value": {
"debit": {
"external_account_id": "289",
"processing_code": "220037"
},
"amount": {
"currency": "USD",
"value": 100
},
"soft_descriptor": "Debit operation",
"tracking_id": "0a50c88a-ade8-4bcc-a639-9a0b0f11e244",
"schedule_datetime": "2023-03-10T19:05:56.743Z"
}
},
"Debit transaction with earmark": {
"value": {
"debit": {
"external_account_id": "289",
"processing_code": "219251",
"earmark_id": "632b378a-2248-11ee-be56-0242ac120002"
},
"amount": {
"currency": "USD",
"value": 100
},
"soft_descriptor": "Debit operation from earmark balance",
"tracking_id": "0a50c88a-ade8-4bcc-a639-9a0b0f11e244",
"schedule_datetime": "2023-03-10T19:05:56.743Z"
}
},
"Transfer transaction": {
"value": {
"credit": {
"external_account_id": "289",
"processing_code": "220035",
"soft_descriptor": "Transfer - Credit leg",
"metadata": {
"invoice": 298
}
},
"debit": {
"external_account_id": "289",
"processing_code": "220037",
"soft_descriptor": "Transfer - Debit leg",
"metadata": {
"invoice": 892
}
},
"amount": {
"currency": "USD",
"value": 100
},
"tracking_id": "0a50c88a-ade8-4bcc-a639-9a0b0f11e244",
"schedule_datetime": "2023-03-10T19:05:56.743Z"
}
},
"Transfer from earmark balance transaction": {
"value": {
"credit": {
"external_account_id": "289",
"processing_code": "220035"
},
"debit": {
"external_account_id": "289",
"processing_code": "220037",
"earmark_id": "632b378a-2248-11ee-be56-0242ac120002"
},
"amount": {
"currency": "USD",
"value": 100
},
"soft_descriptor": "Transfer operation from earmark balance",
"tracking_id": "0a50c88a-ade8-4bcc-a639-9a0b0f11e244",
"metadata": {
"invoice": 298
},
"schedule_datetime": "2023-03-10T19:05:56.743Z"
}
},
"Force transfer transaction": {
"value": {
"credit": {
"external_account_id": "289",
"processing_code": "220035",
"soft_descriptor": "Force transfer - Credit leg",
"metadata": {
"invoice": 298
}
},
"debit": {
"external_account_id": "289",
"processing_code": "220037",
"soft_descriptor": "Force transfer - Debit leg",
"metadata": {
"invoice": 892
}
},
"amount": {
"currency": "USD",
"value": 100
},
"tracking_id": "0a50c88a-ade8-4bcc-a639-9a0b0f11e244",
"force_post": true,
"schedule_datetime": "2023-03-10T19:05:56.743Z"
}
},
"Transfer transaction with validation rules": {
"value": {
"credit": {
"external_account_id": "289",
"processing_code": "220035"
},
"debit": {
"external_account_id": "289",
"processing_code": "220037"
},
"amount": {
"currency": "USD",
"value": 100
},
"soft_descriptor": "Transfer operation with validation rules",
"tracking_id": "0a50c88a-ade8-4bcc-a639-9a0b0f11e244",
"validation_rules": {
"ACCOUNT_STATUS": {
"override": true
},
"LEDGER": {
"force": true
}
},
"metadata": {
"invoice": 298
},
"schedule_datetime": "2023-03-10T19:05:56.743Z"
}
}
}
}
}
},
"responses": {
"201": {
"description": "Created",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ScheduledPaymentResponse"
}
}
}
},
"400": {
"description": "Bad request",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
},
"examples": {
"Invalid JSON payload": {
"value": {
"code": "WPMT0017",
"message": "Invalid JSON payload received: Error unmarshalling request"
}
},
"Processing code exceed size": {
"value": {
"code": "WPMT0018",
"message": "processing_code must be a maximum of 6 characters in length"
}
},
"External Account ID exceed size": {
"value": {
"code": "WPMT0018",
"message": "external_account_id must be a maximum of 60 characters in length"
}
},
"External Account ID required": {
"value": {
"code": "WPMT0018",
"message": "external_account_id is a required field"
}
},
"Amount value less than zero": {
"value": {
"code": "WPMT0018",
"message": "value must be 0 or greater"
}
},
"Amount value exceed": {
"value": {
"code": "WPMT0018",
"message": "amount must be 100,000,000,000,000,000 or less"
}
},
"Amount value required": {
"value": {
"code": "WPMT0018",
"message": "value is a required field"
}
},
"Tracking ID exceed size": {
"value": {
"code": "WPMT0018",
"message": "tracking_id must be a maximum of 43 characters in length"
}
},
"Primary and leg metadata conflict": {
"value": {
"code": "WPMT0018",
"message": "Cannot use primary and payment legs metadata fields together"
}
},
"Primary and leg soft descriptor conflict": {
"value": {
"code": "WPMT0018",
"message": "Cannot use primary and payment legs soft_descriptor fields together"
}
},
"Scheduled datetime in the past": {
"value": {
"code": "WCMN0002",
"message": "scheduleDatetime: The scheduled datetime earlier than the current datetime"
}
},
"Scheduled datetime too close to current datetime": {
"value": {
"code": "WCMN0002",
"message": "scheduleDatetime: The scheduled datetime is too close to the current datetime"
}
},
"Unrecognized account ID type": {
"value": {
"code": "WCAC0010",
"message": "Token contains an unrecognized account ID type"
}
},
"Invalid debit processing code": {
"value": {
"code": "WPMT0005",
"message": "Invalid debit processing code"
}
},
"Invalid credit processing code": {
"value": {
"code": "WPMT0006",
"message": "Invalid credit processing code"
}
},
"Action not permitted": {
"value": {
"code": "WPMT0014",
"message": "Action not permitted on a closed account"
}
},
"Schedule payment as creditor not permitted": {
"value": {
"code": "WPMT0020",
"message": "Scheduling a payment crediting your own account isn't allowed"
}
},
"Tracking ID required": {
"value": {
"code": "WPMT0018",
"message": "tracking_id is a required field"
}
},
"Currency required": {
"value": {
"code": "WPMT0018",
"message": "currency is a required field"
}
},
"Account has not finished onboarding": {
"value": {
"code": "WPMT0053",
"message": "Account has not finished onboarding"
}
}
}
}
}
},
"401": {
"description": "Unauthorized",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
},
"examples": {
"Unauthorized account": {
"value": {
"code": "WCAC0001",
"message": "Account not authorized"
}
}
}
}
}
},
"403": {
"$ref": "#/components/responses/403Forbidden"
},
"500": {
"$ref": "#/components/responses/500InternalServer"
}
}
}
}
}
}
```