I use Braintree SDKin my Android app for paymentsand everything works fine, but here is one problem that it sets every time there is credit / debit card information. So my question is, is there a way to save credit / debit card data for future payments without having to re-request credit card information for the same user.
private ApiInterface apiInterface;
apiInterface = ApiClient.getClient().create(ApiInterface.class);
Call<ImageListResponse> call3 = apiInterface.getImageList("listpost");
call3.enqueue(new Callback<ImageListResponse>() {
@Override
public void onResponse(Call<ImageListResponse> call, Response<ImageListResponse> response) {
}
@Override
public void onFailure(Call<ImageListResponse> call, Throwable t) {
}
});
@FormUrlEncoded
@POST("./")
Call<ImageListResponse> getImageList(@Field("method") String method);
@Multipart
@POST("./")
Call<UploadImageResponse> imageUpload(@Part("method") RequestBody method, @Part("Description") RequestBody desc,
@Part("DateTime") RequestBody datetime, @Part MultipartBody.Part file);
File file = new File(String.valueOf(cropfilepath));
RequestBody mFile = RequestBody.create(MediaType.parse("image*/"), file);
MultipartBody.Part fileToUpload = MultipartBody.Part.createFormData("Image", file.getName(), mFile);
RequestBody method = RequestBody.create(MediaType.parse("text/plain"), "sendpost");
Call<UploadImageResponse> call3 = apiInterface.imageUpload(method, desc, datetime, fileToUpload);
public static final String BASE_URL = "http://62.75.139.216/Insta_Web/api/service/";
private static Retrofit retrofit = null;
public static Retrofit getClient() {
if (retrofit == null) {
HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
interceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
OkHttpClient client = new OkHttpClient.Builder().addInterceptor(interceptor).build();
Gson gson = new GsonBuilder()
.setLenient()
.create();
retrofit = new Retrofit.Builder()
.baseUrl(BASE_URL)
.client(client)
.addConverterFactory(GsonConverterFactory.create(gson))
.build();
}
return retrofit;
compile 'com.google.code.gson:gson:2.6.2'
compile 'com.squareup.retrofit2:retrofit:2.0.2'
compile 'com.squareup.retrofit2:converter-gson:2.0.2'
compile 'com.squareup.okhttp3:logging-interceptor:3.9.1'
source
share