Search code examples
stripe-paymentspaymentpayment-processing

How to use Stripe metadata in Flutter?


"Updateable Stripe objects—including Account, Charge, Customer, PaymentIntent, Refund, Subscription, and Transfer—have a metadata parameter." [1]

Metadata is useful e.g. to pass an account number to which I am adding money.

https://pub.dev/documentation/stripe_platform_interface/latest/stripe_platform_interface/PaymentIntent-class.html does not have a metadata property or method. How then can I pass metadata to payment intent created by flutter_stripe?


Solution

  • The PaymentIntent should be created in your server, not via the Flutter SDK.

    When creating the PaymentIntent, pass in the metadata : https://stripe.com/docs/api/payment_intents/create#create_payment_intent-metadata

    You may want to take a look at the example app as reference : https://github.com/flutter-stripe/flutter_stripe#run-the-example-app