Я выполняю do c: https://stripe.com/docs/payments/accept-a-payment#android
На стороне сервера:
- Создано
PaymentIntentCreateParams
, я установил валюту и сумма по этому объекту - Создано
PaymentIntent
с использованием PaymentIntentCreateParams
clientSecretKey
отправлено клиенту (android)
На клиенте сторона:
- Получение
PaymentMethodCreateParams
из CardMultilineWidget
- Создание
ConfirmPaymentIntentParams
с использованием PaymentMethodCreateParams
и clientSecretKey
- Использование
stripe
объект для confirmPayment
Вот платеж, связанный с этой транзакцией:
![enter image description here](https://i.stack.imgur.com/F6CQQ.png)
Очевидно, платеж не прошел go и я не понимаю, почему и как я получаю этот статус, мой метод оплаты - это то, что на CardMultilineWidget
нет?
Как мне установить способ оплаты на PaymentIntent
?
сервере
@PostMapping("/api/payment")
@ResponseBody
public String startPay(@RequestHeader Map<String, String> headers,
@RequestParam(name = "currency") String currency,
@RequestParam(name = "name") String name) throws Exception{
PaymentBody paymentBody = new PaymentBody(currency, name);
PaymentIntentCreateParams createParams = new PaymentIntentCreateParams.Builder()
.setCurrency(paymentBody.getCurrency())
.setAmount(100000L)
.addPaymentMethodType("card")
.build();
PaymentIntent intent = PaymentIntent.create(createParams);
Gson gson = new Gson().newBuilder().setPrettyPrinting().create();
System.out.println(gson.toJson(intent));
PaymentResponse paymentResponse = new PaymentResponse(ApiKey.PUBLISHABLE_KEY,
intent.getClientSecret(),
intent.getId(),
intent.getStatus());
return gson.toJson(paymentResponse);
}
клиенте:
@Override
public void onPayClicked() {
mStripeApi.requestPaymentIntent("USD", "Name").enqueue(new Callback<PaymentResponse>() {
@Override
public void onResponse(Call<PaymentResponse> call, Response<PaymentResponse> response) {
PaymentMethodCreateParams paymentMethodCreateParams = mViewMvc.getCardDetails();
if(paymentMethodCreateParams == null) {
return;
}
mViewMvc.setResponse(response.body().getResponse());
ConfirmPaymentIntentParams confirmPaymentIntentParams = ConfirmPaymentIntentParams.
createWithPaymentMethodCreateParams(paymentMethodCreateParams, response.body().getClientSecret());
mStripe.confirmPayment(mFragmentActivity, confirmPaymentIntentParams);
}
@Override
public void onFailure(Call<PaymentResponse> call, Throwable t) {
}
});
}