diff --git a/src/features/BuyMatchPopup/components/BrazilPayment/index.tsx b/src/features/BuyMatchPopup/components/BrazilPayment/index.tsx index f2e06f39..5606c310 100644 --- a/src/features/BuyMatchPopup/components/BrazilPayment/index.tsx +++ b/src/features/BuyMatchPopup/components/BrazilPayment/index.tsx @@ -24,7 +24,7 @@ type ResponsePayment = { url: string, } -type ResponsePaymentArray =Array +type ResponsePaymentArray = ResponsePayment | null export const BrazilPayment = ({ open, @@ -51,7 +51,7 @@ export const BrazilPayment = ({ if (open) { (async () => { const json: ResponsePaymentArray = await getBrazilPaymentUrl({ item: originalObject, product_name: `${pack} ${teams}` }) - setSrc(json[0]?.url || '') + setSrc(json?.url || '') })() } // eslint-disable-next-line react-hooks/exhaustive-deps diff --git a/src/requests/getBrazilPaymentUrl.tsx b/src/requests/getBrazilPaymentUrl.tsx index 2859fab1..7cb4a077 100644 --- a/src/requests/getBrazilPaymentUrl.tsx +++ b/src/requests/getBrazilPaymentUrl.tsx @@ -10,12 +10,16 @@ type Props = { export const getBrazilPaymentUrl = async ({ item, product_name }: Props) => { const config = { body: { - item: { ...item, product_name }, + action: 'create_subscription', + data: { + item: { ...item, product_name }, + }, + service: 'pag_brasil', }, } return callApi({ config, - url: `${API_ROOT}/account/payment/pagbrasil`, + url: `${API_ROOT}/account/payments`, }) }