Closed triplesic closed 7 years ago
@triplesic Just a heads up that I am investigating this but it may take a little while. This looks like an isolated incident, do you have a fully reproducible code that I can test with?
@triplesic Hi, I've just created a new project from scratch, using version 2.5.3 and it looks like charge is being created correctly. Here is the code:
import co.omise.Client;
import co.omise.ClientException;
import co.omise.models.Card;
import co.omise.models.Charge;
import co.omise.models.Token;
public class Main {
public static void main(String[] args) {
try {
Client client = buildClient();
Token token = client.tokens().create(new Token.Create()
.card(new Card.Create()
.name("John Appleseed")
.number("4242424242424242")
.expiration(10, 2020)
.securityCode("123")
)
);
System.out.println("created token: " + token.getId());
Charge charge = client.charges().create(new Charge.Create()
.amount(23456)
.currency("thb")
.card(token.getId())
);
System.out.println("created charge: " + charge.getId());
} catch (Exception e) {
e.printStackTrace();
}
}
private static Client buildClient() throws ClientException {
return new Client(
"pkey_test_replaceme",
"skey_test_replaceme"
);
}
}
Oh!, My bad Your API is working correctly, I found some problems when parsing the tokenId to my API. I will close this issue.
Thanks for your support 👍
Hi, I tested the charging API by token in the terminal everything looks good.
Then, I generate a new token and test charging via Java SDK as code below
Client client = new Client("my_pkey", "my_skey"); Charge charge = client.charges() .create(new Charge.Create() .amount(10000) .currency("thb") .card("tokenId"));
Unfortunately, the token was not found.
I've tried to use the same token to charge via terminal, it's work!!
So, could you please advice me, why I can't charge a card via JavaSDK ?
lib: omise-java version 2.5.3.