> For the complete documentation index, see [llms.txt](https://docs.payengine.co/merchant-api-reference/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.payengine.co/merchant-api-reference/transactions/credit.md).

# Credit

This API can be used to issue credit to a card.

<mark style="color:green;">`POST`</mark> `https://<Platform-host>/api/payment/credit`

Request

#### Request Body

<table><thead><tr><th>Name</th><th width="168">Type</th><th>Description</th></tr></thead><tbody><tr><td>data.transactionAmount<mark style="color:red;">*</mark></td><td>string</td><td>Amount to be returned. Should be less or equal to available transaction amount</td></tr><tr><td>id<mark style="color:red;">*</mark></td><td>string</td><td>Transaction ID</td></tr><tr><td>data.cardToken</td><td>string</td><td>Card token generated by <a href="/pages/-MX0hgAknwVTOhFgMpb2">Platform secure field API</a></td></tr><tr><td>data.store_payment_method</td><td>boolean</td><td>true | false – Indicates whether the card should be stored for future use. Set to true to store the card. Defaults to true</td></tr><tr><td>data.initiated_by</td><td>string</td><td>merchant | customer – Indicates who initiated the transaction. Defaults to customer</td></tr><tr><td>data.description</td><td>string</td><td>Transaction description. Character limit is 255</td></tr><tr><td>data.gateway_id</td><td>string</td><td>Gateway ID (optional, if multigateway mode enabled)</td></tr></tbody></table>

{% tabs %}
{% tab title="200 " %}
{% tabs %}
{% tab title="Field Definitions" %}

| Field Name             | Type    | Description                                                                     | Required? |
| ---------------------- | ------- | ------------------------------------------------------------------------------- | --------- |
| ID                     | string  | Platform system ID for the sale request                                        | Required  |
| TransactionID          | string  | Unique transaction ID                                                           | Required  |
| MerchantID             | string  | Merchant ID                                                                     | Required  |
| description            | string  | Transaction description                                                         | Optional  |
| store\_payment\_method | boolean | Defaults to true                                                                | Optional  |
| initiated\_by          | string  | Defaults to customer                                                            | Optional  |
| ReturnResponse         | Object  | Refer to [Credit Card Sale](broken://pages/-Mi5hGCz8uhvn25-tdT8) (SaleResponse) | Required  |
| {% endtab %}           |         |                                                                                 |           |
| {% endtabs %}          |         |                                                                                 |           |
| {% endtab %}           |         |                                                                                 |           |
| {% endtabs %}          |         |                                                                                 |           |

### Sample Request / Response

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

#### Example Request

```json
{
    "id": "9a0df7ef-b77f-4525-97e1-f41a98ad7f75",
    "data": {
        "transactionAmount": "110.00",
        "cardToken": "card_sandbox_xxxx",
        "store_payment_method": true,
        "initiated_by": "customer", 
        "description": "Payment for the services",
        "metadata": {
            "customerId": "123",
            "email" : "test@test.com"
        }
    }
}
```

{% endtab %}

{% tab title="Response" %}

#### Example Response

```json
{
    "data": {
        "ID": "8b321c53-961d-4b52-aced-3039bed0fbc1",
        "MerchantID": "1e4e6029-2cc9-4b2c-87c1-7a4b2af6d6c6",
        "TransactionID": "668c5d3e-46d4-4a9d-9d17-bc1656ed0227",
        "Description": "Payment for the services",
        "store_payment_method": true,
        "initiated_by": "customer", 
        "ReturnResponse": {
            "status": "PASS",
            "responseCode": "A0000",
            "responseMessage": "Success",
            "authCode": "254424",
            "hostResponseCode": "00",
            "hostReferenceNumber": "751552357011",
            "taskID": "42072951",
            "transactionID": "57901671",
            "transactionTimestamp": "2025-04-02T19:04:26",
            "transactionAmount": "5.00",
            "processedAmount": "5.00",
            "totalAmount": "5.00",
            "addressVerificationCode": "X",
            "cardHolderVerificationCode": "N",
            "cardType": "visa",
            "maskedCardNumber": "1111",
            "customerReceipt": "        Sandbox US Merchant         \\n        200 Epcot Center Dr         \\n         Orlando, FL 32836          \\n            800-490-8514            \\n                 \\n                 \\n        2025-04-02 07:04 PM         \\n           CREDIT - SALE            \\n         Entry Mode : KEYED         \\n      Transaction ID: 57901671      \\nDescription: Payment for the service\\n                 s                  \\n        SUBTOTAL: USD $5.00         \\n          TOTAL: USD $5.00          \\n                 \\n                 \\n       NO SIGNATURE REQUIRED        \\n              APPROVED              \\n                 \\n                 \\n                 \\n                 \\n                 \\n                 \\n                 \\n                 \\n                 \\n                 \\n           Customer Copy            \\n",
            "merchantReceipt": "        Sandbox US Merchant         \\n        200 Epcot Center Dr         \\n         Orlando, FL 32836          \\n            800-490-8514            \\n                 \\n                 \\n        2025-04-02 07:04 PM         \\n           CREDIT - SALE            \\n         Entry Mode : KEYED         \\n      Transaction ID: 57901671      \\nDescription: Payment for the service\\n                 s                  \\n        SUBTOTAL: USD $5.00         \\n          TOTAL: USD $5.00          \\n                 \\n                 \\n      X_______________________      \\nI AGREE TO PAY ABOVE TOTAL AMOUNT IN\\n ACCORDANCE WITH CARD ISSUER's AGREE\\nMENT (MERCHANT AGREEMENT IF CREDIT V\\n              OUCHER)               \\n     KEEP COPY FOR YOUR RECORDS     \\n               \\n \\n                \\n              APPROVED              \\n                 \\n                 \\n                 \\n                 \\n                 \\n                 \\n                 \\n                 \\n                 \\n                 \\n           Merchant Copy            \\n",
            "returnedAmount": "5.00"
        },
        "Metadata": {
            "customerId": "123",
            "email": "test@test.com"
        }
    }
}
```

{% endtab %}
{% endtabs %}
