Skip to content

Embedded checkout: Refused to frame #1631

@cfernandeza-or

Description

@cfernandeza-or

Describe the bug
I am triying to embed the checkout with the function embedCheckout, but throws this errror:
Refused to frame 'https://channel.mybigcommerce.com/' because an ancestor violates the following Content Security Policy directive: "frame-ancestors https://channel.mybigcommerce.com/".

The hook useCheckout request the redirect links and when the data is loaded, execute the embededCheckout function to embed the iframe in the div:

`
import { Layout } from "@components/common";
import { Container } from "@components/ui";
import useCheckout from '@framework/checkout/use-checkout';
import { embedCheckout } from '@bigcommerce/checkout-sdk';
import { useEffect } from 'react';

export default function Checkout () {
const { data } = useCheckout();

useEffect(() => {
    if(data) {
        embedCheckout({
            url: data?.embedded_checkout_url,
            containerId: "checkout-container"
        })
    }
}, [ data ]);

return (
    <Container>            
        <div id="checkout-container"/>
    </Container>
)

}

Checkout.Layout = Layout`

Screenshots
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions