我想在我的Android应用程序中通过PAYU接受付款,但我没有服务器,因此我使用firebase存储数据.从视频https://youtu.be/gnQ0IF3XniM 我设法从视频 中提到的服务器集成PAYU支付网关.我从服务器生成哈希的代码如下:
@Override
protected PayuHashes doInBackground(String... postParams) {
PayuHashes payuHashes = new PayuHashes();
try {
//TODO Below url is just for testing purpose, merchant needs to replace this with their server side hash generation url
URL url = new URL("https://payu.herokuapp.com/get_hash");
// get the payuConfig first
String postParam = postParams[0];
byte[] postParamsByte = postParam.getBytes("UTF-8");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
conn.setRequestProperty("Content-Length", String.valueOf(postParamsByte.length));
conn.setDoOutput(true);
conn.getOutputStream().write(postParamsByte);
InputStream responseInputStream = conn.getInputStream();
StringBuffer responseStringBuffer = new StringBuffer();
byte[] byteContainer = new …Run Code Online (Sandbox Code Playgroud) 如何读取表示数组元素的空格分隔整数并在C中求和?我使用下面的代码,但它读取新行中的所有元素:
#include <math.h>
#include <stdio.h>
int main() {
int i = 0, N, sum = 0, ar[i];
scanf("%d" , &N);
for (i = 0; i < N; i++) {
scanf("%d", &ar[i]);
}
for (i = 0; i < N; i++) {
sum = sum + ar[i];
}
printf("%d\n", sum);
return 0;
}
Run Code Online (Sandbox Code Playgroud)