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