# Implementing Recurring Payments

Hyp does not provide built-in subscription lifecycle management. It does not store the charge interval, amount, or other recurring payment settings. As the merchant, you are responsible for managing subscription lifecycles internally and using Hyp's API only to execute the transactions.

The API flow differs between the initial payment and subsequent payments.

## Initial payment using the payment page

When a customer makes the initial purchase — for example, signs up for a SaaS subscription with monthly billing — you collect the first payment through [Hyp's standard payment page](/creditguard/payment-page-integration/integrating-hyps-payment-page-and-accepting-payment.md).

When Hyp performs a [payment completion redirect](/creditguard/payment-page-integration/integrating-hyps-payment-page-and-accepting-payment.md#handle-payment-completion-redirect), save the following URL parameters:

1. `cardToken`: the [token](/creditguard/additional-payment-scenarios/tokenization.md) of the customer's card created by Hyp.
2. `cardExp`: the card's expiration date.

You will need these values to initiate subsequent payments.

{% hint style="info" %}
Some terminals also require the cardholder's Israeli ID number (תעודת זהות). In this case, you must save the ID number along with the token and expiration date. You receive the ID from the payment completion redirect as the `personalId` URL parameter and then use it in payment requests as the `id` parameter. Note that the Israeli ID number is considered sensitive personal data under privacy regulations such as the GDPR and the Israeli Privacy Law. As a merchant, you are responsible for ensuring the secure storage and handling of this information.
{% endhint %}

## Second and subsequent payments

On the next billing date, perform a server-to-server payment request without customer interaction. Send a [standard Hyp API request](/creditguard/introduction/request-and-response-general-structure.md) with the `doDeal` command payload in the `int_in` parameter:

```xml
<ashrait>
    <request>
        <version>2000</version>
        <language>ENG</language>
        <command>doDeal</command>
        <doDeal>
            <terminalNumber>{terminalNumber}</terminalNumber>
            <cardId>{cardToken}</cardId>
            <cardExpiration>{cardExp}</cardExpiration>
            <total>{total}</total>
            <transactionType>Debit</transactionType>
            <creditType>RegularCredit</creditType>
            <currency>ILS</currency>
            <transactionCode>Internet</transactionCode>
            <validation>AutoComm</validation>
        </doDeal>
    </request>
</ashrait>
```

Variable parameters of the `doDeal` command in the server-to-server request are:

* `terminalNumber`: a unique number assigned to you as a merchant during [registration](/creditguard/introduction/prerequisites-and-requirements.md).
* `cardId`: the card token that Hyp returned as the `cardToken` URL parameter in the payment completion redirect after the first payment.
* `cardExpiration`: the card expiration date that Hyp returned as the `cardExp` URL parameter in the payment completion redirect.
* `total`: the scheduled payment amount.

Here is an example of a successful response to the server-to-server payment request:

<details>

<summary>Show response</summary>

```xml
<?xml version='1.0'?>
<ashrait>
    <response>
        <command>doDeal</command>
        <dateTime>2025-08-20 20:18</dateTime>
        <requestId/>
        <tranId>119589610</tranId>
        <result>000</result>
        <message>Permitted transaction</message>
        <userMessage>Permitted transaction</userMessage>
        <additionalInfo>Host Result Remote 00-SUCCESS</additionalInfo>
        <version>2000</version>
        <language>Eng</language>
        <doDeal>
            <status>000</status>
            <statusText>Permitted transaction</statusText>
            <extendedStatus/>
            <extendedStatusText/>
            <extendedUserMessage/>
            <terminalNumber>0882819014</terminalNumber>
            <cardId>1092880571131111</cardId>
            <cardBin>411111</cardBin>
            <cardMask>411111******1111</cardMask>
            <cardLength>16</cardLength>
            <cardNo>xxxxxxxxxxxx1111</cardNo>
            <cardName/>
            <cardExpiration>0428</cardExpiration>
            <cardType code="99">Foreign</cardType>
            <extendedCardType code="0">Credit</extendedCardType>
            <blockedCard/>
            <lifeStyle/>
            <customCardType/>
            <creditCompany code="0">Foreign</creditCompany>
            <cardBrand code="2">Visa</cardBrand>
            <cardAcquirer code="6">Alphacard</cardAcquirer>
            <serviceCode/>
            <transactionType code="01">RegularDebit</transactionType>
            <creditType code="1">RegularCredit</creditType>
            <currency code="1">ILS</currency>
            <baseCurrency/>
            <baseAmount/>
            <transactionCode code="52">Internet</transactionCode>
            <total>10000</total>
            <firstPayment/>
            <periodicalPayment/>
            <numberOfPayments/>
            <clubId/>
            <validation code="4">AutoComm</validation>
            <idStatus code="0">Absent</idStatus>
            <cvvStatus code="3">NotValidated</cvvStatus>
            <authSource code="2">CreditCompany</authSource>
            <authNumber>6369681</authNumber>
            <fileNumber>55</fileNumber>
            <slaveTerminalNumber>086</slaveTerminalNumber>
            <slaveTerminalSequence>533</slaveTerminalSequence>
            <eci>7</eci>
            <clientIp/>
            <email/>
            <cavv code=""/>
            <user/>
            <addonData/>
            <supplierNumber>300012</supplierNumber>
            <id/>
            <shiftId1/>
            <shiftId2/>
            <shiftId3/>
            <shiftTxnDate/>
            <cgUid>119589610</cgUid>
            <cardHash/>
            <acquirerData>
                <gateway>AshraitEmv</gateway>
                <acquirerTranType>01</acquirerTranType>
                <mcc>4121</mcc>
                <acquirerResponseId>485020124553</acquirerResponseId>
                <avsResponse code="0">Absent</avsResponse>
                <acquirerTranCode>52</acquirerTranCode>
            </acquirerData>
            <ashraitEmvData>
                <uid>25082020185308828196109</uid>
                <authCodeCreditCompany code="1">CreditCompanyAuthorized</authCodeCreditCompany>
                <idFlag>0</idFlag>
                <manufId>CGD</manufId>
                <catLevel>0</catLevel>
                <manufUse>001101</manufUse>
                <ashVersion>x</ashVersion>
                <ashTermType>0</ashTermType>
                <emvResponseCode>00</emvResponseCode>
                <deviceStatus>1111000000</deviceStatus>
                <ashReasonText>SUG_ISKA</ashReasonText>
                <authCodeAcquirer code="0">NoAuthNumber</authCodeAcquirer>
                <isDoReverseDeal>0</isDoReverseDeal>
                <mti>100</mti>
            </ashraitEmvData>
            <extendedTranCode/>
            <sendNotification/>
        </doDeal>
    </response>
</ashrait>
```

</details>

Repeat the same server-to-server payment request on each subsequent billing date.


---

# 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/recurring-payments-and-subscriptions/implementing-recurring-payments.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.
