Online Payment

Makes online payment with the third-party payment service providers such as PayPal, AliPay, Western Union, Google etc.

Currently PayPal is the only supported provider and Android is the only supported OS for PayPal (iOS support is discontinued since version 2019).

eon_mobile_paymentex object

Properties
integer ii_appplatformtype

Platform type. Currently PayPal is the only provider supported by PowerServer.

0 - Unknown.

1 - PayPal.

integer ii_errorcode

Error code which is returned when the oe_error event is triggered. It is designed to hold the error code returned from the payment platform, but currently PayPal returns no error code, so this property is reserved for future use.

powerobject ipo_bindevent

The object to bind with the oe_error event.

string is_bindwitherrorevent

The name of the event bound with the oe_error event of the powerobject ipo_bindevent.

string is_errortext

Error message which is returned when the oe_error event is triggered.

string is_paymentcancel

The name of the event bound with the oe_paymentcancel event.

string is_paymentfailed

The name of the event bound with the oe_paymentfailed event.

string is_paymentok

The name of the event bound with the oe_paymentok event.

Events
oe_error

Description

Occurs when there is any error in this functionality.

Supported on Android client only (Discontinued on iOS since version 2019).

Syntax

None.

Return value

None.

oe_paymentcancel

Description

Occurs when the payment is cancelled or terminated.

Supported on Android client only (Discontinued on iOS since version 2019).

Syntax

None.

Return value

None.

oe_paymentfailed

Description

Occurs when the payment failed.

Supported on Android client only (Discontinued on iOS since version 2019).

Syntax

None.

Return value

None.

oe_paymentok

Description

Occurs when the payment is successful.

Supported on Android client only (Discontinued on iOS since version 2019).

Syntax

None.

Return value

None.

Functions
of_getappplatform

Description

Detects which payment platform the application is connecting now to make payments. Currently PayPal is the only supported platform.

Supported on Android client only (Discontinued on iOS since version 2019).

Syntax

payment.of_getappplatform ( )

Argument Type

Argument

Description

eon_mobile_paymentex

payment

The name of the eon_mobile_paymentex object.

Return value

Integer.

0 - Unknown.

1 - PayPal.

-1 - It is called in PowerBuilder or PowerServer Web, or there is an error.

of_init

Description

Initializes the payment record.

Supported on Android client only (Discontinued on iOS since version 2019).

Syntax

payment.of_init ( eon_mobile_str_paymentinit astr_paymentinit )

Argument Type

Argument

Description

eon_mobile_paymentex

payment

The name of the eon_mobile_paymentex object.

eon_mobile_str_paymentinit astr_paymentinit The payment record to be initialized. (For details, refer to the property of the eon_mobile_str_paymentinit structure.)

Return value

Integer.

1 - Success.

-1 - It is called in PowerBuilder or PowerServer Web, or there is an error.

of_register

Description

Registers the object and the event to be bound with the oe_paymentok, oe_paymentcancel, oe_paymentfailed, and oe_error events.

Supported on Android client only (Discontinued on iOS since version 2019).

Syntax

payment.of_register ( powerobject apb_bind, string as_paymentok, string as_paymentcancel, string as_paymentfailed, string as_error )

Argument Type

Argument

Description

eon_mobile_paymentex

payment

The name of the eon_mobile_paymentex object.

powerobject apb_bind The object to be bound with the oe_paymentok, oe_paymentcancel, oe_paymentfailed, and oe_error events.
string as_paymentok The event to be bound with the oe_paymentok event.
string as_paymentcancel The event to be bound with the oe_paymentcancel event.
string as_paymentfailed The event to be bound with the oe_paymentfailed event.
string as_error The event to be bound with the oe_error event.

Return value

Integer.

1 - Success.

-1 - It is called in PowerBuilder or PowerServer Web, or there is an error.

of_setappplatform

Description

Sets the payment platform which the application will connect to make payments. Currently PayPal is the only supported platform.

Supported on Android client only (Discontinued on iOS since version 2019).

Syntax

payment.of_setappplatform ( integer ai_appplatform )

Argument Type

Argument

Description

eon_mobile_paymentex

payment

The name of the eon_mobile_paymentex object.

integer ai_appplatform

Type of the payment platform. Currently PayPal is the only supported platform.

0 - Unknown.

1 - PayPal.

Return value

Integer.

1 - Success.

-1 - It is called in PowerBuilder or PowerServer Web, or there is an error.

of_submit

Description

Submits the payment record.

Supported on Android client only (Discontinued on iOS since version 2019).

Syntax

payment.of_submit ( eon_mobile_str_paymentsubmit astr_paymentsubmit )

Argument Type

Argument

Description

eon_mobile_paymentex

payment

The name of the eon_mobile_paymentex object.

eon_mobile_str_paymentsubmit astr_paymentsubmit The payment record to be submitted. (For details, refer to the property of the eon_mobile_str_paymentsubmit structure.)

Return value

Integer.

1 - Success.

-1 - It is called in PowerBuilder or PowerServer Web, or there is an error.

of_triggerevent

Description

Triggers the object event that is bound with oe_error or the other events.

Supported on Android client only (Discontinued on iOS since version 2019).

Syntax

payment.of_triggerevent ( string as_event )

Argument Type

Argument

Description

eon_mobile_paymentex

payment

The name of the eon_mobile_paymentex object.

string as_event The event name bound with oe_error or the other events.

Return value

None.

Structures
eon_mobile_str_paymentinit

Description

Struct.

Detailed information about the initialized payment record.

Property

Type

Variable Name

Description

string

s_clientid

PayPal ID for the merchant.

eon_mobile_str_paymentsubmit

Description

Struct.

Detailed information about the payment record to be submitted.

Property

Type

Variable Name

Description

double

dbl_countmoney

Total amount of money.

string

s_currency

Currency.

string

s_productname

Product name.

Code example

Below is the sample code for making an online payment via PayPal.

eon_mobile_paymentex   lnv_payment
eon_mobile_str_paymentinit   lstr_paymentinit
eon_mobile_str_paymentsubmit  lstr_paymentsubmit
integer li_re

lnv_payment = create eon_mobile_paymentex

//bind oe_paymentok, oe_paymentcancel, oe_paymentfailed, and oe_error events of lnv_payment with
//ue_paymentok, ue_paymentcancel, ue_paymentfailed, and ue_error events of the parent window.
lnv_payment.of_register ( parent, "ue_paymentok", "ue_paymentcancel", "ue_paymentfailed", "ue_error") 

//initialize platform
lnv_payment.of_setappplatform(1)

//initialize payment
lstr_paymentinit.s_clientid = "AXMNlBBgmfChHPgrMAtrrdTtkWk52THb9Hl54uZ6vASDWSOll8"
li_re = lnv_payment.of_init (lstr_paymentinit)

if li_re =  1 then
         //submit payment
         lstr_paymentsubmit.dbl_countmoney = 9.99
         lstr_paymentsubmit.s_currency = "USD"
         lstr_paymentsubmit.s_productname = "shoes"
                
         li_re = lnv_payment.of_submit (lstr_paymentsubmit)
         if li_re = 1 then
                  MessageBox ("","Payment is successful!")
         else
                  MessageBox ("","Payment failed!")
         end if    
else
         MessageBox("","Failed to initialize payment!")
end if

destroy lnv_payment