# Bewegen von Geld mithilfe von ReceivedCredit-Objekten Erfahren Sie, wie Sie Geld von einem anderen Finanzkonto oder Bankkonto auf ein Finanzkonto überweisen können. Wenn Gelder auf ein Finanzkonto übertragen werden, erstellt Stripe ein entsprechendes [ReceivedCredit](https://docs.stripe.com/api/treasury/received_credits.md)-Objekt auf dem Konto. Ein `ReceivedCredit` enthält Informationen darüber, wie die Gelder gesendet wurden und, falls möglich, von welchem Konto. Gelder können mit den Bankleitzahlen und Kontonummern für `ach`- und `us_domestic_wire`-Überweisungen oder mit der Finanzkonto-ID für Überweisungen zwischen Finanzkonten gesendet werden. Stammen die Geldbeträge von einem anderen Finanzkonto, enthält der Wert `ReceivedCredit` enthält eine `linked_flows.source_flow`-Referenz auf die ursprüngliche Geldbewegung. In diesem Fall hat die Quell-`OutboundPayment` `stripe` als ihren `network`-Wert. ## Eine ReceivedCredit abrufen Verwenden Sie `GET /v1/treasury/received_credits/{{RECEIVED_CREDIT_ID}}`, um das [ReceivedCredit](https://docs.stripe.com/api/treasury/received_credits.md) mit der angegebenen ID abzurufen. Die folgende Anfrage ruft den `ReceivedCredit` mit der angegebenen ID ab. Die Antwort auf diese Anfrage enthält erweiterte Details zum [Transaktions-Objekt](https://docs.stripe.com/api/treasury/transactions.md). ```curl curl -G https://api.stripe.com/v1/treasury/received_credits/{{RECEIVED_CREDIT_ID}} \ -u "<>:" \ -H "Stripe-Account: {{CONNECTEDACCOUNT_ID}}" \ -d "expand[]=transaction" ``` Bei Erfolg stellt die Antwort das angeforderte `ReceivedCredit`-Objekt bereit. Einige der Parameter in der Antwort verfügen über zusätzliche Details, die nur zurückgegeben werden, wenn Sie sie als Werte zum Parameter `expand[]` Ihrer Anfrage hinzufügen. Die Felder, die Sie erweitern können, haben im folgenden Antwortbeispiel den Kommentar `Expandable`. Weitere Informationen zum Erweitern von Objektantworten finden Sie unter [Erweitern von Antworten](https://docs.stripe.com/api/expanding_objects.md). #### JSON (mit Kommentar) ```json { "id": "{{RECEIVED_CREDIT_ID}}", "object": "received_credit", "livemode": true | false, "created": "{{Timestamp}}", // The FinancialAccount that received the funds "financial_account": "{{FINANCIAL_ACCOUNT_ID}}", // Expandable "amount": 1000, "currency": "usd", // The description of this movement sent by the originator "description": "Testing", // ReceivedCredits are created with a status of either `succeeded` (approved) or `failed` // (declined). When failed, no Transaction is created. The failure reason can be found // in the "failure_code" field. "status": "succeeded" | "failed", // The network that was used for this movement "network": "ach" | "stripe" | "us_domestic_wire", // Information about the originating account of the movement "received_payment_method_details": { "type": "us_bank_account" | "balance" | "financial_account", // Only set if type is `us_bank_account`. // This contains information of the source external bank account. "us_bank_account": null | { "bank_name": "{{String}}", "routing_number": "12341234", "last4": "6789" }, // Only set if type is `financial_account`. // This contains information of the source FinancialAccount. "financial_account": nil | { "id": "{{FINANCIAL_ACCOUNT_ID}}" }, // Only set if type is `balance`. // This is only set when the source is a Payout. "balance": null | "payments", "billing_details": null | { "name": null | "{{String}}", "phone": null | "{{String}}", "email": null | "{{String}}", "address": null | { "line1": null | "{{String}}", "line2": null | "{{String}}", "city": null | "{{String}}", "state": null | "{{String}}", "postal_code": null | "{{String}}", "country": null | "{{String}}" } } }, // A unique, Stripe-hosted direct link to the regulatory receipt for the ReceivedCredit "hosted_regulatory_receipt_url": "{{URL}}", "reversal_details": { "restricted_reason": null | "source_flow_restricted" | "network_restricted" | "deadline_passed" | "already_reversed", "deadline": null | "{{Timestamp}}" }, "linked_flows": { // When the platform can see both source and destination // accounts, we link to the originating flow // When the `network` type is `stripe`, this could be an OutboundPayment originated from another merchant, a // Payout originated from the same merchant (a balance transfer from payments), // or the result of reversing a Stripe network ReceivedCredit by the recipient // whom funds were sent to in the past. // When the `network` type is `ach`, this could be either nil or a Payout. "source_flow": null | "{{OUTBOUND_PAYMENT_ID}}" | "{{PAYOUT_ID}}", "source_flow_type": null | "outbound_payment" | "payout", // Includable by expanding linked_flows['source_flow_details']. When included, this field will // either be an OutboundPayment or a Payout. "source_flow_details": null, // CreditReversals allow you to reverse a ReceivedCredit as long as it's before the reversal_details['deadline'] // If reversed, the ReceivedCredit will link to the CreditReversal. "credit_reversal": null | "{{CREDIT_REVERSAL_ID}}" }, // Currently, the only failure reasons for ReceivedCredits are due to restrictions on the account. "failure_code": null | "account_closed" | "account_frozen", // Transaction created by the ReceivedCredit. Created synchronously. "transaction": "{{TRANSACTION_ID}}" // Expandable } ``` ## ReceivedCredits auflisten Verwenden Sie `GET /v1/treasury/received_credits`, um alle `ReceivedCredits` mit der ID des erforderlichen `financial_account`-Parameters abzurufen. Sie können die Liste mit den Standard-Listenparametern oder nach `status` oder nach `linked_flows.source_flow_type` sortieren. ``` { // Standard list parameters "limit", "starting_after", "ending_before", // Filter by FinancialAccount (required) "financial_account": "{{FINANCIAL_ACCOUNT_ID}}", // Filter by status "status": "succeeded" | "failed", // Filter by `source_flow_type` "linked_flows.source_flow_type": nil | "payout" | "outbound_payment" } ``` Mit der folgenden Anfrage werden die `ReceivedCredits` mit dem Status `failed` für das angegebene Finanzkonto abgerufen. ```curl curl -G https://api.stripe.com/v1/treasury/received_credits \ -u "<>:" \ -H "Stripe-Account: {{CONNECTEDACCOUNT_ID}}" \ -d "financial_account={{TREASURYFINANCIALACCOUNT_ID}}" \ -d status=failed ``` Bei Erfolg enthält die Antwort die [ReceivedCredit](https://docs.stripe.com/api/treasury/received_credits.md)-Objekte, die den in der Anfrage angegebenen Kriterien entsprechen. ## ReceivedCredits testen Verwenden Sie `POST /v1/test_helpers/treasury/received_credits`, um den Eingang von Geldern auf einem Finanzkonto zu simulieren. Um eine Banküberweisung von einem Konto außerhalb von Stripe auf Ihr Finanzkonto zu simulieren, setzen Sie `initiating_payment_method_details` auf die Werte des externen Bankkontos, und setzen Sie `network` auf `ach` oder `us_domestic_wire`. Die folgende Anfrage erstellt eine `ReceivedCredit` im Test-Modus von einem externen Bankkonto unter Verwendung einer `OutboundPayment` zwischen zwei Finanzkonten auf derselben Plattform. ```curl curl https://api.stripe.com/v1/test_helpers/treasury/received_credits \ -u "<>:" \ -H "Stripe-Account: {{CONNECTEDACCOUNT_ID}}" \ -d financial_account={{DESTINATION_FINANCIAL_ACCOUNT_ID}} \ -d network=ach \ -d amount=1234 \ -d currency=usd ``` Bei Erfolg gibt die Antwort ein `ReceivedCredit`-Objekt zurück. Nachfolgend ist ein Beispiel einer Antwort für eine Banküberweisung dargestellt. ```json { "financial_account": "{{FINANCIAL_ACCOUNT_ID}}", "network": "ach", "amount": "1234", "currency": "usd", "description": "Test", "source_details": { "type": "aba", "aba": { "country": "US", "routing_number": "12341234", "account_number": "0123456789", "account_holder_name": "Jenny Rosen" } } } ``` ## ReceivedCredit-Webhooks Stripe gibt die folgenden `ReceivedCredit`-Ereignisse an Ihren [Webhook](https://docs.stripe.com/webhooks.md)-Endpoint aus: - `treasury.received_credit.created` bei der `ReceivedCredit`-Erstellung. - `treasury.received_credit.{{new_status}}`, wenn sich der Status eines `ReceivedCredit` ändert. Folgende Statuswertoptionen sind verfügbar: - `treasury.received_credit.succeeded` - `treasury.received_credit.failed`