I'm from Nepal and we have esewa as online payment. I'm trying to implement this method for my app. They have a very great tutorial and also an sample project to help developers implementing this on their project.
The code is as below
Button buttonBuy = (Button) findViewById(R.id.button_buy);
buttonBuy.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
ESewaPayment eSewaPayment = new ESewaPayment(“<Product Price>”,
“<Product Name>”, “<productId>”,”<call_back_url>”);
Intent intent = new Intent(SampleActivity.this, ESewaPaymentActivity.class);
intent.putExtra(ESewaConfiguration.ESEWA_CONFIGURATION, eSewaConfiguration);
intent.putExtra(ESewaPayment.ESEWA_PAYMENT, eSewaPayment);
startActivityForResult(intent, REQUEST_CODE_PAYMENT);
}
});
where each term is described as
+----------------+-------------------------------------------------------------------------------------------------------------+
| **Parameter Name | Description** |
+----------------+-------------------------------------------------------------------------------------------------------------+
| Client | Client Id of the client/merchant |
+----------------+-------------------------------------------------------------------------------------------------------------+
| Secret Key | Secret key of the client/merchant |
+----------------+-------------------------------------------------------------------------------------------------------------+
| Environment | Environment integrating for i.e. LIVE (live) or DEVELOPMENT (test) |
+----------------+-------------------------------------------------------------------------------------------------------------+
| Product Price | Price of Product or Service |
+----------------+-------------------------------------------------------------------------------------------------------------+
| Product Name | Name of Product or Service |
+----------------+-------------------------------------------------------------------------------------------------------------+
| ProductId | Set a unique Id for your particular product or services |
+----------------+-------------------------------------------------------------------------------------------------------------+
| Callback-url | API exposed at merchant/client`server where eSewa sends a copy of proof of payment after successful payment |
+----------------+-------------------------------------------------------------------------------------------------------------+
where further Callback url is described as
Callback-url is an API exposed at merchant/client's server at which eSewa sends a copy of proof of payment after successful payment; the client/merchant must send a callback-url while initiating the payment through SDK. The sent callback-url is later used by eSewa server to send a copy of proof of payment after a payment is received. The callback-url is a POST method API and should be in this format
I don't understand how to create this Call back url and implement. Als Does product Id must be same for each session or different.
For example for Product A, Each time user purchase then I can set random number as product ID which will be unique....or should it be same for every session since random number can be different for product A for different session.
Thanks in advance.
Here is the link for their documentation
and the sample project is
Thanks in advance.
1 Answer
For your first question regarding the call back url: It is an url which you pass to esewa for them to redirect to after a successful payment. For example: your site is: abc-shop.com.np. You can pass the callback url as . That page must exist at your end as esewa redirects to that url with a success code which you will need to verify at your end.
You don't need the call back url for mobile apps, its only for web app.
And for the product id, it needs to be unique each time you send a payment request.
Hope that answers your question.