Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.

public static final class PlatformPay.Result

  1. Object
  2. PlatformPay.Result
The outcome of #requestPayment(Request, SuccessCallback).

Fields

public static final int SUCCESS = 0The user authorized the payment; #getToken() holds the token.
public static final int CANCELLED = 1The user dismissed the sheet.
public static final int FAILED = 2The wallet failed; #getError() says why.

Methods

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.
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.
public int getStatus()The status: SUCCESS, CANCELLED or FAILED.
public String getToken()The payment token to forward to the PSP: the Apple Pay paymentData JSON, or the Google Pay PaymentData JSON.
public String getError()The error message of a failed payment.

Inherited methods

Field details

SUCCESS

public static final int SUCCESS = 0
The user authorized the payment; #getToken() holds the token.

CANCELLED

public static final int CANCELLED = 1
The user dismissed the sheet.

FAILED

public static final int FAILED = 2
The wallet failed; #getError() says why.

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 boolean
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 String
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