コンテンツにスキップ
アカウントを作成
または
サインイン
Stripe ドキュメントのロゴ
/
AI に質問する
アカウントを作成
サインイン
始める
支払い
売上
プラットフォームおよびマーケットプレイス
資金管理
開発者向けリソース
概要
バージョン管理
変更ログ
API バージョンのアップグレード
SDK バージョンをアップグレードする
Essentials
SDK
API
テスト
Stripe CLI
サンプルプロジェクト
ツール
ワークベンチ
開発者ダッシュボード
Stripe Shell
Visual Studio Code をご利用の場合
機能
ワークフロー
イベントの送信先
Stripe 健全性アラートファイルのアップロード
AI ソリューション
エージェントツールキット
モデルコンテキストプロトコル
セキュリティとプライバシー
セキュリティ
Stripebot ウェブクローラー
プライバシー
Stripe を拡張する
Stripe Appsを構築する
Stripe アプリを使用する
    概要
    Stripeが構築したアプリケーション
    Adobe Commerce
    Cegid
    Commercetools
    Mirakl
    NetSuite
    Oracle Opera
    Oracle Simphony
    Oracle Xstore
    PrestaShop
    Salesforce
      Salesforce B2C Commerce
      Stripe for Salesforce Platform アプリ
        インストール
        設定
        イベントを設定
        Use Stripe app for Salesforce Platform
          Agnostic code examples
          Class Invocable コード
      Salesforce Billing Extension
    SAP
    Shopware 6
    Stripe Tax for BigCommerce
    Stripe Tax for WooCommerce
    パートナーアプリ
    独自のアプリを構築する
パートナー
Partner Ecosystem
パートナー認定
ホーム開発者向けリソースUse apps from StripeSalesforceStripe app for Salesforce PlatformUse Stripe app for Salesforce Platform

注

このページはまだ日本語ではご利用いただけません。より多くの言語で文書が閲覧できるように現在取り組んでいます。準備が整い次第、翻訳版を提供いたしますので、もう少しお待ちください。

Stripe app for Salesforce Platform AgnosticInvocable の例

This guide hands you actionable code examples, showing you step-by-step how to create Stripe customers and PaymentIntents directly within Salesforce. If you’re a Salesforce administrator, a developer, or simply someone aiming to link Stripe and Salesforce for smooth data flow and transaction handling, you’ve come to the right place.

こちらの例では、カスタムの Apex クラスを活用して、Stripe の RESTful API への、汎用的で非依存型のコールを可能にします。これらの例は、Salesforce プラットフォームと Stripe API 間に抽象化レイヤーを確立する場合に便利で、システムを柔軟で管理しやすいものにします。

Stripe で顧客を作成する

次のコード例では、name、email、metadata を設定して Stripe の顧客を作成します。

// Step 1: Create an instance of the stripeGC.RawInvocableParameters class. This class is used to set the parameters for the Stripe API call. stripeGC.RawInvocableParameters parameters = new stripeGC.RawInvocableParameters(); // Step 2: Set the HTTP method to 'POST' as you are creating a new customer. parameters.method = 'POST'; // Step 3: Set the endpoint to '/v1/customers'. This is the Stripe API endpoint for creating a new customer. parameters.endpoint = '/v1/customers'; //Step 4: Set the Stripe Account ID from Salesforce and set it to the accountId field of the parameters object. parameters.accountId = 'a028B0000029RhlQAE'; //Step 5: Set the request body with the customer details. List<String> postCustomerParameters = new List<String>{ 'email=' + 'customerEmail@example.com', 'name=' + 'Tim Smith', 'metadata[AccountId]=' + 'abc123' }; parameters.requestBody = String.join(postCustomerParameters, '&'); //Step 6: Add the parameters object to a list and call the callStripeEndpoint method of the stripeGC.AgnosticInvocable class. List<stripeGC.RawInvocableParameters> paramsCollection = new List<stripeGC.RawInvocableParameters>{ parameters }; List<String> results = stripeGC.AgnosticInvocable.callStripeEndpoint(paramsCollection); //Step 7: The callStripeEndpoint method will return a list of strings. If the customer was created successfully, the first string in the list will be the ID of the new customer. System.debug(results[0]);

PaymentIntent を作成する

このコード例は Stripe で PaymentIntent を作成します。

public class stripePayment { @AuraEnabled(cacheable=true) public static String paymentIntent(String StripeAccountID, String amount, String stripecurrency, String orderID, String onBehalfOf, String customerId) { // Create Call for invocable stripeGC.RawInvocableParameters parameters = new stripeGC.RawInvocableParameters(); // Add HTTP Method parameters.method = 'POST'; // Add endpoint parameters.endpoint = '/v1/payment_intents'; // Get the Stripe Account ID from Salesforce // This assumes you already have the Stripe Account ID and will pass it in as a parameter // Alternately, you could use a SOQL query to obtain the Stripe Account ID as per previous examples parameters.accountId = StripeAccountID; parameters.connectAccount = onBehalfOf; // Prepare the request body List<String> postPaymentIntentParameters = new List<String>{ 'amount=' + amount, // Pass in the amount to be charged for this PaymentIntent in the minimum currency unit (for example, cents for USD) 'currency=' + stripecurrency, // Pass in the currency for this PaymentIntent (for example, 'usd' for USD) 'customer=' + customerId, // Pass in customer to PaymentIntent 'automatic_payment_methods[enabled]=true', //Turning on automatic payment methods 'metadata[order_id]=' + orderID }; parameters.requestBody = String.join(postPaymentIntentParameters, '&'); List<stripeGC.RawInvocableParameters> paramsCollection = new List<stripeGC.RawInvocableParameters>{ parameters }; List<String> results = stripeGC.AgnosticInvocable.callStripeEndpoint(paramsCollection); return (results != null && results.size() > 0) ? results[0] : null; } }

参照情報

  • インストールガイド
  • Enablement videos
  • イベントの設定
このページはお役に立ちましたか。
はいいいえ
  • お困りのことがございましたら 、サポートにお問い合わせください。
  • 早期アクセスプログラムにご参加ください。
  • 変更ログをご覧ください。
  • ご不明な点がございましたら、お問い合わせください。
  • LLM ですか?llms.txt を読んでください。
  • Powered by Markdoc