MustansirZia / flutter_stripe_payment

A flutter plugin with stripe payment plugin integration

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

stripe_payment

Conveniently secure payments methods using Stripe.

Quick Glance

  • Collect chargable tokens from users' Card Input and Apple & Google Pay
  • For SCA compliant apps, setup payment intents for later confirmation.

Apple Pay

Dependencies

Android & iOS

  • Create a Stripe account and project
  • Retrieve a publishable key from the Stripe dashboard

Stripe Dashboard

Android

  • Requires AndroidX

Include support in android/gradle.properties

android.useAndroidX=true
android.enableJetifier=true

(Optional) Create a merchant identifier on the Google Play console

iOS (Apple Pay)

  1. On the Stripe dashboard, go to Settings -> Apple Pay -> Add Application.
  2. Follow the instructions that popup to link Stripe with Apple.

Stripe Apple Pay Setup

  1. Take note of your merchant identifier, and open the iOS module in Xcode.
  2. Navigate the project panel, add Apple Pay under signing capabilites with the merchant identifer created in step 1.

Apple Signing Capabilites

Setup

Using publishable key and merchant identifier, ready the app for collecting user payment information. This needs to be done prior to opening card input or a native payment sheet.

var settings = StripeSettings(publishableKey:"pk_test_yZuUz6SqmH4lA7SrlAvYCh003MvJiJlR", merchantIdentifier: "merchant.stripe-example", androidProductionEnvironment: false);
StripePayment.setSettings(settings);

Card Input

Using addSource, collect a chargable token from the user's card information. This token can be used as a source by the Stripe Charge API.

var token = await StripeSource.addSource();

Native Payment

Opening Apple & Google pay is done with useNativePay.

var order = Order(20, 1, 1, "EUR");
var token = await StripePayment.useNativePay(order)

iOS Payment Sheet Animation

The Apple Pay sheet spins infront of the user, after using the token, show the user whether the transaction was successful or not.

var chargeSucceeded = AppAPI.charge(token, amount);
StripePayment.confirmNativePay(chargeSucceeded);

About

A flutter plugin with stripe payment plugin integration

License:MIT License


Languages

Language:Kotlin 44.9%Language:Objective-C 33.0%Language:Dart 14.4%Language:Ruby 7.7%