Class PlatformPay.Result

java.lang.Object
com.codename1.payment.PlatformPay.Result
Enclosing class:
PlatformPay

public static final class PlatformPay.Result extends Object
The outcome of #requestPayment(Request, SuccessCallback).
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    The user dismissed the sheet.
    static final int
    The wallet failed; #getError() says why.
    static final int
    The user authorized the payment; #getToken() holds the token.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    complete(boolean success)
    Reports whether the app's server charged the token, which closes the Apple Pay sheet with a success or a failure mark.
    Decodes the string a port reports: ok: followed by the token, cancel, or error: followed by a message.
    The error message of a failed payment.
    int
    The status: SUCCESS, CANCELLED or FAILED.
    The payment token to forward to the PSP: the Apple Pay paymentData JSON, or the Google Pay PaymentData JSON.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • SUCCESS

      public static final int SUCCESS
      The user authorized the payment; #getToken() holds the token.
      See Also:
    • CANCELLED

      public static final int CANCELLED
      The user dismissed the sheet.
      See Also:
    • FAILED

      public static final int FAILED
      The wallet failed; #getError() says why.
      See Also:
  • Method Details

    • complete

      public void complete(boolean success)

      Reports whether the app's server charged the token, which closes the Apple Pay sheet with a success or a failure mark. Call it once, after a SUCCESS result, when the payment service provider has answered. Later calls, and calls on any other result, do nothing. Without a call the iOS sheet reports a failure after 30 seconds. Google Pay needs no call; it does nothing there.

      Parameters
      • success: true when the charge went through
    • decode

      public static PlatformPay.Result decode(String s)

      Decodes the string a port reports: ok: followed by the token, cancel, or error: followed by a message.

      Parameters
      • s: the encoded result
      Returns

      the result

    • getStatus

      public int getStatus()

      The status: SUCCESS, CANCELLED or FAILED.

      Returns

      the status

    • getToken

      public String getToken()

      The payment token to forward to the PSP: the Apple Pay paymentData JSON, or the Google Pay PaymentData JSON.

      Returns

      the token, or null unless the status is SUCCESS

    • getError

      public String getError()

      The error message of a failed payment.

      Returns

      the message, or null