I'm creating Java program for payments.
For example I have to send message "FOO.BAR" to number 123123 then I will receive message from this number with code, for example XYZXYZ
Now I've got an API from my hosting, something like a
html://foo.bar/msg.php?received_code="MY_RECEIVED_CODE"
so MY_RECEIVED_CODE will be XYZXYZ
html://foo.bar/msg.php?received_code="XYZXYZ"
And we will receive a reply from this link with message in single number:
- 0 - Means that we typed wrong reply code
- 1 - Means that everything is okey and it's done
- 2 - Means that we haven't put any code inside our received_code=""
And now how to execute this link and handle answer in Java?
Something like:
void payment(String code)
{
int answer = executeLink("http://foo.bar/...received_code=" + code + "\"");
if(answer == 0)...
if(answer == 1)...
}
