Android Code Snippet [B4X] Online Payment with PayPal

Hi all.
In Attached an example on how to use paypal for online payment in a simple way for B4X ( B4A - B4i - B4j )
In the example it is possible to enter any active paypal account, so you can also make payments on different paypal accounts.
For each transaction, it will return if the transaction was successful or failed.
If you improve the same, upload and share the same pls.

Have a nice day
Marco


 

Attachments

  • PayPalApp2019Community.zip
    33.8 KB · Views: 1,010
Last edited:

AKJammer

Member
Licensed User
How has this worked out? I'm looking to add a module into my B4J application that will accept credit card payments for event and contest registrations. We currently use both Paypal and Square on the side of my application but want to integrate something into the application itself.
 

MarcoRome

Expert
Licensed User
Longtime User
How has this worked out? I'm looking to add a module into my B4J application that will accept credit card payments for event and contest registrations. We currently use both Paypal and Square on the side of my application but want to integrate something into the application itself.

Try it yourself
 

AKJammer

Member
Licensed User
Yes, I did. Just wondering how it worked in practice. A quick question if you could answer. If I connected a credit card chip reader via USB (using B4J in Windows), does Paypal have an API that would allow the credit card information to be filled in from the application? I'm trying to find a way to just put the credit card in, hit a button and get a success or failure that it worked or not. All the users information is known and can be sent but I don't need to see web interaction with paypal site.
Thanks,
Jim
 

MarcoRome

Expert
Licensed User
Longtime User
Yes, I did. Just wondering how it worked in practice. A quick question if you could answer. If I connected a credit card chip reader via USB (using B4J in Windows), does Paypal have an API that would allow the credit card information to be filled in from the application? I'm trying to find a way to just put the credit card in, hit a button and get a success or failure that it worked or not. All the users information is known and can be sent but I don't need to see web interaction with paypal site.
Thanks,
Jim
 

Beja

Expert
Licensed User
Longtime User
Hi all.
In Attached an example on how to use paypal for online payment in a simple way for B4X ( B4A - B4i - B4j )
In the example it is possible to enter any active paypal account, so you can also make payments on different paypal accounts.
For each transaction, it will return if the transaction was successful or failed.
If you improve the same, upload and share the same pls.

Have a nice day
Marco

Hi Marcorome,
A late question:
the URL https://paypal.ME/myNameOrMyCompanyname will allow my customer to pay me either with PayPal or with any credit card through PayPal options. Using this library will PayPal give them the option to pay as guest by any credit card?

Thank you -b
 

S.M.R

Member
not work!!!

see attach
 

Attachments

  • pp.PNG
    pp.PNG
    38.6 KB · Views: 103

MarcoRome

Expert
Licensed User
Longtime User
Before saying it "not work!!!", you have to read carefully.
You find in the activity_create the following code and comments:

B4X:
Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    Activity.LoadLayout("lay_payment")

    ProgressDialogShow2("Wait connect PayPal...", False)
    'parametri_pagamento("youremail@paypalaccount", Starter.descrizione_acquisto ,"1", Starter.prezzo_acquisto, "EUR", "First Name User","Last Name User","Address User", "Zip User", "City User", "email user","phone user ", "city/region/State user")
    '*******
    'IMPORTANT: CHANGE youremail@paypalaccount with email valid paypal account
    parametri_pagamento("youremail@paypalaccount", Starter.descrizione_acquisto ,1, Starter.prezzo_acquisto, "EUR", "Franco","Rossi","Via Mazzini n.32", "00100", "Rome", "example@gmail.com","+39334445566", "Rome")

End Sub

What do you see ???

'IMPORTANT: CHANGE youremail@paypalaccount with email valid paypal account

If you don't enter a valid paypal account you will always have that message.
 

S.M.R

Member
Before saying it "not work!!!", you have to read carefully.
You find in the activity_create the following code and comments:

B4X:
Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    Activity.LoadLayout("lay_payment")

    ProgressDialogShow2("Wait connect PayPal...", False)
    'parametri_pagamento("youremail@paypalaccount", Starter.descrizione_acquisto ,"1", Starter.prezzo_acquisto, "EUR", "First Name User","Last Name User","Address User", "Zip User", "City User", "email user","phone user ", "city/region/State user")
    '*******
    'IMPORTANT: CHANGE youremail@paypalaccount with email valid paypal account
    parametri_pagamento("youremail@paypalaccount", Starter.descrizione_acquisto ,1, Starter.prezzo_acquisto, "EUR", "Franco","Rossi","Via Mazzini n.32", "00100", "Rome", "example@gmail.com","+39334445566", "Rome")

End Sub

What do you see ???



If you don't enter a valid paypal account you will always have that message.
yes you right
sorry


this url just pay with paypal login if i want pay with credit card how can i do?

like picture in attach!!

thanks
 

Attachments

  • pp.PNG
    pp.PNG
    58.3 KB · Views: 90

MarcoRome

Expert
Licensed User
Longtime User
In your sample, this button will not be displayed when the PayPal payment page is loaded !!

I posted this picture so you can understand my question

Why did you put the picture for me again !!

I thought it was a question.
 
Top