Skip to main content
This guide covers how to integrate Plaid payments into your app. Before you begin, make sure you’ve configured your Plaid connection in the dashboard. Processing a payment with Plaid involves three steps:
  1. Create a Link token - Generate a Plaid Link token via the API using your configured settings
  2. Render Plaid Link - Display the Plaid Link interface to the customer so they can securely connect their bank account
  3. Create a transaction - Submit the public token received from Plaid Link to process the payment
Looking for a complete working example? Check out this sample standalone Plaid app on GitHub that demonstrates the full integration flow.
Use the payment service session API with the create-link-token action to generate a Plaid Link token. This endpoint applies your dashboard settings (identity, signal, balance checks, etc.) to the token request. You can also override any settings by passing custom Plaid Link parameters such as products, additional_consented_products, and optional_products to customize the experience for specific transactions. Refer to the Plaid Link token API documentation for a complete list of available parameters.
using Gr4vy;
using Gr4vy.Models.Components;
using System.Collections.Generic;

var sdk = new Gr4vySDK(
    id: "example",
    server: SDKConfig.Server.Sandbox,
    bearerAuthSource: Auth.WithToken(privateKey),
    merchantAccountId: "default"
);

// SessionAsync takes the ID and the body as separate arguments
var session = await sdk.PaymentServiceDefinitions.SessionAsync(
    paymentServiceDefinitionId: "plaid-bank",
    sessionRequestBody: new SessionRequestBody()
    {
        Action = "create-link-token",
        Payload = new Dictionary<string, object>
        {
            ["products"] = new[] { "auth" },
            ["optional_products"] = new[] { "signal" }
        }
    }
);

Console.WriteLine($"Link token: {session.LinkToken}");
Display Plaid Link using the link_token from the previous step. Plaid Link securely handles bank authentication and account linking for the customer. When the customer successfully links their account, the onSuccess callback receives a publicToken and metadata containing account information. For detailed implementation guides, see the Plaid Link documentation.
import com.plaid.link.Plaid
import com.plaid.link.configuration.LinkTokenConfiguration

class MainActivity : AppCompatActivity() {

  private val linkAccountToPlaid = registerForActivityResult(
    FastOpenPlaidLink()
  ) { result ->
    when (result) {
      is LinkSuccess -> {
        // Send publicToken to your server to create a transaction
        val publicToken = result.publicToken
        val metadata = result.metadata
        submitPayment(publicToken, metadata)
      }
      is LinkExit -> {
        // Handle user exit
        result.error?.let { error ->
          Log.e("Link", "Link exit with error: ${error.errorMessage}")
        }
      }
    }
  }

  override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)

    // Configure Link with your link_token
    val linkTokenConfiguration = LinkTokenConfiguration.Builder()
      .token(linkToken)
      .build()

    // Create and open Link
    val plaidHandler = Plaid.create(application, linkTokenConfiguration)
    linkAccountToPlaid.launch(plaidHandler)
  }
}

Step 3: Create a transaction

On your server, use the publicToken from Step 2 to create a transaction. The publicToken is automatically exchanged for a secure connection to the customer’s bank account. Key parameters (API field names):
  • payment_service_id (paymentServiceId in SDKs) - The UUID of your bank payment processor connection (for example, Plaid Transfer or Adyen) to process the payment through.
  • payment_method.payment_service_id (paymentMethod.paymentServiceId in SDKs) - Optional. The UUID of the Plaid connection (found in the dashboard under Settings -> Connections -> Plaid). If omitted, the system fails the transaction if multiple plaid-bank connectors have been configured.
  • payment_method.account_id (accountId on the payment method in SDKs) - Required if the identity product is not enabled on the Link token and/or merchant account. If identity is enabled, the account ID is fetched automatically. When provided, specifies which account to charge if the customer linked multiple accounts (available in the Plaid metadata).
  • buyer - The buyer’s first and last name are required for transaction processing and identity matching, unless the identity product is enabled and used to fetch this information automatically from Plaid.
using Gr4vy;
using Gr4vy.Models.Components;

var sdk = new Gr4vySDK(
    id: "example",
    server: SDKConfig.Server.Sandbox,
    bearerAuthSource: Auth.WithToken(privateKey),
    merchantAccountId: "default"
);

var res = await sdk.Transactions.CreateAsync(
    transactionCreate: new TransactionCreate()
    {
        Amount = 1299,
        Currency = "USD",
        Country = "US",
        Intent = TransactionCreate.IntentEnum.Capture,
        
        // PaymentMethod is a discriminated union; use the factory method for Plaid
        PaymentMethod = TransactionCreatePaymentMethod.CreatePlaidPaymentMethodCreate(
            new PlaidPaymentMethodCreate()
            {
                Method = PlaidPaymentMethodCreate.MethodEnum.Plaid,
                Token = publicToken,
                AccountId = metadata.Accounts[0].Id
            }
        ),
        
        Buyer = new BuyerCreate()
        {
            BillingAddress = new AddressCreate()
            {
                FirstName = "John",
                LastName = "Doe"
            }
        },
        
        PaymentServiceId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
    }
);

Console.WriteLine($"Status: {res.Transaction?.Status}");
If Plaid is still fetching identity data and the call times out, the API returns unavailable_payment_method. This means Plaid did not finish in time; retry the transaction to allow identity to complete.

Next steps

To enable recurring payments and vault customer bank accounts for future transactions, see Recurring Payments. If you’re using Plaid Signal, configure your ruleset in Signal setup.