결제 관련 이슈가 있어서 공유 드립니다.

제 SDK.
.
.

This is guide: https://docs.tosspayments.com/reference/js-sdk

This is the code applied:
const onClickPaymentWithTosspay = () => {
var clientKey = CLIENT_KEY_LIVE;
var orderId = order_id_${new Date().getTime()};
let currentAmout = data.freightCost + data.vat;
setloadingBrandpay(true);
loadTossPayments(clientKey).then((tossPayments: any) => {
tossPayments
.requestPayment("", {
//
amount: currentAmout,
orderId: orderId,
orderName: orderId,
})
.then(function (data: any) {
//
console.log("payment completed:", data);
callbackPayment({
success: true,
});
setloadingBrandpay(false);
})
.catch(function (error: any) {
console.log("payment error:", error);
if (error.code === "USER_CANCEL") {
//
} else if (error.code === "INVALID_CARD_COMPANY") {
//
}
dispatch(
openDialog({
type: "info",
//@ts-ignore
content: error?.message || "",
})
);
setloadingBrandpay(false);
});
});
};
창 JavaScript SDK , .
결제창 JavaScript SDK | 토스페이먼츠 개발자센터
Was this page helpful?