B4J Question Registering device from B4A/B4i with payment

aaronk

Well-Known Member
Licensed User
Longtime User
Hi,

Not sure if anyone has ever done anything like this before or has any suggestions on how I can do this using B4J.. (the following is just an example but of cause I am no car insurance company but just using it as an example to make it easier to understand on what I am trying to do)

First think of a car insurance, every year your car insurance is up for renewal. You can pay either monthly or an annual fee.

They then ask for your car details and then you have the option to register your car to them after getting a quote.

Using a B4A/B4i App I want to be able to charge this monthly fee or annual fee and register the car to my B4J app.

The only way I can see doing this is using an in-app purchase within B4A/B4i and then when the in-app purchase has been accepted then send a message from my B4A/B4i app to my B4J app and register that car.

Problem is, if someone works out what message to send to my B4J app then they can register anything without actually triggering the payment in the app.

It would be good if somehow if B4J can connect to Google/Apple to check if this payment is real. It would then solve the above issue.

The only other thing I can think of is have a web site and getting the user to login with the web browser and using PayPal, somehow trigger something in my B4J app once the payment has been made in the web browser.

I rather use my B4A/B4i app as the front end, rather than getting the user to open a web browser on there PC etc. just to register.

Would using an in-app purchase in the app be the way to do this or has anyone else done it in a different way ?

Hope the above makes sense on what I am trying to do.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
The only other thing I can think of is have a web site and getting the user to login with the web browser and using PayPal, somehow trigger something in my B4J app once the payment has been made in the web browser.
This is actually quite simple to implement. PayPal (or any other payment processor) will call your server after each order. This is sometimes called IPN.

You can also use this REST API to verify orders: https://developer.android.com/google/play/developer-api.html#subscriptions_api_overview
 
Upvote 0

aaronk

Well-Known Member
Licensed User
Longtime User
This is actually quite simple to implement.
Like the sound of that.

PayPal (or any other payment processor) will call your server after each order. This is sometimes called IPN.
This sounds like the way to go. I am guessing this is what the b4x site does when the user purchases the IDE, it then sends a message to your server to email the customer the link to the software etc.

Is there any B4A, B4i and B4J PayPal library? I did have a look but couldn't find any that works with all three platforms ? (I was hoping to do it native in the app rather than going to a site to pay)
 
Upvote 0

aaronk

Well-Known Member
Licensed User
Longtime User
If I remember correctly Google Play and App Store do not approve the usage of third party payment processors for digital goods. Make sure to check it.
Just had a quick look and sounds like you can't use a 3rd Party payment methods or the app might (will) get rejected.

I now have 2 options.
1. Create a site where the user signs up online using a computer and pays etc. then tell the user to go back to the app to use it once the payment has gone through.
2. Use the in-app payment method and take the risk no one works out how to send the message to my server to bypass the payment stage. I then will need to work out how to use the REST API to check if the payment has gone through etc. (not sure if Apple has a similar API but will need to look into it)

If anyone has used the REST API to check if the payment was successful then let me know. Would be good to see/learn how you are using it.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…