# Payouts

A payout is the transfer of funds from the merchant to the customer's credit card account that is not related to any prior transaction.

Unlike a [refund or a cancellation](/creditguard/additional-payment-scenarios/refunds-and-cancellations.md), which both rely on an original transaction having taken place, a payout is a way of paying a customer without the customer making an original purchase.

Payouts may be needed when the merchant accepts transactions outside of the Hyp ecosystem. Examples include:

1. The merchant uses a cash register that is not Hyp-enabled. They want to refund a customer to their credit card, but their cash register does not support refunds.
2. The merchant wants to reimburse a customer for some inconvenience, regardless of any existing transactions.

Payouts should not be used as a standard means of operation. They should be reserved for rare cases where no other options are applicable. In normal circumstances, a refund or a cancellation of the original transaction should be preferred.

If necessary, you can [cancel](/creditguard/additional-payment-scenarios/refunds-and-cancellations.md#performing-a-cancellation) a payout with a normal `CancelDeal` transaction, or [create an invoice](/creditguard/documents-and-invoicing/cancellations-payouts.md) for a payout in the same way you would for a debit transaction.

## Prerequisites

Most credit card providers make payouts available by default, meaning that no special configuration is needed.

## Performing a payout

There are two ways to perform a payout, depending on whether the customer's credit card has been used in your Hyp payment environment before.

### Performing a payout with an unknown credit card

If the customer's credit card has not been used in the past, send a [payment page request](/creditguard/payment-page-integration/integrating-hyps-payment-page-and-accepting-payment.md#create-a-payment-page-request) but set `transactionType` to `Credit` instead of `Debit`:

```xml
<ashrait>
      <request>
          <version>2000</version>
          <language>ENG</language>
          <command>doDeal</command>
          <doDeal>
              <terminalNumber>{terminalNumber}</terminalNumber>
              <cardNo>CGMPI</cardNo>
              <total>{payoutAmount}</total>
              <transactionType>Credit</transactionType>
              <creditType>RegularCredit</creditType>
              <currency>ILS</currency>
              <transactionCode>Internet</transactionCode>
              <validation>TxnSetup</validation>
              <mid>{mpi_mid}</mid>
              <uniqueid>{uniqueId}</uniqueid>
              <mpiValidation>AutoComm</mpiValidation>
              <successUrl>{successUrl}</successUrl>
              <errorUrl>{errorUrl}</errorUrl>
          </doDeal>
      </request>
  </ashrait>
```

The customer then needs to enter their credit card details on the payment page as they would for a debit transaction, but upon clicking **Pay**, they will receive a payout instead.

### Performing a payout with a known credit card

If you, as a merchant, have performed transactions with the payout recipient's credit card before, and you have saved the `cardToken` and `cardExp` values from the [payment completion redirect](/creditguard/payment-page-integration/integrating-hyps-payment-page-and-accepting-payment.md#handle-payment-completion-redirect), then you can perform a payout without requesting a payment page. Instead, send a `doDeal` command where:

* `transactionType` is set to `Credit`.
* `cardId` is set to the `cardToken` value saved from the payment completion redirect.
* `cardExpiration` is set to the `cardExp` value saved from the payment completion redirect.

Here's an example of a ₪400 payout request to a known credit card:

```xml
<ashrait>
    <request>
        <version>2000</version>
        <language>ENG</language>
        <command>doDeal</command>
        <doDeal>
            <terminalNumber>{terminalNumber}</terminalNumber>
            <transactionType>Credit</transactionType>
            <creditType>RegularCredit</creditType>
            <transactionCode>Phone</transactionCode>
            <cardId>1092880571131111</cardId>
            <cardExpiration>0328</cardExpiration>
            <currency>ILS</currency>
            <total>40000</total>
            <validation>AutoComm</validation>
        </doDeal>
    </request>
</ashrait>
```

If the `result` element in the response is `000`, the payout was successful.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developers.hyp.co.il/creditguard/additional-payment-scenarios/payouts.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
