I am working in android. I am designing a program to download a file from my http server. before download the file payment should开发者_StackOverflow社区 be done.
this is my first layout:-
when i click on on paypal button this paypal site is opened:-
so i want to know that after make payment is this site return something on the basis of that i can allow or donot allow user to download.
i want to know that user has paid something or not ? please help me in this paypal concept in android.
Thank you in advance...
I have done this by taking help from a from a book.
This is the code which is used to the solution for my question:-
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
switch(resultCode) {
case Activity.RESULT_OK:
//The payment succeeded
Toast.makeText(this,"Payment has done successfully",Toast.LENGTH_SHORT).show();
//Tell the user their payment succeeded
break;
case Activity.RESULT_CANCELED:
Toast.makeText(this,"Payment has cancled",Toast.LENGTH_SHORT).show();
break;
case PayPalActivity.RESULT_FAILURE:
flag=false;
Toast.makeText(this,"Sorry Payment failed",Toast.LENGTH_SHORT).show();
}
精彩评论