.NETヘルプ Stripe .NET(開発者向けの動作方法) Curtis Chau 更新日:7月 28, 2025 Download IronPDF NuGet Download テキストの検索と置換 テキストと画像のスタンプ Start Free Trial Copy for LLMs Copy for LLMs Copy page as Markdown for LLMs Open in ChatGPT Ask ChatGPT about this page Open in Gemini Ask Gemini about this page Open in Grok Ask Grok about this page Open in Perplexity Ask Perplexity about this page Share Share on Facebook Share on X (Twitter) Share on LinkedIn Copy URL Email article Stripe.Net Integration with IronPDF Stripe.Netは、開発者がStripeの支払い処理機能を.NETアプリケーションに統合できるようにする強力な.NETライブラリです。 Stripeは、企業がオンラインでの支払いを受け入れることを可能にする人気のある決済ゲートウェイです。Stripe.Netを使用すると、開発者はStripe APIが提供する強力な機能を使用して、トランザクション、顧客、サブスクリプションなどを管理できます。 この記事では、Stripeを使用してIronPDFでPDFを作成する方法について説明します。 Stripe.Netの始め方 新しいVisual Studioプロジェクトの作成 Stripe.Netを使い始めるには、新しいVisual Studioプロジェクトを作成するか、既存のプロジェクトを開く必要があります。 このチュートリアルでは、コンソールアプリケーションプロジェクトを使用します。 Visual Studio を開き、「新しいプロジェクトを作成」をクリックします。 新しいウィンドウが表示されます。 コンソールアプリケーションを選択して次へをクリックします。 次のウィンドウで、プロジェクト名と場所を入力し、次へをクリックします。 次のウィンドウで、フレームワークを選択し、「作成」をクリックします。 このようにして、新しいVisual Studioコンソールアプリケーションプロジェクトが作成されます。 インストール プロジェクトでStripe.Netを使用し始めるには、NuGetを介してStripe.Netパッケージをインストールする必要があります。 パッケージマネージャーコンソールまたはVisual StudioのNuGetパッケージマネージャーを使用してこれを行うことができます。 パッケージマネージャーコンソールの使用方法: Install-Package Stripe.net または dotnet add package Stripe.net NuGetパッケージマネージャーを使用して、「Stripe.net」を検索し、パッケージをインストールします。 設定 インストール後、Stripeアカウントで見つけることができるStripe APIキーを設定する必要があります。 このキーは、Stripe APIへのリクエストを認証するために不可欠です。 通常、このキーはセキュリティ目的で設定ファイルまたは環境変数に保存されます。 APIキーのセットアップ例はこちらです。 StripeConfiguration.ApiKey = "your_secret_api_key"; StripeConfiguration.ApiKey = "your_secret_api_key"; StripeConfiguration.ApiKey = "your_secret_api_key" $vbLabelText $csharpLabel Stripe.Netでの基本操作 顧客の作成 Stripe.Netを使用する際の基本操作の1つが顧客の作成です。 顧客は、支払い方法やサブスクリプションと関連付けることができます。 var options = new CustomerCreateOptions { Email = "customer@example.com", Name = "John Doe", }; var service = new CustomerService(); Customer customer = service.Create(options); var options = new CustomerCreateOptions { Email = "customer@example.com", Name = "John Doe", }; var service = new CustomerService(); Customer customer = service.Create(options); Dim options = New CustomerCreateOptions With { .Email = "customer@example.com", .Name = "John Doe" } Dim service = New CustomerService() Dim customer As Customer = service.Create(options) $vbLabelText $csharpLabel Stripeダッシュボードの出力 支払いインテントの作成 PaymentIntentは、Stripeでの支払いプロセスを表すオブジェクトです。作成から完了までの支払いライフサイクルを追跡するように設計されています。 var options = new PaymentIntentCreateOptions { Amount = 2000, Currency = "usd", PaymentMethodTypes = new List<string> { "card", }, }; var service = new PaymentIntentService(); PaymentIntent paymentIntent = service.Create(options); var options = new PaymentIntentCreateOptions { Amount = 2000, Currency = "usd", PaymentMethodTypes = new List<string> { "card", }, }; var service = new PaymentIntentService(); PaymentIntent paymentIntent = service.Create(options); Dim options = New PaymentIntentCreateOptions With { .Amount = 2000, .Currency = "usd", .PaymentMethodTypes = New List(Of String) From {"card"} } Dim service = New PaymentIntentService() Dim paymentIntent As PaymentIntent = service.Create(options) $vbLabelText $csharpLabel 高度な機能 サブスクリプション Stripeは様々なサブスクリプションモデルをサポートしており、Stripe.Netを使用してサブスクリプションを管理することは簡単です。 サブスクリプションを作成、更新、キャンセルできます。 var options = new SubscriptionCreateOptions { Customer = "cus_123456789", Items = new List<SubscriptionItemOptions> { new SubscriptionItemOptions { Plan = "plan_123456789", }, }, }; var service = new SubscriptionService(); Subscription subscription = service.Create(options); var options = new SubscriptionCreateOptions { Customer = "cus_123456789", Items = new List<SubscriptionItemOptions> { new SubscriptionItemOptions { Plan = "plan_123456789", }, }, }; var service = new SubscriptionService(); Subscription subscription = service.Create(options); Dim options = New SubscriptionCreateOptions With { .Customer = "cus_123456789", .Items = New List(Of SubscriptionItemOptions) From { New SubscriptionItemOptions With {.Plan = "plan_123456789"} } } Dim service = New SubscriptionService() Dim subscription As Subscription = service.Create(options) $vbLabelText $csharpLabel 紛争の処理 紛争は、顧客が銀行またはクレジットカード会社と課金について問い合わせたときに発生します。 Stripe.Netを使用すると、紛争をリスト、取得、応答することができます。 var service = new DisputeService(); Dispute dispute = service.Get("dp_123456789"); var service = new DisputeService(); Dispute dispute = service.Get("dp_123456789"); Dim service = New DisputeService() Dim dispute As Dispute = service.Get("dp_123456789") $vbLabelText $csharpLabel ベストプラクティス セキュリティ:APIキーを常に安全に保ち、ソースファイルにハードコードしないでください。 エラーハンドリング:例外や失敗したAPIコールを管理するために、強力なエラーハンドリングを実装してください。 テスト:Stripeのテストモードを使用し、統合を徹底的にテストするためにテストカード番号を提供してください。 ドキュメンテーション:公式のStripe APIドキュメントとStripe.Netライブラリのドキュメントを参照して、最新情報および例を確認してください。 IronPDF for C#の紹介 IronPDFは、開発者がPDFドキュメントを作成、編集、および内容を抽出できるC#ライブラリです。 レポート、請求書、その他のドキュメントニーズのために.NETアプリケーションでPDFを生成するための理想的なツールです。 IronPDFはウェブページ、URL、およびHTMLをPDF形式に正確に変換でき、オンラインコンテンツからのPDFドキュメント(レポートや請求書など)を作成するための完璧なツールです。 using IronPdf; class Program { static void Main(string[] args) { var renderer = new ChromePdfRenderer(); // 1. Convert HTML String to PDF var htmlContent = "<h1>Hello, IronPDF!</h1><p>This is a PDF from an HTML string.</p>"; var pdfFromHtmlString = renderer.RenderHtmlAsPdf(htmlContent); pdfFromHtmlString.SaveAs("HTMLStringToPDF.pdf"); // 2. Convert HTML File to PDF var htmlFilePath = "path_to_your_html_file.html"; // Specify the path to your HTML file var pdfFromHtmlFile = renderer.RenderHtmlFileAsPdf(htmlFilePath); pdfFromHtmlFile.SaveAs("HTMLFileToPDF.pdf"); // 3. Convert URL to PDF var url = "http://ironpdf.com"; // Specify the URL var pdfFromUrl = renderer.RenderUrlAsPdf(url); pdfFromUrl.SaveAs("URLToPDF.pdf"); } } using IronPdf; class Program { static void Main(string[] args) { var renderer = new ChromePdfRenderer(); // 1. Convert HTML String to PDF var htmlContent = "<h1>Hello, IronPDF!</h1><p>This is a PDF from an HTML string.</p>"; var pdfFromHtmlString = renderer.RenderHtmlAsPdf(htmlContent); pdfFromHtmlString.SaveAs("HTMLStringToPDF.pdf"); // 2. Convert HTML File to PDF var htmlFilePath = "path_to_your_html_file.html"; // Specify the path to your HTML file var pdfFromHtmlFile = renderer.RenderHtmlFileAsPdf(htmlFilePath); pdfFromHtmlFile.SaveAs("HTMLFileToPDF.pdf"); // 3. Convert URL to PDF var url = "http://ironpdf.com"; // Specify the URL var pdfFromUrl = renderer.RenderUrlAsPdf(url); pdfFromUrl.SaveAs("URLToPDF.pdf"); } } Imports IronPdf Friend Class Program Shared Sub Main(ByVal args() As String) Dim renderer = New ChromePdfRenderer() ' 1. Convert HTML String to PDF Dim htmlContent = "<h1>Hello, IronPDF!</h1><p>This is a PDF from an HTML string.</p>" Dim pdfFromHtmlString = renderer.RenderHtmlAsPdf(htmlContent) pdfFromHtmlString.SaveAs("HTMLStringToPDF.pdf") ' 2. Convert HTML File to PDF Dim htmlFilePath = "path_to_your_html_file.html" ' Specify the path to your HTML file Dim pdfFromHtmlFile = renderer.RenderHtmlFileAsPdf(htmlFilePath) pdfFromHtmlFile.SaveAs("HTMLFileToPDF.pdf") ' 3. Convert URL to PDF Dim url = "http://ironpdf.com" ' Specify the URL Dim pdfFromUrl = renderer.RenderUrlAsPdf(url) pdfFromUrl.SaveAs("URLToPDF.pdf") End Sub End Class $vbLabelText $csharpLabel 主要機能 1. HTMLからPDFへ IronPDFは、HTML文字列、URL、およびHTMLファイルをPDFに変換することでPDFドキュメントを簡単に作成できます。 2. PDF編集 既存のPDFドキュメントを簡単に編集します。 IronPDFを使用すると、特定のインデックスにページを追加、ページをコピーまたは削除、PDFを分割、ページを抽出して新しいPDFを作成するなど、既存のPDFを操作できます。 3. PDFのマージ IronPDFのマージ機能を使用すると、複数のPDFドキュメントを1つに結合できます。 4. PDFセキュリティ IronPDFは、PDFにパスワードと許可を追加し、PDFのセキュリティを強化します。 5. PDFの暗号化と復号化 IronPDFは、PDFドキュメントの128ビット暗号化、復号化、パスワード保護をサポートしています。 6. PDFドキュメントにデジタル署名を追加 開発者はIronPDFを使用してPDFにプログラム的にデジタル署名を追加できます。 .pfxおよび.p12形式のデジタル署名証明書を使用して複数の方法でPDFに署名することができます。 例:Stripe.NetとIronPDFを使用したPDF請求書の生成 Stripe.Netでの支払い処理後にIronPDFを使用してPDF請求書を生成する実用的な例を作成しましょう。 IronPDF .NETライブラリのインストール NuGetパッケージマネージャーを使用したIronPDFのインストール手順: ASP.NETプロジェクトをVisual Studioで開き、「ツール」メニューに移動します。 「NuGetパッケージマネージャー」を選択し、「ソリューション用のNuGetパッケージを管理」をクリックします。 「参照」タブで「IronPDF」を検索し、希望のバージョンを選択します。 「インストール」をクリックして、プロジェクトにパッケージを追加します。 IronPDFとその依存関係は自動的にダウンロードおよび統合され、ASP.NETアプリケーションでその機能をシームレスに活用できるようになります。 支払い処理と請求書の生成 Stripe.Net APIを使用して新しい支払いを作成し、IronPDFを使用してPDF請求書を生成する完全な例を示します。 using Stripe; using IronPdf; using System; using System.Collections.Generic; public class PaymentService { public void ProcessPaymentAndGenerateInvoice() { // Configure Stripe API key StripeConfiguration.ApiKey = "your_secret_key"; // Create a PaymentIntent var paymentIntentOptions = new PaymentIntentCreateOptions { Amount = 2000, // Amount in cents Currency = "usd", PaymentMethodTypes = new List<string> { "card" }, }; var paymentIntentService = new PaymentIntentService(); PaymentIntent paymentIntent = paymentIntentService.Create(paymentIntentOptions); // Assuming payment succeeded, create a PDF invoice GeneratePdfInvoice(paymentIntent); } private void GeneratePdfInvoice(PaymentIntent paymentIntent) { // Create HTML content for the invoice var htmlContent = $@" <html> <head> <title>Invoice</title> </head> <body> <h1>Invoice</h1> <p>Payment ID: {paymentIntent.Id}</p> <p>Amount: {paymentIntent.Amount / 100.0:C}</p> <p>Status: {paymentIntent.Status}</p> </body> </html>"; // Convert the HTML content to a PDF document var renderer = new ChromePdfRenderer(); var pdfDocument = renderer.RenderHtmlAsPdf(htmlContent); // Save the PDF document to a file var filePath = "invoice.pdf"; pdfDocument.SaveAs(filePath); Console.WriteLine($"Invoice saved to {filePath}"); } } class Program { static void Main(string[] args) { var service = new PaymentService(); service.ProcessPaymentAndGenerateInvoice(); } } using Stripe; using IronPdf; using System; using System.Collections.Generic; public class PaymentService { public void ProcessPaymentAndGenerateInvoice() { // Configure Stripe API key StripeConfiguration.ApiKey = "your_secret_key"; // Create a PaymentIntent var paymentIntentOptions = new PaymentIntentCreateOptions { Amount = 2000, // Amount in cents Currency = "usd", PaymentMethodTypes = new List<string> { "card" }, }; var paymentIntentService = new PaymentIntentService(); PaymentIntent paymentIntent = paymentIntentService.Create(paymentIntentOptions); // Assuming payment succeeded, create a PDF invoice GeneratePdfInvoice(paymentIntent); } private void GeneratePdfInvoice(PaymentIntent paymentIntent) { // Create HTML content for the invoice var htmlContent = $@" <html> <head> <title>Invoice</title> </head> <body> <h1>Invoice</h1> <p>Payment ID: {paymentIntent.Id}</p> <p>Amount: {paymentIntent.Amount / 100.0:C}</p> <p>Status: {paymentIntent.Status}</p> </body> </html>"; // Convert the HTML content to a PDF document var renderer = new ChromePdfRenderer(); var pdfDocument = renderer.RenderHtmlAsPdf(htmlContent); // Save the PDF document to a file var filePath = "invoice.pdf"; pdfDocument.SaveAs(filePath); Console.WriteLine($"Invoice saved to {filePath}"); } } class Program { static void Main(string[] args) { var service = new PaymentService(); service.ProcessPaymentAndGenerateInvoice(); } } Imports Stripe Imports IronPdf Imports System Imports System.Collections.Generic Public Class PaymentService Public Sub ProcessPaymentAndGenerateInvoice() ' Configure Stripe API key StripeConfiguration.ApiKey = "your_secret_key" ' Create a PaymentIntent Dim paymentIntentOptions = New PaymentIntentCreateOptions With { .Amount = 2000, .Currency = "usd", .PaymentMethodTypes = New List(Of String) From {"card"} } Dim paymentIntentService As New PaymentIntentService() Dim paymentIntent As PaymentIntent = paymentIntentService.Create(paymentIntentOptions) ' Assuming payment succeeded, create a PDF invoice GeneratePdfInvoice(paymentIntent) End Sub Private Sub GeneratePdfInvoice(ByVal paymentIntent As PaymentIntent) ' Create HTML content for the invoice 'INSTANT VB WARNING: Instant VB cannot determine whether both operands of this division are integer types - if they are then you should use the VB integer division operator: Dim htmlContent = $" <html> <head> <title>Invoice</title> </head> <body> <h1>Invoice</h1> <p>Payment ID: {paymentIntent.Id}</p> <p>Amount: {paymentIntent.Amount / 100.0:C}</p> <p>Status: {paymentIntent.Status}</p> </body> </html>" ' Convert the HTML content to a PDF document Dim renderer = New ChromePdfRenderer() Dim pdfDocument = renderer.RenderHtmlAsPdf(htmlContent) ' Save the PDF document to a file Dim filePath = "invoice.pdf" pdfDocument.SaveAs(filePath) Console.WriteLine($"Invoice saved to {filePath}") End Sub End Class Friend Class Program Shared Sub Main(ByVal args() As String) Dim service = New PaymentService() service.ProcessPaymentAndGenerateInvoice() End Sub End Class $vbLabelText $csharpLabel 出力 結論 Stripe.Netは、Stripeの支払い処理を.NETアプリケーションに統合するのを簡素化する包括的で強力なライブラリです。 基本的なトランザクション処理からサブスクリプションと紛争の管理まで、さまざまな支払い関連のニーズに対応しています。 IronPDFは、PDFドキュメントの生成、編集、管理を可能にすることでStripe.Netを補完します。 これらのライブラリを組み合わせることで、.NETアプリケーションでの支払い処理と対応するドキュメントの生成に対する堅牢なソリューションを提供します。 Stripe.NetとIronPDFの両方の機能を活用することで、開発者は支払い処理からドキュメント生成までのすべてを処理し、アプリケーションの全体的な機能とユーザー体験を向上させるシームレスで効率的なワークフローを作成できます。 IronPDFはIronPDFの無料トライアルを提供し、その広範な機能を試す機会を開発者に提供しています。 IronPDFは、顧客サポートと更新を提供し、ユーザーが最大限に活用できるようにコード例と徹底的なドキュメントを提供しています。 トピックをさらに探究するために、IronPDFを使用したHTMLからPDFへの変換に関する当社の詳細なチュートリアルを参照してください。 よくある質問 .NETアプリケーションに支払い処理を統合するにはどうすれば良いですか? `Stripe.Net`ライブラリを使用して、.NETアプリケーションに支払い処理を統合することができます。このライブラリを使えば、支払いの管理、顧客の作成、および請求の処理が可能です。 新しいVisual StudioプロジェクトでStripe.Netをセットアップするには、どのような手順が必要ですか? 新しいVisual StudioプロジェクトでStripe.Netをセットアップするには、まず新しいプロジェクトを作成し、NuGet経由で`Stripe.Net`パッケージをインストールし、Stripe APIキーを設定してAPIリクエストを認証します。 .NETアプリケーションでのサブスクリプション管理はどのように行いますか? Stripe.Netは、サブスクリプションを管理するための組み込みメソッドを提供し、APIを通じてサブスクリプションを作成、更新、およびキャンセルすることができます。 Stripe.NetでAPIキーを安全に保管するためのベストプラクティスは何ですか? Stripe.NetでAPIキーを安全に保管するためのベストプラクティスには、環境変数または設定ファイルを使用してキーを安全に保存し、ソースコードにハードコーディングしないことが含まれます。 .NETアプリケーションで支払い処理後にドキュメントまたは請求書を生成するにはどうすれば良いですか? Stripe.Netでの支払い処理後、IronPDFを使用してHTMLコンテンツをPDFファイルに変換し、請求のニーズにプロフェッショナルな出力を提供することができます。 Stripe.Netと共にC# PDFライブラリを使用する利点は何ですか? Stripe.Netと共にIronPDFのようなC# PDFライブラリを使用すると、簡単にPDFドキュメントを作成、管理、カスタマイズでき、請求書など.NETアプリケーションの機能を向上させます。 Stripe.NetでPaymentIntentを作成するにはどうすれば良いですか? Stripe.NetでPaymentIntentを作成するには、`PaymentIntentService`クラスと`PaymentIntentCreateOptions`を使用して支払いの詳細を指定し、支払いのライフサイクルを追跡します。 Stripe.Netを統合する際の一般的な問題をトラブルシューティングするにはどうすれば良いですか? Stripe.Netを統合する際の一般的な問題は、APIキーの設定を確認し、Stripeライブラリメソッドの正しい使用を確認し、特定のガイダンスのためにエラーメッセージを見直すことで解決できます。 Stripe.Netの提供する高度な機能にはどのようなものがありますか? Stripe.Netの提供する高度な機能には、支払いの紛争対応、定期請求の管理、強力なエラーハンドリングを伴う安全な支払い処理の実装が含まれます。 .NETアプリケーションでHTMLコンテンツをPDFに変換するにはどうすれば良いですか? .NETアプリケーションでHTMLコンテンツをPDFに変換するには、RenderHtmlAsPdf(HTML文字列用)やRenderHtmlFileAsPdf(HTMLファイル用)といったIronPDFのメソッドを使用します。 Curtis Chau 今すぐエンジニアリングチームとチャット テクニカルライター Curtis Chauは、カールトン大学でコンピュータサイエンスの学士号を取得し、Node.js、TypeScript、JavaScript、およびReactに精通したフロントエンド開発を専門としています。直感的で美しいユーザーインターフェースを作成することに情熱を持ち、Curtisは現代のフレームワークを用いた開発や、構造の良い視覚的に魅力的なマニュアルの作成を楽しんでいます。開発以外にも、CurtisはIoT(Internet of Things)への強い関心を持ち、ハードウェアとソフトウェアの統合方法を模索しています。余暇には、ゲームをしたりDiscordボットを作成したりして、技術に対する愛情と創造性を組み合わせています。 関連する記事 更新日 9月 4, 2025 RandomNumberGenerator C# RandomNumberGenerator C#クラスを使用すると、PDF生成および編集プロジェクトを次のレベルに引き上げることができます 詳しく読む 更新日 9月 4, 2025 C# String Equals(開発者向けの仕組み) 強力なPDFライブラリであるIronPDFと組み合わせることで、switchパターンマッチングは、ドキュメント処理のためのよりスマートでクリーンなロジックを構築できます 詳しく読む 更新日 8月 5, 2025 C# Switch Pattern Matching(開発者向けの仕組み) 強力なPDFライブラリであるIronPDFと組み合わせることで、switchパターンマッチングは、ドキュメント処理のためのよりスマートでクリーンなロジックを構築できます 詳しく読む Papercut SMTP C#(開発者向けの動作方法)TensorFlow .NET(開発者向け...
更新日 9月 4, 2025 RandomNumberGenerator C# RandomNumberGenerator C#クラスを使用すると、PDF生成および編集プロジェクトを次のレベルに引き上げることができます 詳しく読む
更新日 9月 4, 2025 C# String Equals(開発者向けの仕組み) 強力なPDFライブラリであるIronPDFと組み合わせることで、switchパターンマッチングは、ドキュメント処理のためのよりスマートでクリーンなロジックを構築できます 詳しく読む
更新日 8月 5, 2025 C# Switch Pattern Matching(開発者向けの仕組み) 強力なPDFライブラリであるIronPDFと組み合わせることで、switchパターンマッチングは、ドキュメント処理のためのよりスマートでクリーンなロジックを構築できます 詳しく読む