From ac4e201f988b0dabe861074ea7ad2ce51ac158a1 Mon Sep 17 00:00:00 2001 From: caiyuchao Date: Mon, 28 Apr 2025 19:00:31 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20paypal=E4=B8=AD=E8=8B=B1=E6=96=87?= =?UTF-8?q?=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/paypal.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/utils/paypal.ts b/src/utils/paypal.ts index 12a5095..19484d1 100644 --- a/src/utils/paypal.ts +++ b/src/utils/paypal.ts @@ -1,8 +1,12 @@ import { loadScript } from "@paypal/paypal-js"; import { payPalOrders, payPalCapture } from '@/service/api/payment'; +import { useAppStore } from '@/store/modules/app'; + +const appStore = useAppStore(); +const locale = appStore.locale.includes("zh") ? "zh_CN" : "en_US" export const constructPaypalBtn = async(orderId: number, currency: string) =>{ - loadScript({ clientId: import.meta.env.VITE_PAYPAL_CLIENT_ID, disableFunding: ["paylater"], currency }) + loadScript({ clientId: import.meta.env.VITE_PAYPAL_CLIENT_ID, currency, locale: locale }) .then((paypal: any) => { paypal .Buttons({ @@ -16,7 +20,7 @@ export const constructPaypalBtn = async(orderId: number, currency: string) =>{ }, - async createOrder() { + async createOrder() { try { const response = await payPalOrders({orderId: orderId});