get-private-orders-ORDER_ID.rst (9465B)
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:`404 Not found`: 38 The order or instance is unknown to the backend. Error code 39 is set to either ``MERCHANT_GENERIC_ORDER_UNKNOWN`` or 40 ``MERCHANT_GENERIC_INSTANCE_UNKNOWN``. 41 :http:statuscode:`500 Internal Server Error`: 42 The server experienced an internal failure. 43 Returned with ``TALER_EC_GENERIC_DB_FETCH_FAILED``. 44 45 **Details:** 46 47 .. ts:def:: MerchantOrderStatusResponse 48 49 type MerchantOrderStatusResponse = CheckPaymentPaidResponse | 50 CheckPaymentClaimedResponse | 51 CheckPaymentUnpaidResponse; 52 53 .. ts:def:: CheckPaymentPaidResponse 54 55 interface CheckPaymentPaidResponse { 56 // The customer paid for this contract. 57 order_status: "paid"; 58 59 // Was the payment refunded (even partially)? 60 refunded: boolean; 61 62 // True if there are any approved refunds that the wallet has 63 // not yet obtained. 64 refund_pending: boolean; 65 66 // Did the exchange wire us the funds? 67 wired: boolean; 68 69 // Total amount the exchange deposited into our bank account 70 // for this contract, excluding fees. 71 deposit_total: Amount; 72 73 // Numeric `error code <error-codes>` indicating errors the exchange 74 // encountered tracking the wire transfer for this purchase (before 75 // we even got to specific coin issues). 76 // 0 if there were no issues. 77 exchange_code: Integer; 78 79 // HTTP status code returned by the exchange when we asked for 80 // information to track the wire transfer for this purchase. 81 // 0 if there were no issues. 82 exchange_http_status: Integer; 83 84 // Total amount that was refunded, 0 if refunded is false. 85 refund_amount: Amount; 86 87 // Contract terms. 88 contract_terms: ContractTerms; 89 90 // Index of the selected choice within the ``choices`` array of 91 // ``contract terms``. 92 // @since protocol **v21** 93 choice_index?: Integer; 94 95 // If the order is paid, set to the last time when a payment 96 // was made to pay for this order. @since **v14**. 97 last_payment: Timestamp; 98 99 // The wire transfer status from the exchange for this order if 100 // available, otherwise empty array. 101 wire_details: TransactionWireTransfer[]; 102 103 // Groups about trouble obtaining wire transfer details, 104 // empty array if no trouble were encountered. 105 // @deprecated in protocol **v6**. 106 wire_groups: TransactionWireReport[]; 107 108 // The refund details for this order. One entry per 109 // refunded coin; empty array if there are no refunds. 110 refund_details: RefundDetails[]; 111 112 // Status URL, can be used as a redirect target for the browser 113 // to show the order QR code / trigger the wallet. 114 order_status_url: string; 115 } 116 117 .. ts:def:: CheckPaymentClaimedResponse 118 119 interface CheckPaymentClaimedResponse { 120 // A wallet claimed the order, but did not yet pay for the contract. 121 order_status: "claimed"; 122 123 // Contract terms. 124 contract_terms: ContractTerms; 125 126 // Status URL, can be used as a redirect target for the browser 127 // to show the order QR code / trigger the wallet. 128 // Since protocol **v19**. 129 order_status_url: string; 130 } 131 132 .. ts:def:: CheckPaymentUnpaidResponse 133 134 interface CheckPaymentUnpaidResponse { 135 // The order was not yet claimed (and thus certainly also 136 // not yet paid). 137 order_status: "unpaid"; 138 139 // URI that the wallet must process to complete the payment. 140 taler_pay_uri: string; 141 142 // Time when the order was created. 143 creation_time: Timestamp; 144 145 // Deadline when the offer expires; the customer must pay before. 146 // @since protocol **v21**. 147 // @deprecated in **v25** (use proto_contract_terms.pay_deadline instead). 148 pay_deadline: Timestamp; 149 150 // Order summary text. 151 // @deprecated in **v25** (use proto_contract_terms.summary instead). 152 summary: string; 153 154 // We cannot return the "final" contract terms here because 155 // the ``nonce`` is not available because the wallet did not yet 156 // claim the order. 157 // So the "ProtoContractTerms" are basically the contract terms, 158 // but without the ``nonce``. 159 // @since protocol **v25**. 160 proto_contract_terms: ProtoContractTerms; 161 162 // Total amount of the order (to be paid by the customer). 163 // Will be undefined for unpaid v1 orders 164 // @deprecated in **v25** (use proto_contract_terms instead). 165 total_amount?: Amount; 166 167 // Alternative order ID which was paid for already in the same session. 168 // Only given if the same product was purchased before in the same session. 169 already_paid_order_id?: string; 170 171 // Fulfillment URL of an already paid order. Only given if under this 172 // session an already paid order with a fulfillment URL exists. 173 already_paid_fulfillment_url?: string; 174 175 // Status URL, can be used as a redirect target for the browser 176 // to show the order QR code / trigger the wallet. 177 order_status_url: string; 178 179 } 180 181 .. ts:def:: RefundDetails 182 183 interface RefundDetails { 184 // Reason given for the refund. 185 reason: string; 186 187 // True if a refund is still available for the wallet for this payment. 188 pending: boolean; 189 190 // When was the refund approved with a POST to 191 // [/instances/$INSTANCE]/private/orders/$ORDER_ID/refund 192 timestamp: Timestamp; 193 194 // Total amount that was refunded (minus a refund fee). 195 amount: Amount; 196 } 197 198 .. ts:def:: TransactionWireTransfer 199 200 interface TransactionWireTransfer { 201 // Responsible exchange. 202 exchange_url: string; 203 204 // 32-byte wire transfer identifier. 205 wtid: Base32; 206 207 // Execution time of the wire transfer. 208 execution_time: Timestamp; 209 210 // Total amount that has been wire transferred 211 // to the merchant from this exchange for this 212 // purchase. The ``deposit_fee`` was already 213 // subtracted. However, the ``wire_fee`` may still 214 // apply (but not to the order, only to the aggregated transfer). 215 amount: Amount; 216 217 // Deposit fees to be paid to the 218 // exchange for this order. 219 // Since **v26**. 220 deposit_fee: Amount; 221 222 // Was this transfer confirmed by the merchant via the 223 // POST /transfers API, or is it merely claimed by the exchange? 224 confirmed: boolean; 225 226 // Transfer serial ID of this wire transfer, useful as 227 // ``offset`` for the GET ``/private/incoming`` endpoint. 228 // Since **v25**. 229 expected_transfer_serial_id: Integer; 230 } 231 232 .. ts:def:: TransactionWireReport 233 234 interface TransactionWireReport { 235 // Numerical `error code <error-codes>`. 236 code: Integer; 237 238 // Human-readable error description. 239 hint: string; 240 241 // Numerical `error code <error-codes>` from the exchange. 242 exchange_code: Integer; 243 244 // HTTP status code received from the exchange. 245 exchange_http_status: Integer; 246 247 // Public key of the coin for which we got the exchange error. 248 coin_pub: CoinPublicKey; 249 }