# Wordpress
If you wish to integrate XanPay with a Wordpress website, you can use JavaScript Injection. Or if you are using WooCommerce, you can simply use our plugin here.
# JS Injection
Inject the following line into the header section of your webpage:
<script src="https://cdn.xanpay.com/sdk/xanpay-sdk-1.0.0.js"></script>
Construct checkout urls and then redirect users to XanPay checkout website as demonstrated below.
async function checkout() {
const orders = [{
id: 'kun1Ja2',
name: "iPhone",
quantity: 1,
amount: 151
}];
const options = {
apiKey: 'a04668f6e299280a7485e0002ce9729c',
apiKeySecret: '0f37463afff161028ef495d9035ccdc053a036f5e57fee7a720c89dfedc55131',
currency: 'HKD',
amount: 151,
orders,
environment: XanPaySDK.Environment.Sandbox,
redirectUrl: 'https://xanpay.com/',
notifyPayload: {"orderId": "251"},
customer: {
email: "test@test.test",
firstName: "Test",
lastName: "Tester",
phone: {
code: "+65",
phone: "12345678901"
}
}
};
const url = await XanPaySDK.constructCheckoutUrl(options);
window.open(url, '_blank');
}
← Opencart