Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Payment transaction issue #67

Closed
gagan50 opened this issue Jan 30, 2019 · 14 comments
Closed

Payment transaction issue #67

gagan50 opened this issue Jan 30, 2019 · 14 comments

Comments

@gagan50
Copy link

gagan50 commented Jan 30, 2019

    String cardNumber = "5060 6666 6666 6666 666";
    int expiryMonth = 10; //any month in the future
    int expiryYear = 22; // any year in the future. '2018' would work also!
    String cvv = "123";  // cvv of the test card

Error! Please try again

@Ikhiloya
Copy link
Contributor

What exactly is the error? Could you share your logs

@gagan50
Copy link
Author

gagan50 commented Jan 30, 2019

yes it show only

Error! Please try again

@Ikhiloya
Copy link
Contributor

I guess you're using android studio for your build. What library are you using for network calls?

@gagan50
Copy link
Author

gagan50 commented Jan 30, 2019

network calls mean?

@gagan50
Copy link
Author

gagan50 commented Jan 30, 2019

compile 'co.paystack.android:paystack:3.0.10'

@Ikhiloya
Copy link
Contributor

Like Http Requests

@gagan50
Copy link
Author

gagan50 commented Jan 30, 2019

    String cardNumber = "5060 6666 6666 6666 666";
    int expiryMonth = 10; //any month in the future
    int expiryYear = 22; // any year in the future. '2018' would work also!
    String cvv = "123";  // cvv of the test card

    card = new Card(cardNumber, expiryMonth, expiryYear, cvv);
    if (card.isValid()) {
        performCharge();
        // charge card
    } else {
        //do something
    }

public void performCharge() {
//create a Charge object
Charge charge = new Charge();
charge.setCard(card); //sets the card to charge
charge.setAmount(10);
charge.setReference("ChargedFromAndroid_" + Calendar.getInstance().getTimeInMillis());
charge.setEmail("gagan@mailinator.com");
PaystackSdk.chargeCard(LoginActivity.this, charge, new Paystack.TransactionCallback() {
@OverRide
public void onSuccess(Transaction transaction) {
Alerts.showLog("transactions", ">>>>" + transaction.toString());
// 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) {
            Alerts.showLog("transactions", ">beforeValidate>>>" + transaction.toString());

            // 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.
        }

        @Override
        public void onError(Throwable error, Transaction transaction) {
            //handle error here
            Alerts.showLog("transactions", ">error>>>" + error.getMessage());

        }

    });
}

that my code i have implemented

@gagan50
Copy link
Author

gagan50 commented Jan 30, 2019

on transaction sucess how i can get detail of transaction

@Ikhiloya
Copy link
Contributor

You can get it from the Transaction object onSuccess

@gagan50
Copy link
Author

gagan50 commented Jan 30, 2019

can i get transaction id? or anything else

@Ikhiloya
Copy link
Contributor

The Transaction object contains some fields. Check the Transaction object. You'd get a transaction reference

@gagan50
Copy link
Author

gagan50 commented Jan 30, 2019

thanks i got it

@Ikhiloya
Copy link
Contributor

You're welcome
!

@Ikhiloya
Copy link
Contributor

please close this issue @ibrahimlawal

@gagan50 gagan50 closed this as completed Jan 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants