# PWI-Retrieve

When the card details are entered in the payment form and the "Pay X TL" button is pressed, iyzico will redirect to the `callbackUrl` address that you specified during the creation of the payment form. At this address, a `token` value will be posted by iyzico. To view additional details about the payment results, a second query must be made using this `token`.

Following service represents the usage of token;

## Pay with iyzico (PWI) — Retrieve

> Queries the PWI transaction result by token.

```json
{"openapi":"3.0.3","info":{"title":"Pay with iyzico (PWI)","version":"1.0.0"},"servers":[{"url":"https://api.iyzipay.com","description":"iyzico API"}],"paths":{"/payment/iyzipos/checkoutform/auth/ecom/detail":{"post":{"summary":"Pay with iyzico (PWI) — Retrieve","description":"Queries the PWI transaction result by token.","tags":["Pay with iyzico"],"parameters":[{"$ref":"#/components/parameters/AuthHeader"},{"$ref":"#/components/parameters/ContentTypeHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PwiRetrieveRequest"}}}},"responses":{"200":{"description":"Successful response (payment completed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PwiPaymentResponse"}}}},"400":{"description":"Bad request / validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}},"components":{"parameters":{"AuthHeader":{"name":"Authorization","in":"header","required":true,"description":"Authorization header; starts with IYZWSv2 and is a signed hash in Base64.","schema":{"type":"string"}},"ContentTypeHeader":{"name":"Content-Type","in":"header","required":true,"schema":{"type":"string"}}},"schemas":{"PwiRetrieveRequest":{"type":"object","required":["token"],"properties":{"locale":{"type":"string","enum":["tr","en"],"description":"Language code. Default; tr"},"conversationId":{"type":"string","description":"Request/response correlation ID."},"token":{"type":"string","description":"Token of the PWI session to be retrieved."}}},"PwiPaymentResponse":{"type":"object","properties":{"status":{"type":"string","description":"Outcome of the request.","enum":["success","failure"]},"locale":{"type":"string","description":"Response language (tr/en).","enum":["tr","en"]},"systemTime":{"type":"integer","description":"Timestamp (epoch ms)."},"conversationId":{"type":"string","description":"Correlation ID of the request."},"price":{"type":"decimal","description":"Basket total."},"paidPrice":{"type":"decimal","description":"Total collected amount."},"installment":{"type":"integer","description":"Installment count."},"paymentId":{"type":"string","description":"Payment ID."},"fraudStatus":{"type":"integer","description":"Fraud status of the payment.\n- 1: Approved\n- 0: In review\n- -1: Rejected\n","enum":[1,0,-1]},"merchantCommissionRate":{"type":"decimal","description":"Merchant’s commission/deferral rate (informational). For example, if price=100 and paidPrice=110, the rate is 10%."},"merchantCommissionRateAmount":{"type":"decimal","description":"Merchant’s commission/deferral amount (informational). For example, if price=100 and paidPrice=110, the amount is 10."},"iyziCommissionRateAmount":{"type":"decimal","description":"iyzico commission amount for the payment."},"iyziCommissionFee":{"type":"decimal","description":"iyzico fee for the payment."},"cardType":{"type":"string","description":"Card type.","enum":["CREDIT_CARD","DEBIT_CARD","PREPAID_CARD"]},"cardAssociation":{"type":"string","description":"Card association.","enum":["VISA","MASTER_CARD","AMERICAN_EXPRESS","TROY"]},"cardFamily":{"type":"string","description":"Card family.","enum":["Bonus","Axess","World","Maximum","Paraf","CardFinans"]},"binNumber":{"type":"string","description":"BIN (first 8 digits)."},"lastFourDigits":{"type":"string","description":"Last four digits of the card."},"basketId":{"type":"string","description":"Basket ID."},"currency":{"type":"string","description":"Currency of the payment.","enum":["TRY","USD","EUR","NOK","CHF","GBP"]},"itemTransactions":{"type":"array","description":"Transaction items for basket lines.","items":{"type":"object","properties":{"paymentTransactionId":{"type":"string","description":"Payment line ID; must be stored by the merchant (used for refund/capture/void and communication)."},"itemId":{"type":"string","description":"Item ID provided by the merchant."},"price":{"type":"decimal","description":"Amount of the basket item on the merchant side."},"paidPrice":{"type":"decimal","description":"Collected amount distributed to this line; must be stored by the merchant."},"transactionStatus":{"type":"integer","description":"Line status:\n- 0: In fraud check\n- -1: Rejected after fraud check\n- 1: Approved (in marketplace: waiting for merchant approval)\n- 2: Approved (marketplace approved)\n","enum":[0,-1,1,2]},"blockageRate":{"type":"decimal","description":"Merchant blockage rate for this line (if applicable per agreement)."},"blockageRateAmountMerchant":{"type":"decimal","description":"Portion of the blockage amount reflected to the merchant."},"blockageResolvedDate":{"type":"string","description":"Blockage resolution date (yyyy-MM-dd HH:mm:ss), e.g., 2015-10-19 14:36:52."},"iyziCommissionFee":{"type":"decimal","description":"Distributed iyzico fee at line level."},"iyziCommissionRateAmount":{"type":"decimal","description":"Distributed iyzico commission amount at line level."},"merchantCommissionRate":{"type":"decimal","description":"Distributed merchant commission/deferral rate at line level."},"merchantCommissionRateAmount":{"type":"decimal","description":"Distributed merchant commission/deferral amount at line level."},"merchantPayoutAmount":{"type":"decimal","description":"Amount to be paid out to the merchant after fees/commissions/blockages."},"convertedPayout":{"type":"object","description":"Post-conversion calculations per line.","properties":{"paidPrice":{"type":"decimal","description":"Collected amount distributed to this line; must be stored by the merchant."},"iyziCommissionFee":{"type":"decimal","description":"Distributed iyzico fee at line level."},"iyziCommissionRateAmount":{"type":"decimal","description":"Distributed iyzico commission amount at line level."},"blockageRateAmountMerchant":{"type":"decimal","description":"Portion of blockage amount reflected to the merchant."},"merchantPayoutAmount":{"type":"decimal","description":"Amount to be paid out to the merchant after fees/commissions/blockages."},"iyziConversationRate":{"type":"decimal","description":"Conversion rate."},"iyziConversationRateAmount":{"type":"decimal","description":"Amount after conversion."},"currency":{"type":"string","description":"Currency."}}}}}},"authCode":{"type":"string","description":"Auth code returned by the bank."},"phase":{"type":"string","description":"Payment phase."},"hostReference":{"type":"string","description":"Bank-provided host reference for the payment."},"signature":{"type":"string","description":"Signature value for verification."},"token":{"type":"string","description":"Token associated with the transaction (returned by the retrieval)."},"callbackUrl":{"type":"string","description":"Callback URL sent at initialization."},"paymentStatus":{"type":"string","description":"Payment status.","enum":["SUCCESS","FAILURE"]},"memberEmail":{"type":"string","description":"Email of the member who paid via PWI."},"memberGsmNumber":{"type":"string","description":"GSM number of the member who paid via PWI."}}},"ErrorResponse":{"type":"object","properties":{"status":{"type":"string","description":"Success/failure indicator."},"errorCode":{"type":"string","description":"Error code."},"errorMessage":{"type":"string","description":"Error message."},"locale":{"type":"string","description":"Response language.","enum":["tr","en"]},"systemTime":{"type":"integer","description":"Timestamp (epoch ms)."},"conversationId":{"type":"string","description":"Correlation ID of the request."}}}}}}
```

#### Sample Codes

<table data-view="cards"><thead><tr><th></th></tr></thead><tbody><tr><td><a href="https://github.com/iyzico/iyzipay-php/blob/master/samples/retrieve_pay_with_iyzico_result.php">PHP</a></td></tr><tr><td><a href="https://github.com/iyzico/iyzipay-java/blob/master/src/test/java/com/iyzipay/sample/CheckoutFormSample.java#L118">Java</a></td></tr><tr><td><a href="https://github.com/iyzico/iyzipay-dotnet/blob/master/Iyzipay.Samples/PayWithIyzicoSample.cs#L107">.Net</a></td></tr><tr><td><a href="https://www.postman.com/iyzico/iyzico/request/usm3l8q/2-pay-with-iyzico-retrieve">Postman</a></td></tr></tbody></table>
