Skip to content

Square-Six/Xamarin.Stripe.Terminal.Forms

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Xamarin.Stripe.Terminal.Forms

Support platforms

  • Android
  • iOS

Initialization before use

iOS:

  • No initialization needed

Android:

  • In the MainActivity.cs class OnCreate method add the following line of code.
TerminalService.Init(this);

Usage

  • In your shared code, create a class that implements the IConnectionTokenProviderService interface and overide the FetchConnectionToken method. This is where you will handle the logic to retreive your stripe connection token.
public class MyStripeTokenFetchService : IConnectionTokenProviderService
{
     public MyStripeTokenFetchService()
     {
     }

     public async Task<string> FetchConnectionToken()
     {
         var token = "{YOUR_STRIPE_TOKEN}";
         return token;
     }
 }
  • Create an instance of the TerminalService and call the InitTerminalManager passing in an instance of the class that implents the IConnectionTokenProviderService.
stripeTerminalService.InitTerminalManager(myStripeTokenFetchService);
  • NOTE: Make sure that location permissions are enabled before calling InitTemrinal.

IStripeTerminalService Interafce methods

bool IsTerminalConnected { get; }
void InitTerminalManager(IConnectionTokenProviderService providerService);
void DiscoverReaders(StripeDiscoveryConfiguration config, Action<IList<StripeTerminalReader>> readers, Action scanTimeoutCallback);
void CancelDiscover();
void ConnectToReader(StripeTerminalReader reader, Action<ReaderConnectionResult> onReaderConnectionSuccess);
void ReconnectToReader(Action<bool> onReaderConnectionSuccess);
void RetreivePaymentIntent(string clientSecret, Action<string> onSuccess, Action<string> onFailure);
void CancelPayment();
void DisconnectReader();
string ArePermissionsGranted();
void CheckForSoftwareUpdate(Action<string, string> hasUpdate);
void UpdateSoftware(Action<float> updateMessage, Action<string> complete);
void RegisterReaderMessageNotifications(Action<string> readerMessageNotificationHandler);
void TearDownReaderMessageNotifications();
void RegisterConnectionMessageNotifications(Action<string> readerConnectionNotificationHandler);
void TearDownConnectionMessageNotifications();

NOTE: If you run into any compiler issues with Java exited with Code 1 or DX8, on the Android side, try adding the folliwing nuget package to resolve the issue.

<PackageReference Include="Xamarin.Google.Guava.ListenableFuture" ExcludeAssets="build;buildTransitive">
   <Version>1.0.0.2</Version>
</PackageReference>

Native SDK Documentation

iOS:

Android:

For any requests, bug or comments, please open an issue or submit a pull request.

About

This is the home of the Stripe-Terminal SDK bindings for Xamarin.Forms

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages