Interface TapToPayBridge


public interface TapToPayBridge

What a port implements to read a card with the phone itself. Not for applications, which use com.codename1.payment.terminal.tap.TapToPay.

Ports answer every request through com.codename1.payment.terminal.tap.TapToPayCallbacks, from any thread; the callbacks move to the EDT themselves.

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    cancel(int requestId)
    Cancels the collection requestId if it is still waiting for a card.
    void
    collect(int requestId, String clientSecret, long amount, String currency, String locationId, String merchantDisplayName, boolean simulated)
    Takes one payment: set up the SDK if needed, connect the phone as a reader at locationId, retrieve the PaymentIntent and collect and confirm it.
    void
    connectionTokenReady(int tokenRequestId, String token, String error)
    Answers a TapToPayCallbacks.fetchConnectionToken request.
    boolean
    True when this device can read a card at all (the right hardware and OS version, NFC present).
  • Method Details

    • isDeviceSupported

      boolean isDeviceSupported()

      True when this device can read a card at all (the right hardware and OS version, NFC present). Answers quickly, with no network.

      Returns

      whether Tap to Pay can run here

    • collect

      void collect(int requestId, String clientSecret, long amount, String currency, String locationId, String merchantDisplayName, boolean simulated)

      Takes one payment: set up the SDK if needed, connect the phone as a reader at locationId, retrieve the PaymentIntent and collect and confirm it. Answered by TapToPayCallbacks.deliverResult.

      Parameters
      • requestId: echoed back with the outcome

      • clientSecret: the PaymentIntent's client secret

      • amount: the amount in minor units, as the app asked; the PaymentIntent is authoritative, this is for simulators and logs

      • currency: the ISO 4217 code, as the app asked

      • locationId: the Stripe location the phone acts as a reader for

      • merchantDisplayName: the name on the payment sheet, or null

      • simulated: connect Stripe's simulated reader instead of the phone

    • cancel

      void cancel(int requestId)

      Cancels the collection requestId if it is still waiting for a card.

      Parameters
      • requestId: the request to cancel
    • connectionTokenReady

      void connectionTokenReady(int tokenRequestId, String token, String error)

      Answers a TapToPayCallbacks.fetchConnectionToken request.

      Parameters
      • tokenRequestId: the ID the port asked with

      • token: the token, or null when error is set

      • error: why no token could be had, or null