PayTabs Android SDK Integration

Today mobile payments are being adopted all over the world in many different ways .If we’re building a mobile app for business, we’ll have to somehow accept payments in our application. For payment process various mobile payment gateways are generally being used. Now, there are a large number of payment gateways available in the market which can allow you to process credit card transaction data through their APIs. Paytab is one of the widely used payment gateway .

PayTabs providing the most secure, reliable and user-friendly payment process it is used in many businesses for the payment purpose. We can easily implement it in mobile application by using the Paytab android SDK provided by  the Paytab . There are some simple step which we need to follow for integration –

Integration Step

1.Download the PayTabs android SDK
http://developers.paytabs.com/docs-apis/#android-sdk In this link you can find the android SDk and documentation for the same.

2.Add paytab SDK in your project as a module and add the Module dependency in your project. Extract the PayTabs Android SDK.zip and add the Paytabs_SDK.aar file to your project as a new module.For adding the dependency follow the step-
. Right click on your App and choose Open Module Settings.
. Go to Dependency and click on Module Dependency
. Choose the :PayTabs_SDK module to be included

3.Also add this  dependency inside the build.gradle file-
compile ‘io.card:android-sdk:5.3.0’ .

Now we will launch the PayTabActivity activity from our payment activity,  we do not need to declare PayTabActivity  it already  declared in PayTab SDk .We have to pass some data through intent which is required for the payment . There are lots of data which we need to send inPayTabActivity some of them are required and some are optional .

Here is the list of required data –

Require Field

pt_merchant_email – Merchant email that you use to sign up and/or login into PayTabs Merchant Dashboard

pt_secret_key   –  SECRET Key generated by merchant dashboard this can be found by logging in to your Merchant Dashboard > Mobile Payments > Secret Key

pt_transaction_title – This is the customer name that will be displayed in the To field in your transaction details
pt_amount – The amount of the transaction
pt_currency_code – Currency of the amount stated.3 character ISO currency code
pt_shared_prefs_name – Provide the name of the shared folder between your App and PayTabs SDK
pt_customer_email – – Email of the customer
pt_customer_phone_number – Phone Number of the Customer
pt_order_id – The order id from your App to be able to map your order’s to PayTabs transactions
pt_product_name – Comma separated product names involved in the transactions
// Add customer Billing address Details //
pt_address_billing
pt_city_billing
pt_country_billing

pt_postal_code_billing – Billing Postal code provided by the customer. In case the country doesn’t have a valid postal code, you can pass the country international dialing code (00973)

// Add customer Shipping address Details //
pt_address_shipping
pt_city_shipping
pt_state_shipping
pt_country_shipping

pt_postal_code_shipping – Shipping Postal code provided by the customer. In case the country doesn’t have a valid postal code, you can pass the country international dialing code (00973)

Except these data the other are not required it is upto you that you want to send it or not.

For your reference i have added some code to pass the data in PayTabActivity .

SDK returns two values in the response

PayTabs Transaction ID (pt_transaction_id)
PayTabs Response Code (pt_response_code)

In the case of successful payment response code is 100 and if we are getting any other response code it means that the transaction has been rejected or payment is unsuccessful.

The Complete list of response codes and their description can be found in Merchant Dashboard > Help > Reason Codes.

To handle the response from SDK  we you need to override Activity’s onActivityResult and  Inside the onActivityResult function add the following code-

For test the payment gatwatway –

PayTabs does not provide an explicit Sandbox / Testing environment. we can test all the functionalities by using a demo account . In the paytab website  we can easily create a demo account and test the application in TEST Environment . Once you have completed the testing you will need to activate your LIVE MERCHANT ACCOUNT by clicking on GO LIVE through your PayTabs Merchant Account.  If you activate your account as LIVE MERCHANT ACCOUNT you can not be able to put it as TEST ACCOUNT  for this you need to contact with the support team of Paytab .

the link of paytab website for creating account is mentioned below –

https://www.paytabs.com/login

To test your payment process, you can typically use any valid credit card number or you can use the ones listed below.

you can also refer  their integration guide – https://www.paytabs.com/PayTabs_Android_SDK_V2.1.pdf

Thanks for reading .

. . .

Comment

Add Your Comment

Be the first to comment.

css.php
Hire Us!
Brief us about your requirements and we'll get back to you.
Woo! Hooy!
We have just recieved your project brief and our expert will contact you shortly.
Send Again
Close