khalti / docs.khalti.com Goto Github PK
View Code? Open in Web Editor NEWKhalti Payment Gateway Documentation
Home Page: https://docs.khalti.com
Khalti Payment Gateway Documentation
Home Page: https://docs.khalti.com
"productUrl" required, though the documentation specifies it as required : false.
If you are using pipx
for managing python dependency.
The project has been handed over to another project.
I see some traces of it here. Just replace it with pip
or poetry and install mkdoc
using it.
One more tech debt to get rid of, yeah !!!
It would be great and easy if there were samples for successful and error responses for each of the api calls(specially verification call) for khalti checkout.
need help with examples. it is for other programming language. I need for android
Is there any rest API to get the amount of money left in merchant account?
uri = URI.parse("https://khalti.com/api/merchant-transaction/<idx>/") # adding the ending slash (/) prevents 301 redirects
request = Net::HTTP::Get.new(uri)
request["Authorization"] = "Key <key>"
req_options = {
use_ssl: uri.scheme == "https",
}
res = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|
http.request(request)
end
A working code used in Grasruts to retrieve transaction data .
$args = http_build_query(array(
'token' => 'QUao9cqFzxPgvWJNi9aKac',
'amount' => 1000
);
The example is missing another closing )
Even with the right api key , i m getting invalid token in the new payment method .
added test test_secret_key on the authorization header and pointed API is https://a.khalti.com/api/v2/epayment/initiate
interface
export interface Ikhalti {
return_url: string;
website_url: string;
amount: number;
purchase_order_id: string;
purchase_order_name: string;
customer_info: {
name: string;
email: string;
phone: string;
},
amount_breakdown: {
label: string;
amount: number;
}[];
product_details: {
identity: string;
name: string;
total_price: number;
quantity: number;
unit_price: number;
}[];
}
used dummy from repayment docs body
return_url: 'http://localhost:8100/tabs/home',
website_url: 'http://localhost:8100/tabs/home',
amount: 1300,
purchase_order_id: 'test12',
purchase_order_name: 'test',
customer_info: {
name: 'Ashim Upadhaya',
email: '[email protected]',
phone: '9811496763'
},
amount_breakdown: [
{
label: 'Mark Price',
amount: 1000
},
{
label: 'VAT',
amount: 300
}
],
product_details: [
{
identity: '1234567890',
name: 'Khalti logo',
total_price: 1300,
quantity: 1,
unit_price: 1300
}
]
};
method
payment(): Observable<any> {
const headers = new HttpHeaders();
headers.set('Authorization', '<test_secret_key>');
headers.set('content-type', 'application/json');
headers.set('Access-Control-Allow-Origin', '*');
return this.httpClient.post('https://a.khalti.com/api/v2/epayment/initiate', {body: this.body },
{'headers':headers});
}
An example for server side verification for Java would be a great addition.
i am getting cors error while making POST request to merchant API for verification. And when i try to use reverse proxy i.e. https://cors-anywhere.herokuapp.com , i got 403 unuathorized error
Access to XMLHttpRequest at 'https://khalti.com/api/v2/payment/verify/' from origin 'http://localhost:3000/' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
while using reverse proxy
Failed to load resource: the server responded with a status of 403 (Forbidden)
An example to verify transaction from C# would be great ;)
No webhooks?
I think we can add postman collection so it will be easy to browse and check ??
When khalti returns token for a transaction, then I tried calling the verify request to the khalti API but it says net::ERR_Failed
Here is my code reference for calling the verify request:
axios({
url: "https://khalti.com/api/v2/payment/verify/",
method: "POST",
headers: {
Authorization: "my_secret_key",
},
data: {
token: props.token, // this contains my token key provided by khalti in the response
amount: props.amount, // this contains the amount
},
})
//Here Both the token and amount along with the Authorization are correct
But I receive an error like this
What is the reason behind this error?
In the client side javascript config
var config = { // replace the publicKey with yours "publicKey": "test_public_key_5", "productIdentity": "{{product.slug}}", "productName": "PRODUCT #1", "productUrl": "http://khalti.com", "paymentPreference": [ "KHALTI", "EBANKING", "MOBILE_BANKING", "CONNECT_IPS", "SCT", ], "eventHandler": { onSuccess (payload) {console.log(payload); }, onError (error) { console.log(error); }, onClose () { console.log('widget is closing'); } } };
Here the productName will cause the payment flow to crash because GET parameters does not get read due to the "#" character right in between. This will throw off an error state like sourceMobile missing.
The does as of now, don't have example for PARTIALLY REFUNDED
case of lookup api. How does the response look like in this case?
Hi guys,
If you guys are planning on to add a ruby example code, here it is:
headers = {
Authorization: 'Key test_secret_key_f59e8b7d18b4499ca40f68195a846e9b'
}
uri = URI.parse('https://khalti.com/api/payment/verify/')
https = Net::HTTP.new(uri.host, uri.port)
https.use_ssl = true
request = Net::HTTP::Post.new(uri.request_uri, headers)
request.set_form_data('token' => params[:token], 'amount' => params[:amount])
response = https.request(request)
Was trying to PR API portion but I didn't understand the convention used for writing docs. Can we create custom editor config and create contribution guide. And it will be useful to use Jekyll as we don't need to duplicate many codes.
you can find the image being used in the file getting-started.md
at position Ln 38, Col 66.
hello i have buy wowonder social platform and wanted to put khalti as payment portal.can any body help in making wowonder khalti payment portal
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.