B4A Library Mobile Payments Library

Hello everyone,

This app lets you add in-app purchases from your Basic4Android application.
You are able to pay with Paypal, creditcard, etc.

The library is from ZooZ, not the one from PayPal!. It is a very to use library with a few functions.
All transactions, etc are done by ZooZ.

ZooZ is a software library for mobile application developers (runs on Android & iOS platforms) that enables to accept payments in your app quickly and easily.
ZooZ handles the entire payment process removing all the headaches from you as a merchant and developer.

Integration is easy and can be completed in 4 easy steps:

Step 1
Download all 4 library files (2 .jars and 2 .xmls), place them in your additional library folder and check them in your Basic4Android library pane at the right side of the IDE.

Step 2
Register at zooz.CO - purchase this domain.

Step 3
Register your app - Your app needs to be registered via this link.
When registering the app you receive a unique "APP KEY", which need to be used in the integration code.

Step 4
Code integration - The attachments includes a working sample file with the functions included.
Fill in your AppKey received from step 3.

B4X:
Dim Payment as MobilePayment

Two events are raised when the transaction succeeds or fails:
B4X:
Sub Payment_Success (TransactionID As String)
   Msgbox("Transaction ID: " & TransactionID, "Transaction Successful.")

End Sub

Sub Payment_Error (ErrorCode As Int, ErrorMessage As String)
   Msgbox("Error in transaction." & CRLF & "Error code: " & ErrorCode & CRLF & ErrorMessage, "Transaction Error")
End Sub

Step 5
Edit your manifest file and add the following 2 functions in your application node.

<!-- ZooZ Activity -->
<activity android:name="com.zooz.android.lib.CheckoutActivity" android:theme="@android:style/Theme.Translucent"/>
<!-- Pay Pal -->
<activity android:name="com.paypal.android.MEP.PayPalActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar"
android:configChanges="keyboardHidden|orientation"/>

In project - do not overwrite manifest.

Step 6
Go live - After Integration and testing are completed you can move to production and start accepting payments.
https://app.zooz.co/portal/PortalController?cmd=integration

And that's all.
I haven't been able to test it, as for the first time, you have to enter a creditcard number, and unfortunately, I don't have one.

Have fun!

Tomas

EDIT: I hope the forum max zip upload can be updated some time. :)




DOWNLOAD ATTACHMENTS HERE:
www.rootsoftllc.com/Basic4Android/MobilePaymentLibrary1.0.zip
 
Last edited:

canalrun

Well-Known Member
Licensed User
Longtime User
I am interested in using the MobilePaymentsLibrary.

To get started I tried to run the sample application that came with the library. I put the 4 library files in my additional libraries directory, and changed the AppKey to one that was issued by ZooZ.

I compiled and tried to run the included sample application on both the emulator and my Samsung galaxy S.

In both when I press the "purchase" button, the device pauses for a few seconds then gives me the error:

The application MobilePayment (process com.rootsoft.mobilepayment) has stopped unexpectedly. Please try again.

Any clues?

Thanks,
Barry.
 

canalrun

Well-Known Member
Licensed User
Longtime User
Please check the unfiltered logs and post the error message.

Thanks.

ID[0]=0(0) Dn(0=>1)
Ulight 3->7|0
Dsptch > Window{480888e8 com.android.packageinstaller/com.android.packageinstaller.InstallAppProgress paused=false}
Dsptch > Window{480888e8 com.android.packageinstaller/com.android.packageinstaller.InstallAppProgress paused=false}
ID[0]=0(0) Up(1=>0)
Starting activity: Intent { act=android.intent.action.MAIN flg=0x10000000 cmp=com.rootsoft.mobilepayment/.main }
ALSA OPEN mode 0,device 2
Try to open ALSA PLAYBACK device AndroidPlayback_Speaker_normal
Initialized ALSA PLAYBACK device AndroidPlayback_Speaker_normal
Set PLAYBACK PCM format to S16_LE (Signed 16 bit Little Endian)
Using 2 channels for PLAYBACK.
Set PLAYBACK sample rate to 44100 HZ
Buffer size: 2048
Latency: 46439
Start proc com.rootsoft.mobilepayment for activity com.rootsoft.mobilepayment/.main: pid=20564 uid=10151 gids={3003, 1015}
Zygote: pid 20564 has INTERNET permission, then set capability for CAP_NET_RAW
GC_EXPLICIT freed 293 objects / 11080 bytes in 57ms
GC_EXPLICIT freed 52 objects / 2312 bytes in 156ms
GC_EXPLICIT freed 2 objects / 56 bytes in 53ms
Starting input on non-focused client com.android.internal.view.IInputMethodClient$Stub$Proxy@48025130 (uid=10151 pid=20564)
Client not active, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@47fb86f8
** Activity (main) Create, isFirst = true **
Mobile Payment Library has been initialized.
** Activity (main) Resume **
GC_FOR_MALLOC freed 8791 objects / 506336 bytes in 118ms
Timer 0x7->0x3|0x0
Ulight 7->3|0
Output standby called!!. Turn off PCM device.
ID[0]=0(0) Dn(0=>1)
Ulight 3->7|0
Dsptch > Window{4801a498 com.rootsoft.mobilepayment/com.rootsoft.mobilepayment.main paused=false}
Dsptch > Window{4801a498 com.rootsoft.mobilepayment/com.rootsoft.mobilepayment.main paused=false}
ID[0]=0(0) Up(1=>0)
Starting activity: Intent { cmp=com.rootsoft.mobilepayment/com.zooz.android.lib.CheckoutActivity (has extras) }
** Activity (main) Pause, UserClosed = false **
Displayed activity com.rootsoft.mobilepayment/.main: 5959 ms (total 5959 ms)
Start onCreate
WifiProgressStore Created
ALSA OPEN mode 0,device 2
Try to open ALSA PLAYBACK device AndroidPlayback_Speaker_normal
Initialized ALSA PLAYBACK device AndroidPlayback_Speaker_normal
Set PLAYBACK PCM format to S16_LE (Signed 16 bit Little Endian)
Using 2 channels for PLAYBACK.
Set PLAYBACK sample rate to 44100 HZ
Buffer size: 2048
Latency: 46439
Host: https://app.zooz.co
Start verify mandatory inputs.
Finish verify mandatory inputs.
Start onStart
GC_FOR_MALLOC freed 6399 objects / 359792 bytes in 31ms
GC_FOR_MALLOC freed 6131 objects / 346000 bytes in 29ms
Login failed.
Shutting down VM
threadid=1: thread exiting with uncaught exception (group=0x4001d7d0)
FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.rootsoft.mobilepayment/com.zooz.android.lib.CheckoutActivity}: java.lang.NullPointerException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
at android.app.ActivityThread.access$2300(ActivityThread.java:125)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4627)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at com.zooz.android.lib.b.a.t.a(Unknown Source)
at com.zooz.android.lib.CheckoutActivity.onStart(Unknown Source)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1129)
at android.app.Activity.performStart(Activity.java:3781)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2636)
... 11 more
Force finishing activity com.rootsoft.mobilepayment/.main
dumpmesg > /data/log/dumpstate_app_error.log
begin
Timer 0x7->0x3|0x0
Ulight 7->3|0
Output standby called!!. Turn off PCM device.
asec list
CommandListener::AsecCmd::runCommand -> anywheresoftware.b4a.samples.camera-1
done
Activity pause timeout for HistoryRecord{47f967e8 com.rootsoft.mobilepayment/com.zooz.android.lib.CheckoutActivity}
** Activity (main) Resume **
Launch timeout has expired, giving up wake lock!
Activity idle timeout for HistoryRecord{47f967e8 com.rootsoft.mobilepayment/com.zooz.android.lib.CheckoutActivity}
No longer want com.android.packageinstaller (pid 20390): hidden #16
ID[0]=0(0) Dn(0=>1)
Ulight 3->7|0
Dsptch > Window{48056470 Sorry! paused=false}
ID[0]=0(0) Up(1=>0)
Dsptch > Window{48056470 Sorry! paused=false}
Sending signal. PID: 20564 SIG: 9
Process com.rootsoft.mobilepayment (pid 20564) has died.
WIN DEATH: Window{4801a498 com.rootsoft.mobilepayment/com.rootsoft.mobilepayment.main paused=false}
Got RemoteException sending setActive(false) notification to pid 20390 uid 10081
ALSA OPEN mode 0,device 2
Try to open ALSA PLAYBACK device AndroidPlayback_Speaker_normal
Initialized ALSA PLAYBACK device AndroidPlayback_Speaker_normal
Set PLAYBACK PCM format to S16_LE (Signed 16 bit Little Endian)
Using 2 channels for PLAYBACK.
Set PLAYBACK sample rate to 44100 HZ
Buffer size: 2048
Latency: 46439
GC_EXPLICIT freed 2540 objects / 92880 bytes in 187ms
Timer 0x7->0x3|0x0
Ulight 7->3|0
Output standby called!!. Turn off PCM device.
Activity destroy timeout for HistoryRecord{47e42228 com.rootsoft.mobilepayment/.main}
Activity destroy timeout for HistoryRecord{47f967e8 com.rootsoft.mobilepayment/com.zooz.android.lib.CheckoutActivity}
GC_EXPLICIT freed 1880 objects / 118992 bytes in 192ms
GC_EXPLICIT freed 1221 objects / 85976 bytes in 191ms
 

canalrun

Well-Known Member
Licensed User
Longtime User
I'm not sure, but did you check both libraries in your library pane?

Tomas

Thanks for replying. I just looked again – yes, both libraries are checked. I am trying the sample application you included with the library. I use B4A version 1.7. I replaced the App ID with one I received when registering an app at ZooZ.

Any ideas?

Thanks,
Barry.
 

canalrun

Well-Known Member
Licensed User
Longtime User
You can see that the error happens inside the native zooz library from this stack trace:

Thank you. Good information.

I contacted ZooZ about the error, and of course they pointed the finger back at the B4A interface library :confused:

Is it possible to interface with the ZooZ jar files directly-bypassing, for now, the B4A mobile payments library?

Maybe with the reflection library or by writing my own simple interface library. There is a "callback" function in the ZooZ library to report success or fail which I don't know how to handle, otherwise it looks fairly straightforward.

I will send your comment to ZooZ. They are being very cooperative and have promised to look into this a little further.

Thanks,
Barry.
 

bluedude

Well-Known Member
Licensed User
Longtime User
I'm not experiencing problems, for me it still works. Just waiting for removal of 5 digits zipcode and multi-language support.

Cheers,
 

canalrun

Well-Known Member
Licensed User
Longtime User
I'm not experiencing problems, for me it still works. Just waiting for removal of 5 digits zipcode and multi-language support.

Cheers,

Thanks for the reply. This prompted me to do a little more testing. I am using the sample application that comes with the MobilePaymentsLibrary.

Since it works for you, I'm thinking it may be a localization type problem or configuration problem.

I am located in the USA - maybe there is a "date format" problem. I see there are no dates involved in the interface and the number format does not include a thousands or decimal separator ... Probably not the problem.

The second thing that came to mind is my network connection. My connection is Wi-Fi. I don't have a cellular data connection – just voice (for example 3G). Placing breakpoints in the code, I can confirm the error occurs during the call to Payment.Checkout. It does not invoke either the Payment_Success or Payment_Error subroutines.

I have tried to run the sample application on both my Samsung Vibrant and Acer A500. they both give the same error:

"The application MobilePayment (process com.rootsoft.mobilepayment) has stopped unexpectedly. Please try again."

Thanks,
Barry.
 

Sharon

Member
Licensed User
Longtime User
Hello Barry,
I am Sharon from the ZooZ team. I would like to assist you with your current issue.
Please notice that upon registration to ZooZ, you are prompted to enter an "App Bundle ID". The bundle ID is basically your project's package name. This ID uniquely identifies you in our system, and is directly connected with the app key you get after entering it.
The sample that is provided by B4A is listed under the package name of "com.rootsoft.mobilepayment". This package name is, of course, not unique.
To get the sample up and running you should change the package name (Under Project->Package Name) to the one you provided upon registration on our website (You can see your bundle ID under "My Apps" section)
After changing the project name, please make sure to also change it in the AndroidManifest.xml, plus your sample's folder hierarchy to match.
Use your app key and launch the application. If you're experiencing any issues with resources, please add them from the .jar file as mentioned above.
As for the issue with PayPal, we are working hard to have it up and running as soon as possible.

If you have any questions, please don't hesitate to contact us.

Good luck,

Sharon
ZooZ Mobile Developer
 

rmorecki1

Member
Licensed User
Longtime User
New ZooZ SDK

Please note that for working with sandbox you must update your zooz sdk library
(version 1.2)
ZooZ Updated a new version in their portal,
And since its a cleaner sandbox it requires the new SDK version
 

bluedude

Well-Known Member
Licensed User
Longtime User
How to update to the new zooz version

Tomas,

What do we need to do to get the new SDK working?

Not sure if your library is just a wrapper? The original zooz SDK is called zooz_iap.jar but you don't use that name?

Cheers,
 

XverhelstX

Well-Known Member
Licensed User
Longtime User
I haven't tested it yet, but try the following:

1. Download the new sdk.

2. Rename it to MPLZooz.jar

3. Remove MPLZooz.jar from your additional library folder.

4. copy the new MPLZooz.jar to your additional library folder

5. refresh the library pane.

Tomas
 

canalrun

Well-Known Member
Licensed User
Longtime User
Hello Barry,
I am Sharon from the ZooZ team. I would like to assist you with your current issue.
.....
If you have any questions, please don't hesitate to contact us.
Good luck,
Sharon
ZooZ Mobile Developer

Thanks. Will try.

Barry.


Added Later:

I installed the library update – see the RootSoft post below.

I created a new B4A project, registered at Zooz, then copied the source code from the mobile payments sample to my project.

It worked! I got to the mobile payments page. Unfortunately, I now have the problem of not having the graphics show up. I remember this was mentioned earlier in this thread. Has anyone found a solution to this? – I think I read about expanding the jar file earlier.

Thanks,
Barry.
 
Last edited:

canalrun

Well-Known Member
Licensed User
Longtime User
You should unzip the jar files and copy all the folders under 'res' folder to your project 'Objects\res' folder. You also need to mark all files as read-only files.

Thanks. I found this info also while searching earlier posts in this thread.

I think I spoke too soon about the Zooz library working. While in the Zooz portion of the payment gateway, I consistently get a crash and a "force close". The logs report that the error occurs in the Zooz library.

I will write to Zooz again. I really think they have a fantastic and much needed concept for payments.

Thanks,
Barry.
 

bluedude

Well-Known Member
Licensed User
Longtime User
Hi,

I updated the library and it works on a Galaxy Nexus. Will also test it on an old Nexus One.
 

bluedude

Well-Known Member
Licensed User
Longtime User
Now also tested it on a Nexus One and got a transaction ID back, all seems to work fine.

Now waiting for multi-language support.
 
Top