"message": "Произошла непредвиденная ошибка — повторите попытку через несколько секунд" как устранить эту ошибку в платеIOS

Программируем под IOS
Ответить Пред. темаСлед. тема
Anonymous
 "message": "Произошла непредвиденная ошибка — повторите попытку через несколько секунд" как устранить эту ошибку в плате

Сообщение Anonymous »

Я получаю эту ошибку за последние 3 дня в этом коде. Я думаю, может быть, все работает нормально, но после завершения платежа, когда вызывается функция «confirm_pay()», я получаю эту ошибку, продолжая использовать шлюз полосовой оплаты с использованием React Native здесь это мой код, может ли кто-нибудь помочь мне избавиться от этой ошибки -
когда вызывается функция «confirm_pay()», я получаю этот ответ в своем терминале, я пробовал все, но ничего не получается работаю на меня.
error : -
{"code": "Failed", "declineCode": null, "localizedMessage": "There was an
unexpected error -- try again in a few seconds", "message": "There was an
unexpected error -- try again in a few seconds", "stripeErrorCode": null,
"type": null}

const { initPaymentSheet, presentPaymentSheet, confirmPaymentSheetPayment } = useStripe();

useEffect(() => {
initStripe({ publishableKey: "pk_test_51JUm2TSHumMvEDNY3mFcrddvlTqUIzxoHqyIuCT2x8ExzZcbcTLB9kAZWY1eT9ZJnIeBSHtxtkNCq5QjcDf2e2ge00knO9Qx1R" })
}, [])

async function booknow(item) {
if (item.sm_booking_type == 1) {
navigation.navigate('DriverServicesScreen', { user_data: user_data_1, item: item })
} else {

const additional_data = await AsyncStorage.getItem( 'additional_data');
var num = JSON.parse(additional_data);
var dataOk = new FormData();
dataOk.append('amount', item.sm_price * 100);
await axios(API_URL, {
method: 'POST',
headers: { Accept: 'application/x-www-form-urlencoded', 'Content-type': 'multipart/form-data', timeout: 180000 },
data: dataOk,
}).then((result) => {
if (result['data'].code == 200) {
paymentInitializeFunction(result['data'].client_secret, result['data'].ephemeralKey, result['data'].customer)
console.log("🚀 ~ file: Api.js ~ line 16 ~ API ~ result", JSON.stringify(result['data']))
} else {
console.log("🚀 ~ file: ServicesScreen.js:167 ~ booknow ~ result:", result)
}
}).catch((err) => {
console.log("🚀 ~ file: Api.js ~ line 24 ~ API ~ err", err)
})
}
}

const paymentInitializeFunction = async (client_secret, ephemeralKey, customer) => {

await initPaymentSheet({
merchantDisplayName: "Example, Inc.",
customerId: customer,
customerEphemeralKeySecret: ephemeralKey,
paymentIntentClientSecret: client_secret,
customFlow: true,
style: 'automatic',
// allowsDelayedPaymentMethods: true,
defaultBillingDetails: {
name: 'Jane Doe',
email: '[email protected]',
phone: '555-555-555',
}
}).then((res) => {
console.log("🚀 ~ file: ServicesScreen.js:195 ~ paymentInitializeFunction ~ error1:", res)
}).catch((res) => {
console.log("🚀 ~ file: ServicesScreen.js:197 ~ paymentInitializeFunction ~ res:", res)
})

await presentPaymentSheet({
paymentIntentClientSecret: client_secret,
clientSecret: client_secret,
customerId: customer,
customerEphemeralKeySecret: ephemeralKey,
customFlow: true,
style: 'automatic',
// allowsDelayedPaymentMethods: true,
defaultBillingDetails: {
name: 'Jane Doe',
email: '[email protected]',
phone: '555-555-555',
}
}).then((res) => {
console.log("🚀 ~ file: ServicesScreen.js:144 ~ paymentInitializeFunction ~ res:", res)
if (res.hasOwnProperty('error')) {
Error_Alert('The payment has been cancelled.');
}
else {
confirm_payment()
}
}).catch((err) => {
console.log("🚀 ~ file: ServicesScreen.js:268 ~ paymentInitializeFunction ~ err:", err)
Error_Alert('Something went wrong, Please try again later.');
})

}

async function confirm_payment() {

const { error } = await confirmPaymentSheetPayment();
console.log("🚀 ~ file: ServicesScreen.js:231 ~ confirm_payment ~ error:", error)

if (error) {
Alert.alert(`Error code: ${error.code}`, error.message);
} else {
Alert.alert('Success', 'The payment was confirmed successfully!');
}
}


Подробнее здесь: https://stackoverflow.com/questions/760 ... nds-how-to
Реклама
Ответить Пред. темаСлед. тема

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение

Вернуться в «IOS»