Performing a Payment

James Goodwin edited this page Mar 12, 2017 · 20 revisions

Check that you have initialized the SDK before attempting to make a payment.

1. Show the payment form

Create an Intent for the PaymentActivity with the Judo instance:

Intent intent = new Intent(this, PaymentActivity.class);
intent.putExtra(Judo.JUDO_OPTIONS, judo);

startActivityForResult(intent, Judo.PAYMENT_REQUEST);
2. Check the payment result

In your Activity override the onActivityResult method to receive the payment receipt:

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if(requestCode == Judo.PAYMENT_REQUEST) {
        switch (resultCode) {
            case Judo.RESULT_SUCCESS:
                Receipt receipt = data.getParcelableExtra(Judo.JUDO_RECEIPT);
                // success
        }
    }
}
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.