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

# Zahlung auf ein virtuelles Konto simulieren

Erfahren Sie, wie Sie Ihre Integration virtueller Konten testen, indem Sie eingehende Zahlungen in der Stage-Umgebung simulieren. Validieren Sie Ihre Webhook-Listener und Ihre Abgleichslogik ohne echte Banküberweisungen.

Das Testen Ihrer Integration virtueller Konten ist ein entscheidender Schritt vor dem Go-live. Dafür stellt Localpayment in der **Stage-Umgebung** einen Simulationsendpunkt bereit, mit dem Sie eine fiktive eingehende Zahlung auf jedes aktive virtuelle Konto auslösen können.

Diese Simulation bildet das Verhalten einer echten lokalen ACH-Überweisung nach und löst dieselben internen Statusaktualisierungen und Webhook-Benachrichtigungen aus, die Sie in der Produktionsumgebung erwarten würden.

## Ablauf der Simulation

1. **Virtuelles Konto erstellen**: Erstellen Sie zunächst ein virtuelles Konto in der Stage-Umgebung.
2. **Status des virtuellen Kontos abrufen**: Verwenden Sie den Endpunkt [Status eines virtuellen Kontos abrufen](https://docs.localpayment.com/de/reference/get-virtual-account-status.md), um zu bestätigen, dass das Konto erfolgreich erstellt wurde, und das Feld `beneficiary.bank.account.number` aus der Antwort zu entnehmen.
3. **Mit der Simulation verknüpfen**: Verwenden Sie in Ihrer Simulationsanfrage die im vorherigen Schritt ermittelte `beneficiary.bank.account.number`, um die fiktive Zahlung dem richtigen Konto zuzuordnen. Geben Sie außerdem eine eindeutige `externalId` an. Sie dient als ID des Payins, der für diese Transaktion erzeugt wird; verwenden Sie für jede Simulationsanfrage eine andere `externalId`. Zusätzlich müssen Sie Ihre Localpayment-**accountNumber** (Händler-ID) angeben, um das Händlerkonto zu identifizieren, das der simulierten Zahlung zugeordnet ist.
4. **Simulation auslösen**: Rufen Sie den Endpunkt [Zahlung auf ein virtuelles Konto simulieren](https://docs.localpayment.com/de/reference/simulate-payin-to-virtual-account.md) auf.
5. **Webhook empfangen**: Localpayment sendet einen `payin.completed`-Webhook (oder einen ähnlichen) an Ihren konfigurierten Endpunkt.
6. **Status prüfen**: Verwenden Sie die API für den Transaktionsstatus, um zu bestätigen, dass die fiktive Transaktion den erwarteten Status erreicht hat.

***

## Technische Abhängigkeiten

> [!NOTE]
>
> **Reihenfolge beachten**: Sie können keine Zahlung für ein Konto simulieren, das nicht erfolgreich erstellt wurde. Schlägt der Aufruf [Virtuelles Konto erstellen](https://docs.localpayment.com/de/reference/create-virtual-account.md) fehl, gibt der Simulationsversuch den Fehler 404 Not Found zurück.

***

## Codebeispiele (Stage)

Wählen Sie Ihren Zielmarkt aus, um ein vollständiges `curl`-Beispiel anzuzeigen. Verwenden Sie dieselben Begünstigtendaten wie bei der Erstellung des virtuellen Kontos, und geben Sie für jede Simulationsanfrage eine eindeutige `externalId` an.

> [tab] Argentinien
>
> ```bash theme={"theme":{"light":"github-light-high-contrast","dark":"github-dark-high-contrast"}}
> curl --request POST \
>   --url https://api.stage.localpayment.com/api/simulate/va \
>   --header 'Authorization: Bearer {{access_token}}' \
>   --header 'accept: application/json' \
>   --header 'content-type: application/json' \
>   --data '
> {
>   "externalId": "de14bcf2-15ee-22e3-ab59-99c3fcba31e8",
>   "paymentMethod": {
>     "type": "BankTransfer",
>     "code": "1025",
>     "flow": "DIRECT"
>   },
>   "country": "ARG",
>   "currency": "ARS",
>   "amount": 100.00,
>   "accountNumber": "{{accountNumber}}",
>   "beneficiary": {
>     "type": "INDIVIDUAL",
>     "name": "Camilo",
>     "lastName": "Sabogal",
>     "fullName": "Camilo Sabogal",
>     "document": {
>       "type": "CUIT",
>       "id": "20314567894"
>     },
>     "bank": {
>       "account": {
>         "number": "3745135018378011718454"
>       }
>     }
>   },
>   "payer": {
>     "type": "INDIVIDUAL",
>     "name": "Carlos",
>     "lastName": "Mendez",
>     "fullName": "Carlos Mendez",
>     "document": {
>       "type": "CUIT",
>       "id": "20314567894"
>     },
>     "email": "carlos.mendez@email.com",
>     "bank": {
>       "name": "Banco Galicia",
>       "code": "007",
>       "account": {
>         "type": "CBU",
>         "number": "0070001200001234567890"
>       }
>     }
>   }
> }
> '
> ```

> [tab] Brasilien
>
> ```bash theme={"theme":{"light":"github-light-high-contrast","dark":"github-dark-high-contrast"}}
> curl --request POST \
>   --url https://api.stage.localpayment.com/api/simulate/va \
>   --header 'Authorization: Bearer {{access_token}}' \
>   --header 'accept: application/json' \
>   --header 'content-type: application/json' \
>   --data '
> {
>   "externalId": "0d55e796-bba6-4cf0-aead-8d9c1ed31044",
>   "paymentMethod": {
>     "type": "BankTransfer",
>     "code": "1350",
>     "flow": "DIRECT"
>   },
>   "country": "BRA",
>   "currency": "BRL",
>   "amount": 100.00,
>   "accountNumber": "{{accountNumber}}",
>   "beneficiary": {
>     "type": "INDIVIDUAL",
>     "name": "Rafael",
>     "lastName": "Oliveira",
>     "fullName": "Rafael Oliveira",
>     "document": {
>       "type": "CPF",
>       "id": "12345678909"
>     },
>     "bank": {
>       "account": {
>         "number": "00099999-8"
>       }
>     }
>   },
>   "payer": {
>     "type": "INDIVIDUAL",
>     "name": "Rafael",
>     "lastName": "Oliveira",
>     "fullName": "Rafael Oliveira",
>     "document": {
>       "type": "CPF",
>       "id": "12345678909"
>     },
>     "email": "rafael.oliveira@email.com",
>     "bank": {
>       "name": "Itau",
>       "code": "341",
>       "account": {
>         "number": "12345-6"
>       }
>     }
>   }
> }
> '
> ```

> [tab] Chile
>
> ```bash theme={"theme":{"light":"github-light-high-contrast","dark":"github-dark-high-contrast"}}
> curl --request POST \
>   --url https://api.stage.localpayment.com/api/simulate/va \
>   --header 'Authorization: Bearer {{access_token}}' \
>   --header 'accept: application/json' \
>   --header 'content-type: application/json' \
>   --data '
> {
>   "externalId": "d2ffc771-2678-4dcc-8819-d446656a19f9",
>   "paymentMethod": {
>     "type": "BankTransfer",
>     "code": "2530",
>     "flow": "DIRECT"
>   },
>   "country": "CHL",
>   "currency": "CLP",
>   "amount": 100.00,
>   "accountNumber": "{{accountNumber}}",
>   "beneficiary": {
>     "type": "INDIVIDUAL",
>     "name": "Valentina",
>     "lastName": "Rojas",
>     "fullName": "Valentina Rojas",
>     "document": {
>       "type": "RUT",
>       "id": "123456789"
>     },
>     "bank": {
>       "account": {
>         "number": "00099999999"
>       }
>     }
>   },
>   "payer": {
>     "type": "INDIVIDUAL",
>     "name": "Valentina",
>     "lastName": "Rojas",
>     "fullName": "Valentina Rojas",
>     "document": {
>       "type": "RUT",
>       "id": "123456789"
>     },
>     "email": "valentina.rojas@email.com",
>     "bank": {
>       "name": "Banco de Chile",
>       "code": "001",
>       "account": {
>         "number": "00112345678"
>       }
>     }
>   }
> }
> '
> ```

> [tab] Kolumbien
>
> ```bash theme={"theme":{"light":"github-light-high-contrast","dark":"github-dark-high-contrast"}}
> curl --request POST \
>   --url https://api.stage.localpayment.com/api/simulate/va \
>   --header 'Authorization: Bearer {{access_token}}' \
>   --header 'accept: application/json' \
>   --header 'content-type: application/json' \
>   --data '
> {
>   "externalId": "b3e14f73-8452-49b2-bf3c-b770774edfa8",
>   "paymentMethod": {
>     "type": "BankTransfer",
>     "code": "2006",
>     "flow": "DIRECT"
>   },
>   "country": "COL",
>   "currency": "COP",
>   "amount": 100.00,
>   "accountNumber": "{{accountNumber}}",
>   "beneficiary": {
>     "type": "INDIVIDUAL",
>     "name": "Andres",
>     "lastName": "Herrera",
>     "fullName": "Andres Herrera",
>     "document": {
>       "type": "CC",
>       "id": "1020456789"
>     },
>     "bank": {
>       "account": {
>         "number": "20099999999"
>       }
>     }
>   },
>   "payer": {
>     "type": "INDIVIDUAL",
>     "name": "Andres",
>     "lastName": "Herrera",
>     "fullName": "Andres Herrera",
>     "document": {
>       "type": "CC",
>       "id": "1020456789"
>     },
>     "email": "andres.herrera@email.com",
>     "bank": {
>       "name": "Bancolombia",
>       "code": "007",
>       "account": {
>         "number": "20012345678"
>       }
>     }
>   }
> }
> '
> ```

> [tab] Costa Rica (CRC)
>
> ```bash theme={"theme":{"light":"github-light-high-contrast","dark":"github-dark-high-contrast"}}
> curl --request POST \
>   --url https://api.stage.localpayment.com/api/simulate/va \
>   --header 'Authorization: Bearer {{access_token}}' \
>   --header 'accept: application/json' \
>   --header 'content-type: application/json' \
>   --data '
> {
>   "externalId": "a1c2e3f4-5b6d-47a8-9c0e-1f2a3b4c5d6e",
>   "paymentMethod": {
>     "type": "BankTransfer",
>     "code": "1420",
>     "flow": "DIRECT"
>   },
>   "country": "CRI",
>   "currency": "CRC",
>   "amount": 100.00,
>   "accountNumber": "{{accountNumber}}",
>   "beneficiary": {
>     "type": "INDIVIDUAL",
>     "name": "Carlos",
>     "lastName": "Mendez",
>     "fullName": "Carlos Mendez",
>     "document": {
>       "type": "CI",
>       "id": "2-0456-0789"
>     },
>     "bank": {
>       "account": {
>         "number": "CR91090100000000125311"
>       }
>     }
>   },
>   "payer": {
>     "type": "INDIVIDUAL",
>     "name": "John",
>     "lastName": "Doe",
>     "fullName": "John Doe",
>     "document": {
>       "type": "CI",
>       "id": "01-0100-0001"
>     },
>     "email": "john.doe@email.com",
>     "bank": {
>       "name": "Banco Nacional de Costa Rica",
>       "code": "0151",
>       "account": {
>         "number": "CR99000000000000000003"
>       }
>     }
>   }
> }
> '
> ```

> [tab] Costa Rica (USD)
>
> ```bash theme={"theme":{"light":"github-light-high-contrast","dark":"github-dark-high-contrast"}}
> curl --request POST \
>   --url https://api.stage.localpayment.com/api/simulate/va \
>   --header 'Authorization: Bearer {{access_token}}' \
>   --header 'accept: application/json' \
>   --header 'content-type: application/json' \
>   --data '
> {
>   "externalId": "b2d3f4a5-6c7e-48b9-a1d0-2f3b4c5d6e7f",
>   "paymentMethod": {
>     "type": "BankTransfer",
>     "code": "1421",
>     "flow": "DIRECT"
>   },
>   "country": "CRI",
>   "currency": "USD",
>   "amount": 100.00,
>   "accountNumber": "{{accountNumber}}",
>   "beneficiary": {
>     "type": "INDIVIDUAL",
>     "name": "Carlos",
>     "lastName": "Mendez",
>     "fullName": "Carlos Mendez",
>     "document": {
>       "type": "CI",
>       "id": "2-0456-0789"
>     },
>     "bank": {
>       "account": {
>         "number": "CR91090100000000125511"
>       }
>     }
>   },
>   "payer": {
>     "type": "INDIVIDUAL",
>     "name": "John",
>     "lastName": "Doe",
>     "fullName": "John Doe",
>     "document": {
>       "type": "CI",
>       "id": "01-0100-0001"
>     },
>     "email": "john.doe@email.com",
>     "bank": {
>       "name": "Banco Nacional de Costa Rica",
>       "code": "0151",
>       "account": {
>         "number": "CR99000000000000000002"
>       }
>     }
>   }
> }
> '
> ```

> [tab] Mexiko (SPEI)
>
> ```bash theme={"theme":{"light":"github-light-high-contrast","dark":"github-dark-high-contrast"}}
> curl --request POST \
>   --url https://api.stage.localpayment.com/api/simulate/va \
>   --header 'Authorization: Bearer {{access_token}}' \
>   --header 'accept: application/json' \
>   --header 'content-type: application/json' \
>   --data '
> {
>   "externalId": "f059a032-9253-4607-9b8e-2948ed18d595",
>   "paymentMethod": {
>     "type": "BankTransfer",
>     "code": "1630",
>     "flow": "DIRECT"
>   },
>   "country": "MEX",
>   "currency": "MXN",
>   "amount": 100.00,
>   "accountNumber": "{{accountNumber}}",
>   "beneficiary": {
>     "type": "INDIVIDUAL",
>     "name": "Juan",
>     "lastName": "Perez",
>     "fullName": "Juan Perez",
>     "document": {
>       "type": "RFC",
>       "id": "PEPJ800101XXX"
>     },
>     "bank": {
>       "account": {
>         "number": "137424104400399999"
>       }
>     }
>   },
>   "payer": {
>     "type": "INDIVIDUAL",
>     "name": "Alejandra",
>     "lastName": "Guzman",
>     "fullName": "Alejandra Guzman",
>     "document": {
>       "type": "RFC",
>       "id": "KCWV771228TS4"
>     },
>     "email": "alejandra.guzman@email.com",
>     "bank": {
>       "name": "BanCoppel",
>       "code": "137",
>       "account": {
>         "type": "C",
>         "number": "137424104400310004"
>       }
>     }
>   }
> }
> '
> ```

> [tab] Mexiko (TEF)
>
> ```bash theme={"theme":{"light":"github-light-high-contrast","dark":"github-dark-high-contrast"}}
> curl --request POST \
>   --url https://api.stage.localpayment.com/api/simulate/va \
>   --header 'Authorization: Bearer {{access_token}}' \
>   --header 'accept: application/json' \
>   --header 'content-type: application/json' \
>   --data '
> {
>   "externalId": "b8c924d1-3f7a-4e82-bc1d-9a06fe37510c",
>   "paymentMethod": {
>     "type": "BankTransfer",
>     "code": "1680",
>     "flow": "DIRECT"
>   },
>   "country": "MEX",
>   "currency": "MXN",
>   "amount": 100.00,
>   "accountNumber": "{{accountNumber}}",
>   "beneficiary": {
>     "type": "COMPANY",
>     "name": "Servicios Digitales México S.A.",
>     "document": {
>       "type": "RFC",
>       "id": "HEMJ900101ABC"
>     },
>     "bank": {
>       "account": {
>         "number": "000000000000000009"
>       }
>     }
>   },
>   "payer": {
>     "type": "COMPANY",
>     "name": "Juan",
>     "lastName": "Doe",
>     "fullName": "Juan Doe",
>     "document": {
>       "type": "RFC",
>       "id": "HEMJ900101ABC"
>     },
>     "email": "juan.doe@email.com",
>     "bank": {
>       "name": "BANCO INBURSA",
>       "code": "036",
>       "account": {
>         "type": "CLABE",
>         "number": "00000000000000000001"
>       }
>     }
>   }
> }
> '
> ```

> [tab] Peru
>
> ```bash theme={"theme":{"light":"github-light-high-contrast","dark":"github-dark-high-contrast"}}
> curl --request POST \
>   --url https://api.stage.localpayment.com/api/simulate/va \
>   --header 'Authorization: Bearer {{access_token}}' \
>   --header 'accept: application/json' \
>   --header 'content-type: application/json' \
>   --data '
> {
>   "externalId": "e6807dd1-e910-41ea-9adc-b240a5509dd3",
>   "paymentMethod": {
>     "type": "BankTransfer",
>     "code": "6100",
>     "flow": "DIRECT"
>   },
>   "country": "PER",
>   "currency": "PEN",
>   "amount": 100.00,
>   "accountNumber": "{{accountNumber}}",
>   "beneficiary": {
>     "type": "INDIVIDUAL",
>     "name": "Lucia",
>     "lastName": "Torres",
>     "fullName": "Lucia Torres",
>     "document": {
>       "type": "DNI",
>       "id": "45678901"
>     },
>     "bank": {
>       "account": {
>         "number": "00219100111111100009"
>       }
>     }
>   },
>   "payer": {
>     "type": "INDIVIDUAL",
>     "name": "Lucia",
>     "lastName": "Torres",
>     "fullName": "Lucia Torres",
>     "document": {
>       "type": "DNI",
>       "id": "45678901"
>     },
>     "email": "lucia.torres@email.com",
>     "bank": {
>       "name": "BCP",
>       "code": "002",
>       "account": {
>         "number": "19400123456789"
>       }
>     }
>   }
> }
> '
> ```

***

## Beispiel einer Webhook-Benachrichtigung

Nach erfolgreicher Verarbeitung sendet Localpayment ein synchrones `payin.completed`-Ereignis an Ihren konfigurierten Endpunkt. Diese Benachrichtigung folgt der standardmäßigen übergeordneten `PayIn`-Struktur, die bei allen Zahlungsprodukten verwendet wird.

```json MEX (SPEI) theme={"theme":{"light":"github-light-high-contrast","dark":"github-dark-high-contrast"}}
{
  "transactionType": "PayIn",
  "transactionFlow": null,
  "country": "MEX",
  "data": {
    "transactionType": "PayIn",
    "externalId": "f059a032-9253-4607-9b8e-2948ed18d595",
    "internalId": "5aced5da-40c1-4bec-85ff-c8cd1bcb4526",
    "paymentMethod": {
      "type": "BankTransfer",
      "code": "1630",
      "flow": "DIRECT"
    },
    "country": "MEX",
    "currency": "MXN",
    "amount": 100.00,
    "accountNumber": "{{accountNumber}}",
    "confirmed": {
      "currency": "MXN",
      "fxQuote": 1.0,
      "amount": 100.00
    },
    "beneficiary": {
      "type": "INDIVIDUAL",
      "name": "Juan",
      "lastName": "Perez",
      "fullName": "Juan Perez",
      "document": {
        "type": "RFC",
        "id": "PEPJ800101XXX"
      }
    },
    "payer": {
      "type": "INDIVIDUAL",
      "name": "Alejandra",
      "lastName": "Guzman",
      "fullName": "Alejandra Guzman",
      "document": {
        "type": "RFC",
        "id": "KCWV771228TS4"
      }
    },
    "status": {
      "code": "200",
      "description": "COMPLETED",
      "detail": "The payin was credited"
    },
    "date": {
      "creationDate": "2024-03-27T15:00:00Z",
      "processedDate": "2024-03-27T15:00:05Z"
    }
  }
}
```

```json MEX (TEF) theme={"theme":{"light":"github-light-high-contrast","dark":"github-dark-high-contrast"}}
{
  "transactionType": "PayIn",
  "transactionFlow": null,
  "country": "MEX",
  "data": {
    "transactionType": "PayIn",
    "externalId": "b8c924d1-3f7a-4e82-bc1d-9a06fe37510c",
    "internalId": "e05fc3c3-f739-4393-b275-4a12f5a1af15",
    "paymentMethod": {
      "type": "BankTransfer",
      "code": "1680",
      "flow": "DIRECT"
    },
    "country": "MEX",
    "currency": "MXN",
    "amount": 1000.01,
    "accountNumber": "{{accountNumber}}",
    "confirmed": {
      "currency": "MXN",
      "fxQuote": 1,
      "amount": 1000.01
    },
    "beneficiary": {
      "type": "COMPANY",
      "name": "Servicios Digitales México S.A.",
      "document": {
        "type": "RFC",
        "id": "HEMJ900101ABC"
      },
      "bank": {
        "name": "Banco Central",
        "code": "001",
        "account": {
          "number": "000000000000000009"
        }
      }
    },
    "payer": {
      "type": "COMPANY",
      "name": "Juan",
      "lastName": "Doe",
      "fullName": "Juan Doe",
      "document": {
        "type": "RFC",
        "id": "HEMJ900101ABC"
      },
      "bank": {
        "name": "BANCO INBURSA",
        "code": "036",
        "account": {
          "type": "CLABE",
          "number": "00000000000000000001"
        }
      }
    },
    "status": {
      "code": "200",
      "description": "COMPLETED",
      "detail": "The payin was credited"
    },
    "date": {
      "creationDate": "2024-03-27T15:00:00Z",
      "processedDate": "2024-03-27T15:00:05Z"
    }
  }
}
```

***

## Fehlerbehebung

| Fehlercode | Mögliche Ursache | Empfohlene Lösung |
| :- | :- | :- |
| **400 Bad Request** | Ungültige Zahleridentität oder fehlende Felder. | Stellen Sie sicher, dass die Zahlerdaten mit den Begünstigtendaten übereinstimmen, die bei der Erstellung des virtuellen Kontos verwendet wurden. |
| **404 Not Found** | Die `externalId` stimmt mit keinem aktiven virtuellen Konto überein. | Prüfen Sie vor der Simulation, ob das virtuelle Konto in Stage erfolgreich erstellt wurde. |
| **401 Unauthorized** | Ungültiges Token oder Produktionstoken verwendet. | Vergewissern Sie sich, dass Sie den API-Schlüssel Ihrer **Stage-Umgebung** verwenden. |
| **422 Unprocessable** | Betrag oder Währung stimmen nicht überein. | Prüfen Sie, ob die Währung zum ausgewählten `paymentMethod.code` passt. |

***

## Nächste Schritte

> [card] [Status prüfen](https://docs.localpayment.com/de/reference/get-transaction-status.md)
>
> Rufen Sie Statusaktualisierungen in Echtzeit ab, um den Fortschritt der fiktiven Transaktion zu bestätigen.

> [card] [Webhooks konfigurieren](https://docs.localpayment.com/de/docs/webhooks.md)
>
> Validieren Sie Ihre Listener-Logik mit echten Erfolgsbenachrichtigungen.


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