get-private-orders-ORDER_ID.rst (9912B)
1 .. http:get:: [/instances/$INSTANCE]/private/orders/$ORDER_ID 2 3 Merchant checks the payment status of an order. If the order exists but is not paid 4 and not claimed yet, the response provides a redirect URL. When the user goes to this URL, 5 they will be prompted for payment. Differs from the ``public`` API both 6 in terms of what information is returned and in that the wallet must provide 7 the contract hash to authenticate, while for this API we assume that the 8 merchant is authenticated (as the endpoint is not ``public``). 9 10 **Required permission:** ``orders-read`` 11 12 **Request:** 13 14 :query session_id: *Optional*. Session ID that the payment must be bound to. If not specified, the payment is not session-bound. 15 :query transfer: Deprecated in protocol **V6**. *Optional*. If set to "YES", try to obtain the wire transfer status for this order from the exchange. Otherwise, the wire transfer status MAY be returned if it is available. 16 :query timeout_ms: *Optional*. Timeout in milliseconds to wait for a payment if the answer would otherwise be negative (long polling). 17 :query lp_not_etag=ETAG: *Optional*. 18 Specifies what status change we are long-polling for. 19 If specified, the endpoint will only return once the returned "Etag" 20 would differ from the ETAG specified by the client. The "Etag" 21 is computed over the entire response body, and thus assured to change 22 whenever any data point in the response changes. This is ideal for 23 clients that want to learn about any change in the response. Clients 24 using this query parameter should probably also set a "If-none-match" 25 HTTP header so that if the ``timeout_ms`` expires, they can get back 26 a "304 Not modified" with an empty body if nothing changed. 27 :query allow_refunded_for_repurchase: *Optional*. Since protocol **v9** refunded orders are only returned under "already_paid_order_id" if this flag is set explicitly to "YES". 28 29 **Response:** 30 31 :http:statuscode:`200 OK`: 32 Returns a `MerchantOrderStatusResponse`, whose format can differ based on the status of the payment. 33 :http:statuscode:`304 Not modified`: 34 The ``ETag`` in the response did not change compared to the one 35 given in the ``If-none-match`` HTTP header specified by the client. 36 @since protocol **v25**. 37 :http:statuscode:`400 Bad Request`: 38 A query parameter or HTTP header is malformed. 39 Returned with ``TALER_EC_GENERIC_PARAMETER_MALFORMED`` or 40 ``TALER_EC_GENERIC_HTTP_HEADERS_MALFORMED``. 41 :http:statuscode:`404 Not found`: 42 The order or instance is unknown to the backend. Error code 43 is set to either ``TALER_EC_MERCHANT_GENERIC_ORDER_UNKNOWN`` or 44 ``TALER_EC_MERCHANT_GENERIC_INSTANCE_UNKNOWN``. 45 :http:statuscode:`500 Internal Server Error`: 46 The server experienced an internal failure. 47 Returned with ``TALER_EC_GENERIC_DB_FETCH_FAILED``, 48 ``TALER_EC_GENERIC_DB_INVARIANT_FAILURE``, 49 ``TALER_EC_GENERIC_FAILED_COMPUTE_JSON_HASH``, 50 ``TALER_EC_MERCHANT_GENERIC_DB_CONTRACT_CONTENT_INVALID`` or 51 ``TALER_EC_MERCHANT_GET_ORDERS_ID_INVALID_CONTRACT_VERSION``. 52 53 **Details:** 54 55 .. ts:def:: MerchantOrderStatusResponse 56 57 type MerchantOrderStatusResponse = CheckPaymentPaidResponse | 58 CheckPaymentClaimedResponse | 59 CheckPaymentUnpaidResponse; 60 61 .. ts:def:: CheckPaymentPaidResponse 62 63 interface CheckPaymentPaidResponse { 64 // The customer paid for this contract. 65 order_status: "paid"; 66 67 // Was the payment refunded (even partially)? 68 refunded: boolean; 69 70 // True if there are any approved refunds that the wallet has 71 // not yet obtained. 72 refund_pending: boolean; 73 74 // Did the exchange wire us the funds? 75 wired: boolean; 76 77 // Total amount the exchange deposited into our bank account 78 // for this contract, excluding fees. 79 deposit_total: Amount; 80 81 // Numeric `error code <error-codes>` indicating errors the exchange 82 // encountered tracking the wire transfer for this purchase (before 83 // we even got to specific coin issues). 84 // 0 if there were no issues. 85 exchange_code: Integer; 86 87 // HTTP status code returned by the exchange when we asked for 88 // information to track the wire transfer for this purchase. 89 // 0 if there were no issues. 90 exchange_http_status: Integer; 91 92 // Total amount that was refunded, 0 if refunded is false. 93 refund_amount: Amount; 94 95 // Contract terms. 96 contract_terms: ContractTerms; 97 98 // Index of the selected choice within the ``choices`` array of 99 // ``contract terms``. 100 // @since protocol **v21** 101 choice_index?: Integer; 102 103 // If the order is paid, set to the last time when a payment 104 // was made to pay for this order. @since **v14**. 105 last_payment: Timestamp; 106 107 // The wire transfer status from the exchange for this order if 108 // available, otherwise empty array. 109 wire_details: TransactionWireTransfer[]; 110 111 // Groups about trouble obtaining wire transfer details, 112 // empty array if no trouble were encountered. 113 // @deprecated in protocol **v6**. 114 wire_groups: TransactionWireReport[]; 115 116 // The refund details for this order. One entry per 117 // refunded coin; empty array if there are no refunds. 118 refund_details: RefundDetails[]; 119 120 // Status URL, can be used as a redirect target for the browser 121 // to show the order QR code / trigger the wallet. 122 order_status_url: string; 123 } 124 125 .. ts:def:: CheckPaymentClaimedResponse 126 127 interface CheckPaymentClaimedResponse { 128 // A wallet claimed the order, but did not yet pay for the contract. 129 order_status: "claimed"; 130 131 // Contract terms. 132 contract_terms: ContractTerms; 133 134 // Status URL, can be used as a redirect target for the browser 135 // to show the order QR code / trigger the wallet. 136 // Since protocol **v19**. 137 order_status_url: string; 138 } 139 140 .. ts:def:: CheckPaymentUnpaidResponse 141 142 interface CheckPaymentUnpaidResponse { 143 // The order was not yet claimed (and thus certainly also 144 // not yet paid). 145 order_status: "unpaid"; 146 147 // URI that the wallet must process to complete the payment. 148 taler_pay_uri: string; 149 150 // Time when the order was created. 151 creation_time: Timestamp; 152 153 // Deadline when the offer expires; the customer must pay before. 154 // @since protocol **v21**. 155 // @deprecated in **v25** (use proto_contract_terms.pay_deadline instead). 156 pay_deadline: Timestamp; 157 158 // Order summary text. 159 // @deprecated in **v25** (use proto_contract_terms.summary instead). 160 summary: string; 161 162 // We cannot return the "final" contract terms here because 163 // the ``nonce`` is not available because the wallet did not yet 164 // claim the order. 165 // So the "ProtoContractTerms" are basically the contract terms, 166 // but without the ``nonce``. 167 // @since protocol **v25**. 168 proto_contract_terms: ProtoContractTerms; 169 170 // Total amount of the order (to be paid by the customer). 171 // Will be undefined for unpaid v1 orders 172 // @deprecated in **v25** (use proto_contract_terms instead). 173 total_amount?: Amount; 174 175 // Alternative order ID which was paid for already in the same session. 176 // Only given if the same product was purchased before in the same session. 177 already_paid_order_id?: string; 178 179 // Fulfillment URL of an already paid order. Only given if under this 180 // session an already paid order with a fulfillment URL exists. 181 already_paid_fulfillment_url?: string; 182 183 // Status URL, can be used as a redirect target for the browser 184 // to show the order QR code / trigger the wallet. 185 order_status_url: string; 186 187 } 188 189 .. ts:def:: RefundDetails 190 191 interface RefundDetails { 192 // Reason given for the refund. 193 reason: string; 194 195 // True if a refund is still available for the wallet for this payment. 196 pending: boolean; 197 198 // When was the refund approved with a POST to 199 // [/instances/$INSTANCE]/private/orders/$ORDER_ID/refund 200 timestamp: Timestamp; 201 202 // Total amount that was refunded (minus a refund fee). 203 amount: Amount; 204 } 205 206 .. ts:def:: TransactionWireTransfer 207 208 interface TransactionWireTransfer { 209 // Responsible exchange. 210 exchange_url: string; 211 212 // 32-byte wire transfer identifier. 213 wtid: Base32; 214 215 // Execution time of the wire transfer. 216 execution_time: Timestamp; 217 218 // Total amount that has been wire transferred 219 // to the merchant from this exchange for this 220 // purchase. The ``deposit_fee`` was already 221 // subtracted. However, the ``wire_fee`` may still 222 // apply (but not to the order, only to the aggregated transfer). 223 amount: Amount; 224 225 // Deposit fees to be paid to the 226 // exchange for this order. 227 // Since **v26**. 228 deposit_fee: Amount; 229 230 // Was this transfer confirmed by the merchant via the 231 // POST /transfers API, or is it merely claimed by the exchange? 232 confirmed: boolean; 233 234 // Transfer serial ID of this wire transfer, useful as 235 // ``offset`` for the GET ``/private/incoming`` endpoint. 236 // Since **v25**. 237 expected_transfer_serial_id: Integer; 238 } 239 240 .. ts:def:: TransactionWireReport 241 242 interface TransactionWireReport { 243 // Numerical `error code <error-codes>`. 244 code: Integer; 245 246 // Human-readable error description. 247 hint: string; 248 249 // Numerical `error code <error-codes>` from the exchange. 250 exchange_code: Integer; 251 252 // HTTP status code received from the exchange. 253 exchange_http_status: Integer; 254 255 // Public key of the coin for which we got the exchange error. 256 coin_pub: CoinPublicKey; 257 }