# Die Payment Records API Führen Sie eine einheitliche Historie Ihrer Zahlungen, sowohl auf Stripe als auch außerhalb von Stripe. Verwenden Sie die [Payment Records](https://docs.stripe.com/api/payment-record.md) API, um ein Hauptbuch all Ihrer Zahlungen zu führen. Wenn Sie Zahlungen über Stripe (Zahlungen innerhalb von Stripe) oder mit Drittanbietern (Zahlungen außerhalb von Stripe) abwickeln, verwenden Sie diese API, um einen einheitlichen Verlauf Ihrer Zahlungen zu führen. Die Payment Records API ermöglicht Ihnen Folgendes: - Tätigen Sie Zahlungen mit einem Drittanbieter-Abwickler und melden Sie die Ergebnisse an Stripe, um die volle Funktionalität von Produkten wie Abonnements und Radar zu nutzen. - Erstellen Sie komplexe Zahlungsabläufe (z. B. Mehrfacherfassungen), bei denen Sie jede Erfassung nachverfolgen können. - Verfolgen Sie von Drittanbietern und Partnern initiierte Zahlungen, einschließlich von Stripe angewiesener Kartentransaktionen. ## Beziehung zu PaymentIntents Mit der [Payment Intents](https://docs.stripe.com/api/payment_intents.md) API wird eine Reihe verschiedener Zahlungsabläufe verwaltet. Viele erweiterte Anwendungsszenarien erfordern jedoch eine genauere Darstellung des Zahlungsverlaufs. Wenn Ihre Anwendung Zahlungen sowohl auf Stripe mit PaymentIntents als auch außerhalb von Stripe über einen anderen Abwickler akzeptiert, können Sie PaymentRecords als vollständiges Aufzeichnungssystem verwenden. Wenn Sie die [Orchestrierung](https://docs.stripe.com/payments/orchestration.md) aktiviert haben: - **Zahlungen über Stripe**: Stripe erstellt für jeden PaymentIntent automatisch einen PaymentRecord. - **Zahlungen außerhalb von Stripe**: Sie können PaymentRecords manuell erstellen, indem Sie Zahlungsdaten über die Payment Records API melden. PaymentRecords ermöglichen die Interoperabilität zwischen Stripe-Produkten. Produkte wie [Abonnements](https://docs.stripe.com/subscriptions.md) (mit Smart Retries) und [außerhalb von Stripe bezahlte Rechnungen](https://support.stripe.com/questions/marking-an-invoice-paid-out-of-band) verwenden PaymentRecords als Kernelement zur Nachverfolgung von Zahlungsergebnissen. So rufen Sie den PaymentRecord ab, der einem PaymentIntent zugeordnet ist, für den die Orchestrierung aktiviert ist: ```curl curl https://api.stripe.com/v1/payment_records/{{PAYMENTINTENT_ID}} \ -u "<>:" ``` ```cli stripe payment_records retrieve {{PAYMENTINTENT_ID}} ``` ```ruby # Set your secret key. Remember to switch to your live secret key in production. # See your keys here: https://dashboard.stripe.com/apikeys client = Stripe::StripeClient.new("<>") payment_record = client.v1.payment_records.retrieve('{{PAYMENTINTENT_ID}}') ``` ```python # Set your secret key. Remember to switch to your live secret key in production. # See your keys here: https://dashboard.stripe.com/apikeys client = StripeClient("<>") # For SDK versions 12.4.0 or lower, remove '.v1' from the following line. payment_record = client.v1.payment_records.retrieve("{{PAYMENTINTENT_ID}}") ``` ```php // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys $stripe = new \Stripe\StripeClient('<>'); $paymentRecord = $stripe->paymentRecords->retrieve('{{PAYMENTINTENT_ID}}', []); ``` ```java // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys StripeClient client = new StripeClient("<>"); PaymentRecordRetrieveParams params = PaymentRecordRetrieveParams.builder().build(); // For SDK versions 29.4.0 or lower, remove '.v1()' from the following line. PaymentRecord paymentRecord = client.v1().paymentRecords().retrieve("{{PAYMENTINTENT_ID}}", params); ``` ```node // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys const stripe = require('stripe')('<>'); const paymentRecord = await stripe.paymentRecords.retrieve('{{PAYMENTINTENT_ID}}'); ``` ```go // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys sc := stripe.NewClient("<>") params := &stripe.PaymentRecordRetrieveParams{} result, err := sc.V1PaymentRecords.Retrieve( context.TODO(), "{{PAYMENTINTENT_ID}}", params) ``` ```dotnet // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys var client = new StripeClient("<>"); var service = client.V1.PaymentRecords; PaymentRecord paymentRecord = service.Get("{{PAYMENTINTENT_ID}}"); ``` ## PaymentRecords erstellen und verwalten Ein PaymentRecord ist der Datensatz einer Zahlung und enthält alle damit verbundenen Versuche und Ergebnisse. Es ist der wichtigste Anhaltspunkt für das Verständnis des Lebenszyklus und Status einer Zahlung. Jeder PaymentRecord kann mehrere [PaymentAttemptRecords](https://docs.stripe.com/api/payment-attempt-record.md) haben, die jeweils einen bestimmten Versuch beschreiben, die Zahlung abzuwickeln. Diese Struktur ermöglicht es Ihnen, erfolgreiche, wiederholbare Versuche und fehlgeschlagene Versuche nachzuverfolgen. Ein PaymentRecord-Beispielobjekt mit zugehörigen PaymentRecordAttempt-Objekten (See full diagram at https://docs.stripe.com/payments/payment-records) ### Neue Zahlung melden Um eine Zahlung außerhalb von Stripe [zu melden](https://docs.stripe.com/api/payment-record/report-payment/report.md), erstellen Sie einen PaymentRecord mit Details zur Transaktion, einschließlich des Betrags, der Zahlungsmethode, des Abwicklers und relevanter Zeitstempel. Stripe erstellt automatisch ein zugehöriges PaymentAttemptRecord mit den angegebenen Daten, auf die in der Antwort als `latest_payment_attempt_record` verwiesen wird. ```curl curl https://api.stripe.com/v1/payment_records/report_payment \ -u "<>:" \ -d "amount_requested[currency]"=usd \ -d "amount_requested[value]"=1000 \ -d initiated_at=1730253453 \ -d outcome=guaranteed \ -d "guaranteed[guaranteed_at]"=1746572320 \ -d "payment_method_details[payment_method]"="{{PAYMENTMETHOD_ID}}" \ -d "processor_details[type]"=custom ``` ```cli stripe payment_records report_payment \ -d "amount_requested[currency]"=usd \ -d "amount_requested[value]"=1000 \ --initiated-at=1730253453 \ --outcome=guaranteed \ -d "guaranteed[guaranteed_at]"=1746572320 \ -d "payment_method_details[payment_method]"="{{PAYMENTMETHOD_ID}}" \ -d "processor_details[type]"=custom ``` ```ruby # Set your secret key. Remember to switch to your live secret key in production. # See your keys here: https://dashboard.stripe.com/apikeys client = Stripe::StripeClient.new("<>") payment_record = client.v1.payment_records.report_payment({ amount_requested: { currency: 'usd', value: 1000, }, initiated_at: 1730253453, outcome: 'guaranteed', guaranteed: {guaranteed_at: 1746572320}, payment_method_details: {payment_method: '{{PAYMENTMETHOD_ID}}'}, processor_details: {type: 'custom'}, }) ``` ```python # Set your secret key. Remember to switch to your live secret key in production. # See your keys here: https://dashboard.stripe.com/apikeys client = StripeClient("<>") # For SDK versions 12.4.0 or lower, remove '.v1' from the following line. payment_record = client.v1.payment_records.report_payment({ "amount_requested": {"currency": "usd", "value": 1000}, "initiated_at": 1730253453, "outcome": "guaranteed", "guaranteed": {"guaranteed_at": 1746572320}, "payment_method_details": {"payment_method": "{{PAYMENTMETHOD_ID}}"}, "processor_details": {"type": "custom"}, }) ``` ```php // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys $stripe = new \Stripe\StripeClient('<>'); $paymentRecord = $stripe->paymentRecords->reportPayment([ 'amount_requested' => [ 'currency' => 'usd', 'value' => 1000, ], 'initiated_at' => 1730253453, 'outcome' => 'guaranteed', 'guaranteed' => ['guaranteed_at' => 1746572320], 'payment_method_details' => ['payment_method' => '{{PAYMENTMETHOD_ID}}'], 'processor_details' => ['type' => 'custom'], ]); ``` ```java // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys StripeClient client = new StripeClient("<>"); PaymentRecordReportPaymentParams params = PaymentRecordReportPaymentParams.builder() .setAmountRequested( PaymentRecordReportPaymentParams.AmountRequested.builder() .setCurrency("usd") .setValue(1000L) .build() ) .setInitiatedAt(1730253453L) .setOutcome(PaymentRecordReportPaymentParams.Outcome.GUARANTEED) .setGuaranteed( PaymentRecordReportPaymentParams.Guaranteed.builder() .setGuaranteedAt(1746572320L) .build() ) .setPaymentMethodDetails( PaymentRecordReportPaymentParams.PaymentMethodDetails.builder() .setPaymentMethod("{{PAYMENTMETHOD_ID}}") .build() ) .setProcessorDetails( PaymentRecordReportPaymentParams.ProcessorDetails.builder() .setType(PaymentRecordReportPaymentParams.ProcessorDetails.Type.CUSTOM) .build() ) .build(); // For SDK versions 29.4.0 or lower, remove '.v1()' from the following line. PaymentRecord paymentRecord = client.v1().paymentRecords().reportPayment(params); ``` ```node // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys const stripe = require('stripe')('<>'); const paymentRecord = await stripe.paymentRecords.reportPayment({ amount_requested: { currency: 'usd', value: 1000, }, initiated_at: 1730253453, outcome: 'guaranteed', guaranteed: { guaranteed_at: 1746572320, }, payment_method_details: { payment_method: '{{PAYMENTMETHOD_ID}}', }, processor_details: { type: 'custom', }, }); ``` ```go // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys sc := stripe.NewClient("<>") params := &stripe.PaymentRecordReportPaymentParams{ AmountRequested: &stripe.PaymentRecordReportPaymentAmountRequestedParams{ Currency: stripe.String(stripe.CurrencyUSD), Value: stripe.Int64(1000), }, InitiatedAt: stripe.Int64(1730253453), Outcome: stripe.String("guaranteed"), Guaranteed: &stripe.PaymentRecordReportPaymentGuaranteedParams{ GuaranteedAt: stripe.Int64(1746572320), }, PaymentMethodDetails: &stripe.PaymentRecordReportPaymentPaymentMethodDetailsParams{ PaymentMethod: stripe.String("{{PAYMENTMETHOD_ID}}"), }, ProcessorDetails: &stripe.PaymentRecordReportPaymentProcessorDetailsParams{ Type: stripe.String("custom"), }, } result, err := sc.V1PaymentRecords.ReportPayment(context.TODO(), params) ``` ```dotnet // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys var options = new PaymentRecordReportPaymentOptions { AmountRequested = new PaymentRecordAmountRequestedOptions { Currency = "usd", Value = 1000, }, InitiatedAt = DateTimeOffset.FromUnixTimeSeconds(1730253453).UtcDateTime, Outcome = "guaranteed", Guaranteed = new PaymentRecordGuaranteedOptions { GuaranteedAt = DateTimeOffset.FromUnixTimeSeconds(1746572320).UtcDateTime, }, PaymentMethodDetails = new PaymentRecordPaymentMethodDetailsOptions { PaymentMethod = "{{PAYMENTMETHOD_ID}}", }, }; options.AddExtraParam("processor_details[type]", "custom"); var client = new StripeClient("<>"); var service = client.V1.PaymentRecords; PaymentRecord paymentRecord = service.ReportPayment(options); ``` ### Fehlgeschlagenen Zahlungsversuch melden Durch das Melden fehlgeschlagener Zahlungsversuche wird sichergestellt, dass Stripe einen vollständigen Überblick über Ihre Zahlungsabläufe hat, damit andere Produkte funktionieren (zum Beispiel [Smart Retries](https://docs.stripe.com/billing/revenue-recovery/smart-retries.md)). Wenn ein Zahlungsversuch fehlschlägt, [melden Sie den Fehler](https://docs.stripe.com/api/payment-record/report-payment-attempt-failed/report.md), indem Sie auf die vorhandene PaymentRecord-ID verweisen und den Zeitpunkt des fehlgeschlagenen Versuchs übergeben. ```curl curl https://api.stripe.com/v1/payment_records/{{PAYMENT_RECORD_ID}}/report_payment_attempt_failed \ -u "<>:" \ -d failed_at=1730253453 ``` ```cli stripe payment_records report_payment_attempt_failed {{PAYMENT_RECORD_ID}} \ --failed-at=1730253453 ``` ```ruby # Set your secret key. Remember to switch to your live secret key in production. # See your keys here: https://dashboard.stripe.com/apikeys client = Stripe::StripeClient.new("<>") payment_record = client.v1.payment_records.report_payment_attempt_failed( '{{PAYMENT_RECORD_ID}}', {failed_at: 1730253453}, ) ``` ```python # Set your secret key. Remember to switch to your live secret key in production. # See your keys here: https://dashboard.stripe.com/apikeys client = StripeClient("<>") # For SDK versions 12.4.0 or lower, remove '.v1' from the following line. payment_record = client.v1.payment_records.report_payment_attempt_failed( "{{PAYMENT_RECORD_ID}}", {"failed_at": 1730253453}, ) ``` ```php // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys $stripe = new \Stripe\StripeClient('<>'); $paymentRecord = $stripe->paymentRecords->reportPaymentAttemptFailed( '{{PAYMENT_RECORD_ID}}', ['failed_at' => 1730253453] ); ``` ```java // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys StripeClient client = new StripeClient("<>"); PaymentRecordReportPaymentAttemptFailedParams params = PaymentRecordReportPaymentAttemptFailedParams.builder() .setFailedAt(1730253453L) .build(); // For SDK versions 29.4.0 or lower, remove '.v1()' from the following line. PaymentRecord paymentRecord = client.v1().paymentRecords().reportPaymentAttemptFailed( "{{PAYMENT_RECORD_ID}}", params ); ``` ```node // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys const stripe = require('stripe')('<>'); const paymentRecord = await stripe.paymentRecords.reportPaymentAttemptFailed( '{{PAYMENT_RECORD_ID}}', { failed_at: 1730253453, } ); ``` ```go // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys sc := stripe.NewClient("<>") params := &stripe.PaymentRecordReportPaymentAttemptFailedParams{ FailedAt: stripe.Int64(1730253453), } result, err := sc.V1PaymentRecords.ReportPaymentAttemptFailed( context.TODO(), "{{PAYMENT_RECORD_ID}}", params) ``` ```dotnet // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys var options = new PaymentRecordReportPaymentAttemptFailedOptions { FailedAt = DateTimeOffset.FromUnixTimeSeconds(1730253453).UtcDateTime, }; var client = new StripeClient("<>"); var service = client.V1.PaymentRecords; PaymentRecord paymentRecord = service.ReportPaymentAttemptFailed( "{{PAYMENT_RECORD_ID}}", options); ``` ### Fehlgeschlagene Zahlungen erneut versuchen Manchmal versuchen Nutzer/innen, fehlgeschlagene Zahlungen mehrmals zu wiederholen. Sie können [einen neuen Zahlungsversuch](https://docs.stripe.com/api/payment-record/report-payment-attempt/report.md) mit demselben PaymentRecord melden. Für Wiederholungsversuche können dieselbe oder unterschiedliche Zahlungsmethoden und Abwickler verwendet werden. ```curl curl https://api.stripe.com/v1/payment_records/{{PAYMENT_RECORD_ID}}/report_payment_attempt \ -u "<>:" \ -d initiated_at=1730253825 \ -d "payment_method_details[payment_method]"="{{PAYMENTMETHOD_ID}}" ``` ```cli stripe payment_records report_payment_attempt {{PAYMENT_RECORD_ID}} \ --initiated-at=1730253825 \ -d "payment_method_details[payment_method]"="{{PAYMENTMETHOD_ID}}" ``` ```ruby # Set your secret key. Remember to switch to your live secret key in production. # See your keys here: https://dashboard.stripe.com/apikeys client = Stripe::StripeClient.new("<>") payment_record = client.v1.payment_records.report_payment_attempt( '{{PAYMENT_RECORD_ID}}', { initiated_at: 1730253825, payment_method_details: {payment_method: '{{PAYMENTMETHOD_ID}}'}, }, ) ``` ```python # Set your secret key. Remember to switch to your live secret key in production. # See your keys here: https://dashboard.stripe.com/apikeys client = StripeClient("<>") # For SDK versions 12.4.0 or lower, remove '.v1' from the following line. payment_record = client.v1.payment_records.report_payment_attempt( "{{PAYMENT_RECORD_ID}}", { "initiated_at": 1730253825, "payment_method_details": {"payment_method": "{{PAYMENTMETHOD_ID}}"}, }, ) ``` ```php // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys $stripe = new \Stripe\StripeClient('<>'); $paymentRecord = $stripe->paymentRecords->reportPaymentAttempt( '{{PAYMENT_RECORD_ID}}', [ 'initiated_at' => 1730253825, 'payment_method_details' => ['payment_method' => '{{PAYMENTMETHOD_ID}}'], ] ); ``` ```java // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys StripeClient client = new StripeClient("<>"); PaymentRecordReportPaymentAttemptParams params = PaymentRecordReportPaymentAttemptParams.builder() .setInitiatedAt(1730253825L) .setPaymentMethodDetails( PaymentRecordReportPaymentAttemptParams.PaymentMethodDetails.builder() .setPaymentMethod("{{PAYMENTMETHOD_ID}}") .build() ) .build(); // For SDK versions 29.4.0 or lower, remove '.v1()' from the following line. PaymentRecord paymentRecord = client.v1().paymentRecords().reportPaymentAttempt("{{PAYMENT_RECORD_ID}}", params); ``` ```node // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys const stripe = require('stripe')('<>'); const paymentRecord = await stripe.paymentRecords.reportPaymentAttempt( '{{PAYMENT_RECORD_ID}}', { initiated_at: 1730253825, payment_method_details: { payment_method: '{{PAYMENTMETHOD_ID}}', }, } ); ``` ```go // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys sc := stripe.NewClient("<>") params := &stripe.PaymentRecordReportPaymentAttemptParams{ InitiatedAt: stripe.Int64(1730253825), PaymentMethodDetails: &stripe.PaymentRecordReportPaymentAttemptPaymentMethodDetailsParams{ PaymentMethod: stripe.String("{{PAYMENTMETHOD_ID}}"), }, } result, err := sc.V1PaymentRecords.ReportPaymentAttempt( context.TODO(), "{{PAYMENT_RECORD_ID}}", params) ``` ```dotnet // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys var options = new PaymentRecordReportPaymentAttemptOptions { InitiatedAt = DateTimeOffset.FromUnixTimeSeconds(1730253825).UtcDateTime, PaymentMethodDetails = new PaymentRecordPaymentMethodDetailsOptions { PaymentMethod = "{{PAYMENTMETHOD_ID}}", }, }; var client = new StripeClient("<>"); var service = client.V1.PaymentRecords; PaymentRecord paymentRecord = service.ReportPaymentAttempt( "{{PAYMENT_RECORD_ID}}", options); ``` ### Rückerstattung melden Wenn eine Zahlung erfolgreich verarbeitet, jedoch später (ganz oder teilweise) zurückerstattet wurde, können Sie die [Rückerstattung melden](https://docs.stripe.com/api/payment-record/report-refund/report.md), um genaue Zahlungsaufzeichnungen zu gewährleisten. Dadurch wird sichergestellt, dass Stripe einen vollständigen Überblick über den Zahlungslebenszyklus hat, einschließlich aller Rückerstattungen, die über Ihren Zahlungsabwickler verarbeitet wurden. ```curl curl https://api.stripe.com/v1/payment_records/{{PAYMENT_RECORD_ID}}/report_refund \ -u "<>:" \ -d "processor_details[type]"=custom \ -d "processor_details[custom][refund_reference]"=ref_123456 \ -d outcome=refunded \ -d "refunded[refunded_at]"=1730253825 \ -d "amount[value]"=1000 \ -d "amount[currency]"=usd ``` ```cli stripe payment_records report_refund {{PAYMENT_RECORD_ID}} \ -d "processor_details[type]"=custom \ -d "processor_details[custom][refund_reference]"=ref_123456 \ --outcome=refunded \ -d "refunded[refunded_at]"=1730253825 \ -d "amount[value]"=1000 \ -d "amount[currency]"=usd ``` ```ruby # Set your secret key. Remember to switch to your live secret key in production. # See your keys here: https://dashboard.stripe.com/apikeys client = Stripe::StripeClient.new("<>") payment_record = client.v1.payment_records.report_refund( '{{PAYMENT_RECORD_ID}}', { processor_details: { type: 'custom', custom: {refund_reference: 'ref_123456'}, }, outcome: 'refunded', refunded: {refunded_at: 1730253825}, amount: { value: 1000, currency: 'usd', }, }, ) ``` ```python # Set your secret key. Remember to switch to your live secret key in production. # See your keys here: https://dashboard.stripe.com/apikeys client = StripeClient("<>") # For SDK versions 12.4.0 or lower, remove '.v1' from the following line. payment_record = client.v1.payment_records.report_refund( "{{PAYMENT_RECORD_ID}}", { "processor_details": {"type": "custom", "custom": {"refund_reference": "ref_123456"}}, "outcome": "refunded", "refunded": {"refunded_at": 1730253825}, "amount": {"value": 1000, "currency": "usd"}, }, ) ``` ```php // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys $stripe = new \Stripe\StripeClient('<>'); $paymentRecord = $stripe->paymentRecords->reportRefund( '{{PAYMENT_RECORD_ID}}', [ 'processor_details' => [ 'type' => 'custom', 'custom' => ['refund_reference' => 'ref_123456'], ], 'outcome' => 'refunded', 'refunded' => ['refunded_at' => 1730253825], 'amount' => [ 'value' => 1000, 'currency' => 'usd', ], ] ); ``` ```java // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys StripeClient client = new StripeClient("<>"); PaymentRecordReportRefundParams params = PaymentRecordReportRefundParams.builder() .setProcessorDetails( PaymentRecordReportRefundParams.ProcessorDetails.builder() .setType(PaymentRecordReportRefundParams.ProcessorDetails.Type.CUSTOM) .setCustom( PaymentRecordReportRefundParams.ProcessorDetails.Custom.builder() .setRefundReference("ref_123456") .build() ) .build() ) .setOutcome(PaymentRecordReportRefundParams.Outcome.REFUNDED) .setRefunded( PaymentRecordReportRefundParams.Refunded.builder() .setRefundedAt(1730253825L) .build() ) .setAmount( PaymentRecordReportRefundParams.Amount.builder() .setValue(1000L) .setCurrency("usd") .build() ) .build(); // For SDK versions 29.4.0 or lower, remove '.v1()' from the following line. PaymentRecord paymentRecord = client.v1().paymentRecords().reportRefund("{{PAYMENT_RECORD_ID}}", params); ``` ```node // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys const stripe = require('stripe')('<>'); const paymentRecord = await stripe.paymentRecords.reportRefund( '{{PAYMENT_RECORD_ID}}', { processor_details: { type: 'custom', custom: { refund_reference: 'ref_123456', }, }, outcome: 'refunded', refunded: { refunded_at: 1730253825, }, amount: { value: 1000, currency: 'usd', }, } ); ``` ```go // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys sc := stripe.NewClient("<>") params := &stripe.PaymentRecordReportRefundParams{ ProcessorDetails: &stripe.PaymentRecordReportRefundProcessorDetailsParams{ Type: stripe.String("custom"), Custom: &stripe.PaymentRecordReportRefundProcessorDetailsCustomParams{ RefundReference: stripe.String("ref_123456"), }, }, Outcome: stripe.String("refunded"), Refunded: &stripe.PaymentRecordReportRefundRefundedParams{ RefundedAt: stripe.Int64(1730253825), }, Amount: &stripe.PaymentRecordReportRefundAmountParams{ Value: stripe.Int64(1000), Currency: stripe.String(stripe.CurrencyUSD), }, } result, err := sc.V1PaymentRecords.ReportRefund( context.TODO(), "{{PAYMENT_RECORD_ID}}", params) ``` ```dotnet // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys var options = new PaymentRecordReportRefundOptions { Outcome = "refunded", Refunded = new PaymentRecordRefundedOptions { RefundedAt = DateTimeOffset.FromUnixTimeSeconds(1730253825).UtcDateTime, }, Amount = new PaymentRecordAmountOptions { Value = 1000, Currency = "usd" }, }; options.AddExtraParam("processor_details[type]", "custom"); options.AddExtraParam("processor_details[custom][refund_reference]", "ref_123456"); var client = new StripeClient("<>"); var service = client.V1.PaymentRecords; PaymentRecord paymentRecord = service.ReportRefund("{{PAYMENT_RECORD_ID}}", options); ``` Wenn Sie keinen `amount` angeben, wird der gesamte garantierte Betrag zurückerstattet. Sie können mehrere Teilrückerstattungen für denselben PaymentRecord melden, bis der gesamte Betrag zurückerstattet ist. ## Überblick über den Status Ihrer Zahlungen Sie können PaymentRecord für Ihre Dashboards und Berichtssysteme verwenden. Da Sie über einen einzigen Datensatz verfügen, müssen Sie die Modellierungsunterschiede zwischen Ihren anderen Abwicklern und Stripe nicht abgleichen. ### PaymentRecord abrufen Sie können den PaymentRecord mithilfe der ID abrufen. Bei orchestrierten Zahlungen wird dies in der PaymentIntent-Antwort zurückgegeben. Für vergangene Zahlungen können Sie PaymentRecord auch über die ID des PaymentIntent abrufen. Der letzte PaymentAttemptRecord ist im PaymentRecord verfügbar und Sie können ihn über das API [Datensätze zu Zahlungsversuchen](https://docs.stripe.com/payments/payment-records.md#retrieve-payment-attempt-record) abrufen. Bei vergangenen Zahlungen, die die Charges API verwenden, verwenden Sie die Zahlungs-ID, um den PaymentAttemptRecord abzurufen. ```curl curl https://api.stripe.com/v1/payment_records/{{PAYMENT_RECORD_ID}} \ -u "<>:" ``` ```cli stripe payment_records retrieve {{PAYMENT_RECORD_ID}} ``` ```ruby # Set your secret key. Remember to switch to your live secret key in production. # See your keys here: https://dashboard.stripe.com/apikeys client = Stripe::StripeClient.new("<>") payment_record = client.v1.payment_records.retrieve('{{PAYMENT_RECORD_ID}}') ``` ```python # Set your secret key. Remember to switch to your live secret key in production. # See your keys here: https://dashboard.stripe.com/apikeys client = StripeClient("<>") # For SDK versions 12.4.0 or lower, remove '.v1' from the following line. payment_record = client.v1.payment_records.retrieve("{{PAYMENT_RECORD_ID}}") ``` ```php // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys $stripe = new \Stripe\StripeClient('<>'); $paymentRecord = $stripe->paymentRecords->retrieve('{{PAYMENT_RECORD_ID}}', []); ``` ```java // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys StripeClient client = new StripeClient("<>"); PaymentRecordRetrieveParams params = PaymentRecordRetrieveParams.builder().build(); // For SDK versions 29.4.0 or lower, remove '.v1()' from the following line. PaymentRecord paymentRecord = client.v1().paymentRecords().retrieve("{{PAYMENT_RECORD_ID}}", params); ``` ```node // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys const stripe = require('stripe')('<>'); const paymentRecord = await stripe.paymentRecords.retrieve('{{PAYMENT_RECORD_ID}}'); ``` ```go // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys sc := stripe.NewClient("<>") params := &stripe.PaymentRecordRetrieveParams{} result, err := sc.V1PaymentRecords.Retrieve( context.TODO(), "{{PAYMENT_RECORD_ID}}", params) ``` ```dotnet // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys var client = new StripeClient("<>"); var service = client.V1.PaymentRecords; PaymentRecord paymentRecord = service.Get("{{PAYMENT_RECORD_ID}}"); ``` ```json { "processor_details": { "type": "processor_a", }, "latest_payment_attempt_record": "{{PAYMENT_ATTEMPT_RECORD_ID}}", "amount_guaranteed": { "value": 10000, "currency": "usd", }, "payment_method_details": { "payment_method": "{{PAYMENT_METHOD_ID}}", "type": "card", }, } ... ``` ### PaymentAttemptRecord abrufen In Fällen, in denen mehrere Zahlungsversuche vorliegen (z. B. wenn eine Zahlung bei einem anderen Abwickler fehlgeschlagen ist und auf Stripe erfolgreich wiederholt wurde), enthält das PaymentRecord den letzten Zahlungsversuch unter `latest_payment_attempt_record`. Sie können alle Versuche anzeigen, indem Sie PaymentAttemptRecord abfragen: ```curl curl -G https://api.stripe.com/v1/payment_attempt_records \ -u "<>:" \ -d payment_record={{PAYMENT_RECORD_ID}} ``` ```cli stripe payment_attempt_records list \ --payment-record={{PAYMENT_RECORD_ID}} ``` ```ruby # Set your secret key. Remember to switch to your live secret key in production. # See your keys here: https://dashboard.stripe.com/apikeys client = Stripe::StripeClient.new("<>") payment_attempt_records = client.v1.payment_attempt_records.list({ payment_record: '{{PAYMENT_RECORD_ID}}', }) ``` ```python # Set your secret key. Remember to switch to your live secret key in production. # See your keys here: https://dashboard.stripe.com/apikeys client = StripeClient("<>") # For SDK versions 12.4.0 or lower, remove '.v1' from the following line. payment_attempt_records = client.v1.payment_attempt_records.list({ "payment_record": "{{PAYMENT_RECORD_ID}}", }) ``` ```php // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys $stripe = new \Stripe\StripeClient('<>'); $paymentAttemptRecords = $stripe->paymentAttemptRecords->all([ 'payment_record' => '{{PAYMENT_RECORD_ID}}', ]); ``` ```java // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys StripeClient client = new StripeClient("<>"); PaymentAttemptRecordListParams params = PaymentAttemptRecordListParams.builder() .setPaymentRecord("{{PAYMENT_RECORD_ID}}") .build(); // For SDK versions 29.4.0 or lower, remove '.v1()' from the following line. StripeCollection stripeCollection = client.v1().paymentAttemptRecords().list(params); ``` ```node // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys const stripe = require('stripe')('<>'); const paymentAttemptRecords = await stripe.paymentAttemptRecords.list({ payment_record: '{{PAYMENT_RECORD_ID}}', }); ``` ```go // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys sc := stripe.NewClient("<>") params := &stripe.PaymentAttemptRecordListParams{ PaymentRecord: stripe.String("{{PAYMENT_RECORD_ID}}"), } result := sc.V1PaymentAttemptRecords.List(context.TODO(), params) ``` ```dotnet // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys var options = new PaymentAttemptRecordListOptions { PaymentRecord = "{{PAYMENT_RECORD_ID}}", }; var client = new StripeClient("<>"); var service = client.V1.PaymentAttemptRecords; StripeList paymentAttemptRecords = service.List(options); ``` ```json { "object": "list", "data": [{ "id": "par_124", "amount_requested": 10000, "amount_guaranteed": 10000, "amount_failed": 0, }, { "id": "par_123", "amount_requested": 10000, "amount_guaranteed": 0, "amount_failed": 10000, }] } ... ``` Sie können Ihre Zahlungen auch im [Dashboard](https://dashboard.stripe.com/payments) einsehen.