Hi!
I'm trying to translate in B4A my CURL call to Stripe Payment API, this is the basic call in CURL:
Stripe docs say that
now I'm trying to do this in B4A:
and also this
but when compiling I get:
where's the problem?
regards,
ciro
I'm trying to translate in B4A my CURL call to Stripe Payment API, this is the basic call in CURL:
B4X:
curl https://api.stripe.com/v1/charges \
-u sk_test_4eC39HqLyjWDarjtT1zdp7dc
Stripe docs say that
PI requests. You can manage your API keys in the Dashboard. Your API keys carry many privileges, so be sure to keep them secure! Do not share your secret API keys in publicly accessible areas such as GitHub, client-side code, and so forth.
Authentication to the API is performed via HTTP Basic Auth. Provide your API key as the basic auth username value. You do not need to provide a password.
If you need to authenticate via bearer auth (e.g., for a cross-origin request), use -H "Authorization: Bearer sk_test_4eC39HqLyjWDarjtT1zdp7dc" instead of -u sk_test_4eC39HqLyjWDarjtT1zdp7dc.
All API requests must be made over HTTPS. Calls made over plain HTTP will fail. API requests without authentication will also fail.
now I'm trying to do this in B4A:
B4X:
Dim job1 As HttpJob
job1.Initialize("JobStripe",Me)
job1.Download("https://api.stripe.com/v1/charges")
job1.GetRequest.SetHeader("Authorization","Bearer sk_test_4eC39HqLyjWDarjtT1zdp7dc")
and also this
B4X:
job1.Initialize("JobStripe",Me)
job1.PostString("https://api.stripe.com/v1/charges","amount=5")
job1.GetRequest.SetHeader("Authorization","sk_test_8schl5Ig2ZuQe5XIpjnNjKQH")
but when compiling I get:
Building folders structure. (0.06s)
Compilazione del codice. (0.20s)
Compilazione del codice di layouts (0.06s)
Organizzazione Librerie. (0.00s)
Generazione file R. (0.17s)
Compilazione del codice Java prodotto. (4.49s)
Conversione byte code - ottimizzazione dex. Error
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lanywheresoftware/b4a/samples/httputils2/httpjob;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lanywheresoftware/b4a/samples/httputils2/httputils2service;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lanywheresoftware/b4a/samples/httputils2/httputils2service$1;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lanywheresoftware/b4a/samples/httputils2/httputils2service$2;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lanywheresoftware/b4a/samples/httputils2/httputils2service$httputils2service_BR;
5 errors; aborting
where's the problem?
regards,
ciro
Last edited: