B4A Library [B4X] Class Library PayPal CreditCard

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

  • PayPalCreditCard-B4A-Example.zip
    9 KB · Views: 447
  • Lib-PayPal-Library103.zip
    15.4 KB · Views: 482
Last edited:

MarcoRome

Expert
Licensed User
Longtime User
Hi dear Don. Me too Think this. now that i come back, releasing the class. so that everyone can improve it.
 

AKJammer

Active Member
Licensed User
Marco, Sorry if this is obvious to everyone else, buy I'm a bit of a newb. Does this library work with B4J? If it does, are you taking donations for the library or are you charging for it?
Thanks,
Jim
 
Top