I am testing a crypto payment system on my flutter app, and after generating a random address for payment, the api is supposed to notify me when the transaction has been confirmed using a callback url. I use firestore for my backend, how do i handle this callback url. I will post a copy of the documentation below.
"Insert your URL address where you want to get callbacks in create_payment request. The parameter name is ipn_callback_url. You will receive payment updates (statuses) to this URL address."
for anyone having a similar challenge, i actually solved this problem by writing a http cloud function to help me handle this, then supplied the url to the function as the callback url to the api. SO yes.... http cloud functions was a solution to this problem
Here's a very simple function that can be used:
exports.paymentConfirmation = functions.https.onRequest(async(req, res)=>{
const requestBody = req.body;
const paymentStatus = requestBody.payment_status;
console.log('this is the payment status: ' + paymentStatus);
Promise.resolve();
}
res.send(null);
})
basically you can do anything you want with the request body you get back. In this case i just logged one of the parameters. After deploying this function to firebase, you have access to its url. Problem solved. So when there's an update from the api u subscribed to, it can send a POST request to that url and that triggers whatever code you've written in the function.
Related
I have a feedback form like this
the API for it using a GET method without body. I have to send user input from the 3 TextField (Nama, Email, Pesan Anda) to GET method API.
I'm clueless, my senior said that I have to use url parameters so I can still send data to API without a body.
How can I do that?
HTTP GET method has no body on it's requisitions, so yes, the only way to send params is in the url, where you can send like this:
http://{URL}/?nama=Nama&email=Email&pesanAnda=PesanAnda
then you API will have access to these params.
I am using the slack api in a typescript application, where when I initially send a payload through a slack / command, this payload has a response_url. I am able to post data to this response_url with axios, but I have trouble making a get request to this url to access the data I have previously posted. I have tried axios.get(response_url) and await axios.get(response_url) but I have gotten invoke error with status code 500 and a result of Promise {<pending>} - would anyone know the correct way to use the get call?
I'm currently working on e-commerce based website for our country.I need to integrate a local payment gateway solution. The architecture of that system is actually to based on REST. so I need to post several data to a specific url and they response back with a content of another url where my app should be redirected. After the transaction either success/failed/canceled, the third party system redirects back to my app url.
now I'm having problem with redirecting to the third-party url from my app.
var result = HTTP.post(url,{params:data_me});
console.log(result.content+' ....');
The post method is synchronous and i recieve the url properly. how do I now redirect my app to their response url.
Note: these statements are written in a server method. And I'm using iron router for my app.
You can use location.href in client side code, better put it under onRendered
location.href="http://example.com"
or use iron-router's Router to write redirect header in server side
Router.route('/myurl', function () {
//do sth
var url = "http://example.com"
this.response.writeHead(302, {
'Location': url
});
this.response.end();
}, {
where: 'server'
});
Since you're doing the integration on the server, have the server method return the new url to the client. Then on the client simply do:
window.location=url;
iron-router won't take you to an offsite url because it only manages internal routes.
docs
I am trying to make calls using REST API and the Language I am using isn Apex.However,it is throwing me error saying 'Url parameter is required. For more information, see '
I am using Endpoint URL as follows :-
https://api.twilio.com/2010-04-01/Accounts//Calls.json?Url=http://demo.twilio.com/docs/voice.xml
If you see I am adding the Url param to the endpoint,still it is throwing me an error.
I am able to send SMS through Rest API,the issue is only when I am making calls.
Please suggest.
Thanks
Url must be POSTed to the API, you are now sending it as a GET parameter.
Change your code so that it does a POST instead of a GET and sent the Url parameter as a POST variable.
(see http://www.twilio.com/docs/api/rest/making-calls#post-parameters)
Also you left out the {AccountSid} in your URL, that's required as well. Of course you may have left it out because you don't want it publicly visible on SO, but I can't from here that that's your reason ;)
I need to create a REST API Web Service using MVC4 Web Api that will be consumed by Twilio. I need to be able to accept Twilio's HTTP POST for receiving SMS from the user and for responding. So if the user texts a word "Join" or "My Order" then they would call my API using the URL that I have given and I should be sending the Welcome Message for join and the Order List for the text "My Order" and so on. How the heck do I do that? Do I need a single controller or multiple? How would I route this? Please help. Totally lost :-(
Twilio evangelist here.
Twilios HTTP requests are no different than any other HTTP client. So if you want to use Web API as your Twilio SMS URL, then you would just create a Post method and in the method definition, specify the parameters you want to capture from the request.
Twilio sends along a bunch if info with each request, like the to & from phone numbers and the body of the message. You can use model binding to grab this:
public HttpResponseMessage Post(string Body) {
//your code here
// if you want to return TwiML commands, use
// us the TwilioResponse object
return Request.CreateResponse(HttpStatusCode.OK, [your twiml]);
}
Twilio will made its request with an Accept header of text/xml, so WEb API should automatically try to return your TwiML commands as XML.
This blog post has more details on using Web API with Twilio:
http://www.twilio.com/blog/2012/11/building-twilio-apps-using-asp-net-mvc-4-web-api.html
Hope that helps.