B4A Library [B4X] Class Library PayPal CreditCard

MarcoRome

Expert
Licensed User
Hi all.

PayPalCreditCard
Author: Devil-App
Version: 1.03
    • ReturnTransactionCard
      Fields:
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • currency As String
      • decription As String
      • id As String
      • sale_id As String
      • sale_state As String
      • state As String
      • total As String
      Methods:
      • Initialize
        Initializes the fields to their default value.
    • paypalpay
      Methods:
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • Initialize (environments As String, client_id_app As String, secret_app As String) As String
        You have 3 Parameters:
        environment ---> value: "sandbox" for testing - "live" for production
        client_id_app ---> value: CLIENT ID that you see in your Dashboard (https://developer.paypal.com/)
        secret_app = ---> value: SECRET that you see in your Dashboard (https://developer.paypal.com/)

        Example:
        Dim environment, client_id_app, secret_app as String

        environment = "sandbox"
        client_id_app = "xxxx"
        secret_app = "yyyyy"

        Dim test As paypalpay
        test.Initialize( environment, client_id_app, secret_app )
        ....
        End Sub
      • PayCreditCards(type_credit_card As String, number_card As String, expire_month As String, expire_year As String, ccv As String, first_name As String, last_name As String, address As String, city As String, state As String, postal_code As String, country_code As String, total As String, currency As String, description As String, messagewait As String, Module As Object, EventName As String) As String
        To Pay Directly by Credit Card:
        Example:
        Sub Activity_Create(FirstTime As Boolean)
        Dim type_credit_card, number_card, expire_month, expire_year, ccv, first_name, last_name, address As String
        Dim city, state, postal_code, country_code, total, currency, description, waitmessage as String


        type_credit_card = "visa" ---> value: "visa", "mastercard", "amex", "discover"
        number_card = "4417119669820331"
        expire_month = "11"
        expire_year = "2018"
        ccv = "874"
        first_name = "Betsy"
        last_name = "Buyer"
        address = "111 First Street"
        city = "Saratoga"
        state = "CA"
        postal_code = "95070"
        country_code = "US"
        total = "13.30"
        currency = "USD" ---> https://developer.paypal.com/docs/integration/direct/rest_api_payment_country_currency_support/
        description = "This is the payment transaction description."
        waitmessage = "Wait Transaction in Progress...."

        test.PayCreditCards( type_credit_card, number_card, expire_month, expire_year, ccv, first_name, _
        last_name, address, city, state, postal_code, country_code, total, currency, description, _
        waitmessage, Me, "check_transaction")
        End Sub

        Sub check_transaction( ReturnValueCard As ReturnTransactionCard)
        LogColor(ReturnValueCard.sale_state, Colors.Blue)
        If ReturnValueCard.sale_state = "completed" Then
        LogColor(ReturnValueCard.id, Colors.Red)
        LogColor(ReturnValueCard.state, Colors.Red)
        LogColor(ReturnValueCard.sale_state, Colors.Red)
        LogColor(ReturnValueCard.currency, Colors.Red)
        LogColor(ReturnValueCard.decription, Colors.Red)
        LogColor(ReturnValueCard.total, Colors.Red)
        End If
        End Sub
        ******
Screenshot 2015-09-25 07.24.05.png

B4X:
Sub Activity_Create(FirstTime As Boolean)
Dim environment, client_id_app, secret_app As String

Dim type_credit_card, number_card, expire_month, expire_year, ccv, first_name, last_name, address As String, _
city, state, postal_code, country_code, total, currency, description, waitmessage As String

'***Initialize PayPalCreditCard Library
environment = "sandbox"
client_id_app = "xxxx"
secret_app = "xxxxx"

Dim PayTransaction As paypalpay
PayTransaction.Initialize(environment, client_id_app, secret_app)



'***Credit Card Payments
type_credit_card = "visa" ' --> value: "visa", "mastercard", "amex", "discover"
number_card = "4417119669820331"
expire_month = "11"
expire_year = "2018"
ccv = "874"
first_name = "Betsy"
last_name = "Buyer"
address = "111 First Street"
city = "Saratoga"
state = "CA"
postal_code = "95070"
country_code = "US"
total = "18.00"
currency = "USD"
description ="This is the payment transaction description."
waitmessage = "Wait Transaction in Progress...."

PayTransaction.PayCreditCards(type_credit_card, number_card, expire_month, expire_year, ccv, first_name, _
last_name, address, city, state, postal_code, country_code, total, currency, description, _
waitmessage, Me, "check_transaction")
End Sub

Sub check_transaction( ReturnValueCard As ReturnTransactionCard)

LogColor(ReturnValueCard.sale_state, Colors.Blue)
If ReturnValueCard.sale_state = "completed" Then
    LogColor(ReturnValueCard.id, Colors.Red)
    LogColor(ReturnValueCard.state, Colors.Red)
    LogColor(ReturnValueCard.sale_state, Colors.Red)
    LogColor(ReturnValueCard.currency, Colors.Red)
    LogColor(ReturnValueCard.decription, Colors.Red)
    LogColor(ReturnValueCard.total, Colors.Red)
End If
End Sub


Only US, UK, Canada and Australia countries merchant can apply direct credit card payment
The library IS free.
You'll get a zip file containing:
1.Documentation configuration environment Paypal ( HERE )
2.Class in attachment ( dont forget compile with ultimate Rel HttpJob + Httutils2Service )
3.Example B4A in attachment

To send the money, just click on the Donate button below.


 

Attachments

Last edited:

susu

Well-Known Member
Licensed User
Could you please explain more about the configuration? What is client_id_app, secret_app? How can I get it? Thanks.
 

MarcoRome

Expert
Licensed User
Could you please explain more about the configuration? What is client_id_app, secret_app? How can I get it? Thanks.
Look this pic.
Work more or less as PlayStore :D. You have panel with your app ( product as software, phone, anythings you want to sell ) for any app you have one panel and inside this panel you have client_id_app ( Client ID ) end secret_app ( Secret ).
To the right you can try this in Sanbox( for try ) and Live ( really you can buy ). Dont change nothing, but, of course in Sandbox only you can try.
To the left you have your Panel with Apps, Notification, Transactions ( you see this also in movie ) etc.
This information you have already in Library ( when i send library, you have demo b4a, documentation where that explains all the steps for starting )
For any information you look HERE


Screenshot 2015-09-24 06.34.22.png
 

susu

Well-Known Member
Licensed User
Does your lib accept Paypal donation from users?
 

MarcoRome

Expert
Licensed User
Does your lib accept Paypal donation from users?
Hi Su. For now no, but who makes the donation will have all the future releases of course. And i'm already working to have a version that gets the maximum possible, as payment by credit cards, direct paypal, and set Tax so no problem ;) etc.
Cheers :)
 
Last edited:

PABLO2013

Active Member
Licensed User
1 The first mistake was on the manifest


Manifiest:

SetApplicationAttribute(android:theme, "@android:style/Theme.Holo").... error

<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="14"/> ....solution


2 The second error is that without the library httm2 gives me the following error

1(2).png


3 Create an account paypal developers ... and put my id and the id in your sample, as seen in the video and leave the rest as No. visa card ... ... 18.0 ... etc .. .., but send the log ... not if this run the BA4 5.50, 24 sdk , android device 4.2 huawei

2(2).png

4. Funds sent paypal developments are visible in current accounts paypal ... I tell you because this would be very useful for me because in my country can only be downloaded admissions funds coming from paypay .... and this would avoid the problem of having the funds in google wallet and not be able to withdraw only online payments
 

Attachments

azzam223

Active Member
Licensed User
java.lang.NoSuchMethodError: No static method onStartCommand(Lanywheresoftware/b4a/BA;)Z in class Lanywheresoftware/b4a/objects/ServiceHelper$StarterHelper; or its super classes (declaration of 'anywheresoftware.b4a.objects.ServiceHelper$StarterHelper' appears in /data/app/Lamha.mole-hhnKr1O911e5vcT82yg81g==/base.apk)
at devil.app.paypalcreditcard.httputils2service.onStartCommand(httputils2service.java:69)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3539)
at android.app.ActivityThread.-wrap20(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1698)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
** Service (httputils2service) Create **
java.lang.NoSuchMethodError: No static method onStartCommand(Lanywheresoftware/b4a/BA;)Z in class Lanywheresoftware/b4a/objects/ServiceHelper$StarterHelper; or its super classes (declaration of 'anywheresoftware.b4a.objects.ServiceHelper$StarterHelper' appears in /data/app/Lamha.mole-hhnKr1O911e5vcT82yg81g==/base.apk)
at devil.app.paypalcreditcard.httputils2service.onStartCommand(httputils2service.java:69)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3539)
at android.app.ActivityThread.-wrap20(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1698)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
 
Top