> ## Documentation Index
> Fetch the complete documentation index at: https://dokumentation.websale.de/llms.txt
> Use this file to discover all available pages before exploring further.

# EASYCREDIT- (installment purchase)

> The tags of the easyCredit installment purchase payment method: retrieve installment examples before the purchase, display the repayment plan and consent text in the ordering process, and evaluate errors.

With an installment purchase via easyCredit, it is not the shop that decides on the financing, but easyCredit. Everything the buyer gets to see is therefore retrieved by the shop from easyCredit at runtime: the installment example on the product page, the repayment plan in the ordering process, the consent text before the order.

The tags with the prefix `EASYCREDIT-` are the interface for this.

Guide: Payment method "easyCredit installment purchase"

## The pattern in three steps

The tags come in pairs. One tag **retrieves** the data from easyCredit, a second **contains** the response as JSON. The response is not output by WEBSALE, but via the JSON interface with the `EJD-` tags.

| Step | Tag |
| - | - |
| Retrieve data from easyCredit | `EASYCREDIT-Get…` |
| Pass the response to the JSON interface | `EJD-SetRawDataHexCodedInput()` and `EJD-LoadData()` |
| Output individual values | the `EJD-` tags |

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
~EASYCREDIT-GetModelCalculation($PR-Price$)~

~EJD-SetRawDataHexCodedInput($EASYCREDIT-ModelCalculationJSON$)~
~EJD-LoadData(intern,rawdatahexcodedinput,easycalc)~

{EJD-DataOK(easycalc)}
   ~EJD-SetUseID(easycalc)~
   <!-- Die Ausgabe der einzelnen Werte bauen Sie mit den EJD-Tags selbst auf -->
{/EJD-DataOK(easycalc)}
```

> [!NOTE]
>
> WEBSALE passes the response from easyCredit through unchanged. Which fields it contains is determined by easyCredit, not by the shop. You therefore always build the output yourself with the `EJD-` tags.

> [!WARNING]
>
> Every retrieval is a call to easyCredit and takes time. The shop therefore only retrieves the data the first time: if the response is already available, a second `EASYCREDIT-Get…` on the same page does nothing. Conversely, this also means that the response cannot be updated within a single page request.

Guide: JSON interface

## Overview of the five retrievals

| Retrieval | Response | Used for | Parameter |
| - | - | - | - |
| `EASYCREDIT-GetModelCalculation()` | `EASYCREDIT-ModelCalculationJSON` | an installment example for an amount | amount, required |
| `EASYCREDIT-GetCheapestModelCalculation()` | `EASYCREDIT-CheapestModelCalculationJSON` | the lowest installment for an amount | amount, required |
| `EASYCREDIT-GetRepaymentPlan` | `EASYCREDIT-RepaymentPlanJSON` | the general transaction data, the repayment plan | – |
| `EASYCREDIT-GetRepaymentPlanDetails` | `EASYCREDIT-RepaymentPlanDetailsJSON` | the detailed payment plan | – |
| `EASYCREDIT-GetAgreementText` | `EASYCREDIT-AgreementTextJSON` | the consent text | – |

> [!NOTE]
>
> The two upper retrievals serve advertising before the purchase and are only permitted on the start page, product overview, and product detail view. The three lower ones belong in the ordering process and are permitted there on the payment and shipping pages, the order overview, the confirmation pages, and the confirmation email.

## Installment examples before the purchase

On the product page, an installment example shows what the item costs per month. `EASYCREDIT-GetModelCalculation()` retrieves it; the amount goes in the parentheses.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
~EASYCREDIT-GetModelCalculation($PR-Price$)~

~EJD-SetRawDataHexCodedInput($EASYCREDIT-ModelCalculationJSON$)~
~EJD-LoadData(intern,rawdatahexcodedinput,easycalc)~

{EJD-DataOK(easycalc)}
   ~EJD-SetUseID(easycalc)~
   <!-- Ratenbeispiel ausgeben -->
{/EJD-DataOK(easycalc)}
```

For the lowest installment for the basket value, use `EASYCREDIT-GetCheapestModelCalculation()` instead.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
~EASYCREDIT-GetCheapestModelCalculation($BASKET-OrderTotal$)~

~EJD-SetRawDataHexCodedInput($EASYCREDIT-CheapestModelCalculationJSON$)~
~EJD-LoadData(intern,rawdatahexcodedinput,easycheap)~
```

> [!WARNING]
>
> The amount is required for both tags. Without content in the parentheses, the tag is invalid and nothing is retrieved.

> [!NOTE]
>
> The shop itself converts a comma in the amount into a period, because easyCredit requires this format. You can therefore pass a formatted price such as `$PR-Price$` directly.

## Transaction data in the ordering process

As soon as the buyer has selected easyCredit, there is a transaction at easyCredit for their order. Three retrievals fetch its data.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{ST-EasyCreditCheckout_selected}

   ~EASYCREDIT-GetRepaymentPlan~

   ~EJD-SetRawDataHexCodedInput($EASYCREDIT-RepaymentPlanJSON$)~
   ~EJD-LoadData(intern,rawdatahexcodedinput,easyrepay)~

   {EJD-DataOK(easyrepay)}
      ~EJD-SetUseID(easyrepay)~
      <!-- Tilgungsplan ausgeben -->
   {/EJD-DataOK(easyrepay)}

{/ST-EasyCreditCheckout_selected}
```

> [!WARNING]
>
> Always enclose the retrievals with `ST-EasyCreditCheckout_selected`. Without this condition, the shop also queries easyCredit if the buyer has selected a different payment method.

| Retrieval | Contains |
| - | - |
| `EASYCREDIT-GetRepaymentPlan` | the general transaction data with the repayment plan |
| `EASYCREDIT-GetRepaymentPlanDetails` | the detailed payment plan with the financing data |

> [!NOTE]
>
> The shop additionally stores the response to `EASYCREDIT-GetRepaymentPlanDetails` with the order. This data is therefore still available later, for example on the PDF confirmation and in the confirmation email.

### The consent text

Before the order, the buyer must agree to the easyCredit terms. easyCredit supplies the text for this.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
~EASYCREDIT-GetAgreementText~

{EASYCREDIT-AgreementTextJSON}
   ~EJD-SetRawDataHexCodedInput($EASYCREDIT-AgreementTextJSON$)~
   ~EJD-LoadData(intern,rawdatahexcodedinput,easyagree)~
{/EASYCREDIT-AgreementTextJSON}
```

> [!WARNING]
>
> The consent text is legally binding. Output it unchanged and do not shorten it.

## Displaying access data

Two tags output the shop's connection data for easyCredit.

| Tag | Returns |
| - | - |
| `EASYCREDIT-WebshopID` | the shop's identifier at easyCredit |
| `EASYCREDIT-EndpointURL` | the address of the easyCredit interface |

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{EASYCREDIT-WebshopID}
   ~EASYCREDIT-WebshopID~
{/EASYCREDIT-WebshopID}
```

> [!NOTE]
>
> Both tags are needed for integrating the easyCredit widget, which loads its data itself. They are not intended for display in the shop.

## Evaluating errors

If a request to easyCredit fails, easyCredit returns an error message as JSON. `EASYCREDIT-LastErrorJSON` contains the response to the most recent request.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{ST-EasyCreditCheckout_selected}
   {EASYCREDIT-LastErrorJSON}
      ~EJD-SetRawDataHexCodedInput($EASYCREDIT-LastErrorJSON$)~
      ~EJD-LoadData(intern,rawdatahexcodedinput,easyerror)~

      {EJD-DataOK(easyerror)}
         ~EJD-SetUseID(easyerror)~
         <!-- Fehlermeldung von easyCredit ausgeben -->
      {/EJD-DataOK(easyerror)}
   {/EASYCREDIT-LastErrorJSON}
{/ST-EasyCreditCheckout_selected}
```

> [!NOTE]
>
> As a range tag, `EASYCREDIT-LastErrorJSON` already answers the question of whether there is an error at all. The bracketing therefore replaces a separate check.

### Looking up a specific transaction

The shop stores the errors separately **per request type**. `EASYCREDIT-TouchErrorJSON()` selects one of them, and `EASYCREDIT-LastErrorJSONAccessed` then outputs it.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
~EASYCREDIT-TouchErrorJSON(ModellBeispiel)~

{EASYCREDIT-LastErrorJSONAccessed}
   ~EJD-SetRawDataHexCodedInput($EASYCREDIT-LastErrorJSONAccessed$)~
   ~EJD-LoadData(intern,rawdatahexcodedinput,easyerror)~
{/EASYCREDIT-LastErrorJSONAccessed}
```

Permitted values for the request type:

| Value | Request |
| - | - |
| `VorgangClear` | reset transaction |
| `VorgangBestaetigen` | confirm transaction |
| `VorgangGet` | retrieve transaction data |
| `VorgangFinanzierung` | retrieve financing data |
| `VorgangEntscheidung` | retrieve decision |
| `ModellBeispiel` | installment example |
| `ModellGuenstigster` | lowest installment |
| `TexteZustimmung` | consent text |

> [!NOTE]
>
> These two tags are not described in the previous documentation, but they exist in the shop. They help with troubleshooting because they let you identify which of the eight calls failed, not just the last one.

> [!WARNING]
>
> An unknown value in the parentheses does not lead to a message. `EASYCREDIT-LastErrorJSONAccessed` then simply stays empty. Therefore, pay attention to the spelling.

## Tags with other prefixes

Three tags belong to the payment method but carry a different prefix. All three are permitted on the order overview page `ws_place_order.htm`.

| Tag | Purpose | Prefix |
| - | - | - |
| `ST-EasyCreditCheckout_selected` | applies if the buyer has selected easyCredit | ST- |
| `ST-EasyCreditCheckout_cancel` | applies if the buyer has canceled the payment | ST- |
| `BT-EasyCreditCheckout_cancel` | the button for canceling | BT- |

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{ST-EasyCreditCheckout_selected}
   <input name="~BT-EasyCreditCheckout_cancel~" type="submit" value="Ratenkauf abbrechen">
{/ST-EasyCreditCheckout_selected}

{ST-EasyCreditCheckout_cancel}
   <p>Sie haben den Ratenkauf abgebrochen. Bitte wählen Sie eine andere Zahlungsart.</p>
{/ST-EasyCreditCheckout_cancel}
```

> [!NOTE]
>
> Without the cancel button, a buyer who has changed their mind is stuck. Therefore, always provide it.

## Overview of the tags

| Tag | Single tag | Range tag | Negative range tag | Loop tag |
| - | - | - | - | - |
| `EASYCREDIT-GetModelCalculation()` | yes | – | – | – |
| `EASYCREDIT-GetCheapestModelCalculation()` | yes | – | – | – |
| `EASYCREDIT-GetRepaymentPlan` | yes | – | – | – |
| `EASYCREDIT-GetRepaymentPlanDetails` | yes | – | – | – |
| `EASYCREDIT-GetAgreementText` | yes | – | – | – |
| `EASYCREDIT-ModelCalculationJSON` | yes | yes | yes | – |
| `EASYCREDIT-CheapestModelCalculationJSON` | yes | yes | yes | – |
| `EASYCREDIT-RepaymentPlanJSON` | yes | yes | yes | – |
| `EASYCREDIT-RepaymentPlanDetailsJSON` | yes | yes | yes | – |
| `EASYCREDIT-AgreementTextJSON` | yes | yes | yes | – |
| `EASYCREDIT-LastErrorJSON` | yes | yes | yes | – |
| `EASYCREDIT-TouchErrorJSON()` | yes | – | – | – |
| `EASYCREDIT-LastErrorJSONAccessed` | yes | yes | yes | – |
| `EASYCREDIT-WebshopID` | yes | yes | yes | – |
| `EASYCREDIT-EndpointURL` | yes | yes | yes | – |
| `ST-EasyCreditCheckout_selected` | – | yes | yes | – |
| `ST-EasyCreditCheckout_cancel` | – | yes | yes | – |
| `BT-EasyCreditCheckout_cancel` | yes | – | – | – |

| Tag | Permitted in templates |
| - | - |
| `EASYCREDIT-GetModelCalculation()`, `EASYCREDIT-GetCheapestModelCalculation()` and the two associated JSON tags | start page `ws_start.htm`, product overview `ws_category.htm`, product detail view `ws_product.htm` |
| the remaining retrievals, JSON tags, and error tags | payment and shipping `ws_pay_deliv.htm`, order overview `ws_place_order.htm`, confirmation page `ws_confirm.htm`, PDF confirmation `pdf_confirm.htm`, confirmation email `mail_customer_order.htm` |
| `EASYCREDIT-WebshopID`, `EASYCREDIT-EndpointURL` | all |
| the three tags with the ST- and BT- prefix | order overview `ws_place_order.htm` |

## Related topics

* Guide: Payment method "easyCredit installment purchase"
* Guide: JSON interface
* Guide: Creating payment methods
* Reference: EJD- (external JSON data)


## Related topics

- [Payment methods](https://dokumentation.websale.de/en/v8s/referenz/konfigurationen/shopkonfiguration-shop-config/zahlungsarten.md)
- [PAY- (Additional fields for the payment method)](https://dokumentation.websale.de/en/v8s/referenz/tags/pay/zusatzfelder-zur-zahlungsart.md)
- [Purchase vouchers for printing](https://dokumentation.websale.de/en/v8s/gutscheine-anbieten/kaufgutscheine-zum-ausdrucken.md)
- [Creating a purchase voucher product](https://dokumentation.websale.de/en/admin-interface/katalog/produkte/kaufgutschein-produkt.md)
- [INSTANTVOUCHER- (Printable purchase vouchers)](https://dokumentation.websale.de/en/v8s/referenz/tags/instantvoucher-kaufgutscheine.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.