Я пытаюсь изучить и реализовать процесс чередования полос
Я успешно реализовал его для целевых передач, который работает,
Intent.php
$intent = \Stripe\PaymentIntent::retrieve($getIntent->id);
echo json_encode(["status"=>"ok","id"=>$intent->id,"client_secret"=>$intent->client_secret,"amount"=>$intent->amount,"currency"=>$intent->currency]);
Теперь я пытаюсь произвести прямой дебет на этом подключенном аккаунте, например
Intent.php
$getIntent = \Stripe\PaymentIntent::create([
"amount" =>$amount,
"currency" => "eur",
"description" => "Test Payment" ,
'payment_method_types' => ['card'],
'stripe_account' => '#######',
]);
$intent = \Stripe\PaymentIntent::retrieve($getIntent->id);
echo json_encode(["status"=>"ok","id"=>$intent->id,"client_secret"=>$intent->client_secret,"amount"=>$intent->amount,"currency"=>$intent->currency]);
. При этом я получаю эту ошибку
IntegrationError: Неверное значение для секретного намерения stripe.handleCardPayment: значение должно быть client_secret
строкой. Вы указали: undefined.
Это javascript, из которого я также использую в этой реализации и который я получил ошибку из консоли браузера
<script>
// Stripe API Key
var stripe = Stripe('####');
// clientSecret to complete payment
var clientSecret;
// paymentIntent id --- using to update
var paymentIntent;
var amount = 10000; //i.e 20GBP
// create initial payment intent, get client secret
$.getJSON("intent.php", {
"amount": amount
}, function(data) {
clientSecret = data.client_secret;
paymentIntent = data.id;
});
// set up stripe.js
var elements = stripe.elements();
// Custom Styling
var style = {
base: {
color: '#32325d',
lineHeight: '24px',
fontFamily: '"Helvetica Neue", Helvetica, sans-serif',
fontSmoothing: 'antialiased',
fontSize: '16px',
'::placeholder': {
color: '#aab7c4'
}
},
invalid: {
color: '#fa755a',
iconColor: '#fa755a'
}
};
// Create an instance of the card Element
var card = elements.create('card', {
hidePostalCode: true,
style: style
});
// Add an instance of the card Element into the `card-element` <div>
card.mount('#card-element');
// Handle real-time validation errors from the card Element.
card.addEventListener('change', function(event) {
var displayError = document.getElementById('card-errors');
if (event.error) {
displayError.textContent = event.error.message;
} else {
displayError.textContent = '';
}
});
// on button click
$("#cbutton").on('click', function(ev) {
$(this).prop("disabled", true);
$('#process').show();
stripe.handleCardPayment(
clientSecret, card).then(function(result) {
if (result.error) {
// Display error.message in your UI.
$("#card-errors").text(result.error.message);
// Re-enable button
$('#process').hide();
$("#cbutton").removeAttr("disabled");
console.log(result.error);
} else {
$('#process').hide();
alert('success');
location.reload();
// The payment has succeeded. Display a success message.
//console.log(result);
}
});
});
</script>
Пожалуйста, чтомог ли я ошибаться при попытке прямого списания с подключенного аккаунта