api-bank-wire-transfer.rst (6769B)
1 .. 2 This file is part of GNU TALER. 3 Copyright (C) 2026 Taler Systems SA 4 5 TALER is free software; you can redistribute it and/or modify it under the 6 terms of the GNU Affero General Public License as published by the Free Software 7 Foundation; either version 2.1, or (at your option) any later version. 8 9 TALER is distributed in the hope that it will be useful, but WITHOUT ANY 10 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 11 A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. 12 13 You should have received a copy of the GNU Affero General Public License along with 14 TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> 15 16 .. _taler-wire-transfer-gateway-http-api: 17 18 ==================================== 19 Taler Wire Transfer Gateway HTTP API 20 ==================================== 21 22 This section describes the API offered by Taler wire adapters. The API is 23 used by clients such as wallets to prepare wire transfers. This allows the use 24 of wire-specific subject format or optimized alternating wire transfer flows, 25 and enables the use of recurring wire transfers. 26 27 .. http:get:: /config 28 29 Return the protocol version and configuration information about the bank. 30 This specification corresponds to ``current`` protocol being version **1**. 31 32 **Response:** 33 34 :http:statuscode:`200 OK`: 35 The adapter responds with a `WireTransferConfig` object. This request 36 should virtually always be successful. 37 38 **Details:** 39 40 .. ts:def:: SubjectFormat 41 42 type SubjectFormat = 43 | "SIMPLE" 44 | "URI" 45 | "CH_QR_BILL"; 46 47 .. ts:def:: WireTransferConfig 48 49 interface WireTransferConfig { 50 // Name of the API. 51 name: "taler-wire-transfer-gateway"; 52 53 // libtool-style representation of the Bank protocol version, see 54 // https://www.gnu.org/software/libtool/manual/html_node/Versioning.html#Versioning 55 // The format is "current:revision:age". 56 version: string; 57 58 // Currency used by this gateway. 59 currency: string; 60 61 // URN of the implementation (needed to interpret 'revision' in version). 62 // @since v0, may become mandatory in the future. 63 implementation?: string; 64 65 // Supported formats for registration, there must at least one. 66 supported_formats: SubjectFormat[]; 67 } 68 69 ----------------------- 70 Prepared wire transfers 71 ----------------------- 72 73 .. http:post:: /registration 74 75 Register a public key for wire transfer use. 76 77 This endpoint generate appropriate subjects to link a transfer to the 78 registered public key. 79 80 Two public keys must be provided, the ``account_pub`` key is the key that 81 will forwarded to the exchange and the ``authorization_pub`` key will be 82 encoded inside the subject. 83 84 For simple one time wire transfers, use the same key for both ``account_pub`` 85 and ``authorization_pub``. For recurrent transfers, use a single 86 ``authorization_pub`` for different ``account_pub``. 87 88 If registered as ``recurrent`` the wire adapters will keep incoming transfers 89 reusing the same subject until a registration is performed, else it will 90 bounce. 91 92 Registration with the same ``authorization_pu`` will replace the existing information registered for the key. 93 94 **Request:** 95 96 .. ts:def:: RegistrationRequest 97 98 interface RegistrationRequest { 99 // Amount to transfer 100 credit_amount: Amount; 101 102 // Transfer types 103 type: "reserve" | "kyc"; 104 105 // Public key algorithm 106 alg: "EdDSA"; 107 108 // Account public key for the exchange 109 account_pub: EddsaPublicKey; 110 111 // Public key encoded inside the subject 112 authorization_pub: EddsaPublicKey; 113 114 // Signature of the account_pub key using the authorization_pub private key 115 authorization_sig: EddsaSignature; 116 117 // Whether the authorization_pub will be reused for recurrent transfers 118 // Disable bounces in case of authorization_pub reuse 119 recurrent: boolean; 120 } 121 122 **Response:** 123 124 :http:statuscode:`200 Ok`: 125 Response is a `RegistrationResponse`. 126 :http:statuscode:`400 Bad request`: 127 Input data was invalid. 128 :http:statuscode:`409 Conflict`: 129 * ``TALER_EC_BANK_DUPLICATE_RESERVE_PUB_SUBJECT``: the same reserve public key is already registered, you should retry using another key. 130 * ``TALER_EC_BANK_DERIVATION_REUSE``: derived subject is already used, you should retry using another key. 131 * ``TALER_EC_BANK_BAD_SIGNATURE``: signature is invalid. 132 133 **Details:** 134 135 .. ts:def:: TransferSubject 136 137 // Union discriminated by the "type" field. 138 type TransferSubject = 139 | SimpleSubject 140 | UriSubject 141 | SwissQrBillSubject; 142 143 .. ts:def:: SimpleSubject 144 145 interface SimpleSubject { 146 // Subject for system accepting large subjects 147 type: "SIMPLE"; 148 149 // Amount to transfer 150 credit_amount: Amount; 151 152 // Encoded string containing either the full key and transfer type or a 153 // derived short subject 154 subject: string; 155 } 156 157 .. ts:def:: UriSubject 158 159 interface UriSubject { 160 // Subject for system accepting prepared payments 161 type: "URI"; 162 163 // Amount to transfer 164 credit_amount: Amount; 165 166 // Prepared payments confirmation URI 167 uri: string; 168 } 169 170 .. ts:def:: SwissQrBillSubject 171 172 interface SwissQrBillSubject { 173 // Subject for Swiss QR Bill 174 type: "CH_QR_BILL"; 175 176 // Amount to transfer 177 credit_amount: Amount; 178 179 // 27-digit QR Reference number 180 qr_reference_number: string; 181 } 182 183 .. ts:def:: RegistrationResponse 184 185 interface RegistrationResponse { 186 // The transfer subject encoded in all supported formats 187 subjects: TransferSubject[]; 188 189 // Expiration date after which this subject is expected to be reused 190 expiration: Timestamp; 191 } 192 193 .. http:delete:: /registration 194 195 Remove an existing registered public key for wire transfer use. 196 197 Use this endpoint to free a derived subject or cancel a recurrent paiment. 198 199 200 **Request:** 201 202 .. ts:def:: Unregistration 203 204 interface Unregistration { 205 // Current timestamp in the ISO 8601 206 timestamp: string; 207 208 // Public key used for registration 209 authorization_pub: EddsaPublicKey; 210 211 // Signature of the timestamp using the authorization_pub private key 212 // Prevent replay attack 213 authorization_sig: EddsaSignature; 214 } 215 216 **Response:** 217 218 :http:statuscode:`204 No content`: 219 The registration have been deleted. 220 :http:statuscode:`400 Bad request`: 221 Input data was invalid. 222 :http:statuscode:`404 Not found`: 223 Unknown registration. 224 :http:statuscode:`409 Conflict`: 225 * ``TALER_EC_BANK_OLD_TIMESTAMP``: the timestamp is too old. 226 * ``TALER_EC_BANK_BAD_SIGNATURE``: signature is invalid.