# Cancel Transaction

{% hint style="info" %}
Transaction with status paid can't be canceled using this API
{% endhint %}

**Endpoint URL Cancel Transaction**

The endpoint URL is a feedback URL that will process the data in the inquiry from the merchant system. For the implementation of the testing, UAT can use URL development.

<table><thead><tr><th width="140">Type</th><th width="159">Environment</th><th>URL</th></tr></thead><tbody><tr><td><strong>XML</strong></td><td>Development</td><td><a href="https://debit-sandbox.faspay.co.id/pws/100005/183xx00010100000">https://debit-sandbox.faspay.co.id/pws/100005/183xx00010100000</a></td></tr><tr><td><strong>JSON</strong></td><td>Development</td><td><a href="https://debit-sandbox.faspay.co.id/cvr/100005/10">https://debit-sandbox.faspay.co.id/cvr/100005/10</a></td></tr></tbody></table>

**Request Parameter Cancel Transaction**

Transaction cancel the request parameters are parameters that the merchant system must provide to cancel the transaction into the system inquiry Faspay.

{% tabs %}
{% tab title="Request" %}

<table><thead><tr><th width="171">Parameter</th><th width="184">Data Type</th><th width="76">M/O/C</th><th width="191">Description</th></tr></thead><tbody><tr><td>request</td><td>Alphanumeric (50)</td><td>O</td><td>Request Description</td></tr><tr><td>trx_id</td><td>Numeric (16)</td><td>M</td><td>Transaction ID (Issued/generated by Faspay (Media Indonusa)) Notes: Unique Transaction ID for 1 day or as long as it hasn't been paid and hasn't expired</td></tr><tr><td>merchant_id</td><td>Numeric (5)</td><td>M</td><td>Merchant Code</td></tr><tr><td>merchant</td><td>Alphanumeric (32)</td><td>O</td><td>Merchant Name</td></tr><tr><td>bill_no</td><td>Alphanumeric (32)</td><td>M</td><td>Order Number</td></tr><tr><td>payment_cancel</td><td>Alphanumeric (50)</td><td>M</td><td>Cancellation Description</td></tr><tr><td>signature</td><td>Alphanumeric</td><td>M</td><td><p>sha1(md5(user_id+</p><p>password+bill_no))</p></td></tr></tbody></table>
{% endtab %}

{% tab title="Sample XML Request" %}

```xml
<faspay>
    <request>Canceling Payment</request>
    <trx_id>3100440033666278</trx_id>
    <merchant_id>31004</merchant_id>
    <merchant>Sophia Store</merchant>
    <bill_no>31004001</bill_no>
    <payment_cancel>Item Out of Stock</payment_cancel>
    <signature>be8791ac5f10bb042834896598bfc6bb9aadcbf9</signature>
</faspay>
```

{% endtab %}

{% tab title="Sample JSON Request" %}

```json
{
 "request":"Canceling Payment",
 "trx_id":"9999970700002782",
 "merchant_id":"99999",
 "merchant" : "Sophia Store",
 "bill_no":"8226",
 "payment_cancel" : "Item Out of Stock",
 "signature":"6d16537c525b0e8450cdf5d4e67fbc24b1ed41c5"
}
```

{% endtab %}
{% endtabs %}

**Response Parameter Cancel Transaction**

Response parameters are parameters that will be delivered by the system Faspay in response to the request parameters that have been sent by the merchant system. If no parameters are appropriate / value is incorrect, the transaction will be rejected in the system Faspay.

{% tabs %}
{% tab title="Response" %}

<table><thead><tr><th width="225">Parameter</th><th width="185">Data Type</th><th width="77">M/O/C</th><th width="184">Description</th></tr></thead><tbody><tr><td>response</td><td>Alphanumeric (50)</td><td>O</td><td>Request Description</td></tr><tr><td>trx_id</td><td>Numeric (16)</td><td>M</td><td>Transaction ID (Issued/generated by Faspay (Media Indonusa)) Notes: Unique Transaction ID for 1 day or as long as it hasn't been paid and hasn't expired</td></tr><tr><td>merchant_id</td><td>Numeric (5)</td><td>M</td><td>Merchant Code</td></tr><tr><td>merchant</td><td>Alphanumeric (32)</td><td>O</td><td>Merchant Name</td></tr><tr><td>bill_no</td><td>Alphanumeric (32)</td><td>M</td><td>Order Number</td></tr><tr><td>trx_status_code</td><td>Numeric</td><td>M</td><td>Transaction Status</td></tr><tr><td>trx_status_desc</td><td>Alphanumeric (32)</td><td>M</td><td>Transaction Status Description</td></tr><tr><td>payment_status_code</td><td>Numeric (1)</td><td><strong>M</strong></td><td>Payment status code</td></tr><tr><td>payment_status_desc</td><td>Alphanumeric (32)</td><td>M</td><td>Payment Status Description</td></tr><tr><td>payment_cancel_msg</td><td>Alphanumeric (50)</td><td>M</td><td>Payment Cancel Reason's Message</td></tr><tr><td>payment_cancel_date</td><td>Datetime</td><td>M</td><td>Payment Cancel Date</td></tr><tr><td>response_code</td><td>Alphanumeric (2)</td><td>M</td><td>Response Code 00 Success</td></tr><tr><td>response_desc</td><td>Alphanumeric (32)</td><td>M</td><td>Response Description</td></tr></tbody></table>
{% endtab %}

{% tab title="Sample XML Response" %}

```xml
<faspay>
    <response>Canceling Payment</response>
    <trx_id>3100440033666278</trx_id>
    <merchant_id>31004</merchant_id>
    <merchant>Sophia Store</merchant>
    <bill_no>31004001</bill_no>
    <payment_cancel>Item Out of Stock</payment_cancel>
    <signature>be8791ac5f10bb042834896598bfc6bb9aadcbf9</signature>
</faspay>
```

{% endtab %}

{% tab title="Sample JSON Response" %}

```json
{
    "response": "Canceling Payment",
    "trx_id": "9999970700002782",
    "merchant_id": "99999",
    "merchant": "Sophia Store",
    "bill_no": "8226",
    "trx_status_code": "3",
    "trx_status_desc": "Order Expired",
    "payment_status_code": "7",
    "payment_status_desc": "Payment Expired",
    "payment_cancel_date": [],
    "payment_cancel": "Item Out of Stock",
    "response_code": "54",
    "response_desc": "Your Transaction has been Expired."
}
```

{% endtab %}
{% endtabs %}
