Skip to content

Commit

Permalink
Merge pull request #10 from Maviza101/patch-1
Browse files Browse the repository at this point in the history
Improved the content and grammar of README.md.
  • Loading branch information
ibrahimlawal authored Feb 18, 2017
2 parents e92e199 + d476c8c commit 5e7a6f9
Showing 1 changed file with 26 additions and 26 deletions.
52 changes: 26 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## Paystack Android

This is a library for easy integration of [Paystack](https://paystack.com) with your Android application. Use this
library in your android app so we shoulder the burden of PCI compliance by helping you
library in your Android app so we shoulder the burden of PCI compliance by helping you
avoid the need to send card data directly to your server. Instead, this library sends credit
card data directly to our servers.

Expand Down Expand Up @@ -42,7 +42,7 @@ To prepare for use, you must ensure that your app has internet permissions by ma

### 1. initializeSdk

To use the Paysack android sdk, you need to first initialize the sdk using the PaystackSdk class.
To use the Paystack Android SDK, you need to first initialize it using the `PaystackSdk` class.

```java
class Application{
Expand All @@ -55,11 +55,11 @@ class Application{
}
```

Make sure to call this method in the onCreate method of your Fragment or Activity.
Make sure to call this method in the `onCreate` method of your Fragment or Activity.

### 2. setPublicKey

Before you can charge a card with the PaystackSdk, you need to set your public key. The library provides two approaches,
Before you can charge a card with the `PaystackSdk` class, you need to set your public key. The library provides two approaches,

#### a. Add the following lines to the `<application></application>` tag of your AndroidManifest.xml

Expand All @@ -72,7 +72,7 @@ Before you can charge a card with the PaystackSdk, you need to set your public k
#### b. Set the public key by code

```java
class Bootstrap{
class Bootstrap {
public static void setPaystackKey(String publicKey) {
PaystackSdk.setPublicKey(publicKey);
}
Expand All @@ -82,43 +82,43 @@ class Bootstrap{
### 3. chargeCard
Charging with the PaystackSdk is quite straightforward.
```java
class chargingActivity{
class chargingActivity {
public void performCharge(){
//create a charge
// Create a charge.
Charge charge = new Charge();
//Add card to the charge
// Add card to the charge.
charge.setCard(new Card.Builder(cardNumber, expiryMonth, expiryYear, cvc).build());
//add an email for customer
// Add an email for customer
charge.setEmail(email);
// add amount to charge
// setAmount accepts the kobo value
// Add amount to charge.
// setAmount() accepts the kobo value
// which is: the naira value multiplied by 100.
charge.setAmount(amount);
// Remember to use a unique reference from your server each time.
// You may decide not to set a reference, we will provide a value
// in that case
// If you decide not to set a reference, we will provide a value
// in that case.
// charge.setReference("7073397683");

// OUR SDK is Split Payments Aware
// You may also set a subaccount, transaction_charge and bearer
// Remember that only when a subaccount is provided will the rest be used
// Our SDK is Split Payments Aware.
// You may also set a subaccount, transaction_charge and bearer.
// Remember that only when a subaccount is provided will the rest be used.
// charge.setSubaccount("ACCT_azbwwp4s9jidin0iq")
// .setBearer(Charge.Bearer.subaccount)
// .setTransactionCharge(18);
//charge card
// Charge card
PaystackSdk.chargeCard(activity, charge, new Paystack.TransactionCallback() {
@Override
public void onSuccess(Transaction transaction) {
// This is called only after transaction is deemed successful
// retrieve the transaction, and send its reference to your server
// This is called only after transaction is deemed successful.
// Retrieve the transaction, and send its reference to your server
// for verification.
}

@Override
public void beforeValidate(Transaction transaction) {
// This is called only before requesting OTP
// This is called only before requesting OTP.
// Save reference so you may send to server. If
// error occurs with OTP, you should still verify on server
// error occurs with OTP, you should still verify on server.
}

@Override
Expand All @@ -130,13 +130,13 @@ class chargingActivity{
}
}
```
The first argument to the PaystackSdk.chargeCard is the calling activity object. Always
give an activity that will stay open till the end of the transaction. The currently
open activity is just fine.
The first argument to the PaystackSdk.chargeCard is the calling Activity object. Always
give an Activity that will stay open till the end of the transaction. The currently
open Activity is just fine.

### 4. Verifying the transaction
Send the reference to your server and verify by calling our REST API. An authorization will be returned which
will allow you know if its code is reusable. You can learn more about our verify call [here](https://developers.paystack.co/docs/verifying-transactions).
will let you know if its code is reusable. You can learn more about our verify call [here](https://developers.paystack.co/docs/verifying-transactions).

### 5. Charging Returning Customers
See details for charging returning customers [here](https://developers.paystack.co/docs/charging-returning-customers).
Expand All @@ -148,7 +148,7 @@ The library provides validation methods to validate the fields of the card.
This method helps to perform a check if the card number is valid.

#### card.validCVC
Method that checks if the card security code is valid
Method that checks if the card security code is valid.

#### card.validExpiryDate
Method checks if the expiry date (combination of year and month) is valid.
Expand Down

0 comments on commit 5e7a6f9

Please sign in to comment.