# šŸ’»developers


03/14/2024, 12:19 PM
hey I am beginner in botpress, I am creating a chatbot for my company i have finished the flow of the conversation but in the end I want the functionality to redirect the users to the payment page here I am using square for payments i think the code is working but the nothing showing in the url and it is showing empty how to fix it // Define the async function within the Botpress action or event handler context const sendPayment = async (event: any, { bp }: any) => { const squareApiUrl = ''; const locationId = ' My id'; const accessToken = ' My token '; const payload = { idempotency_key: payment-${}, order: { line_items: [ { name: workflow.selectedMedicine, quantity: workflow.medicineQuantity, base_price_money: { amount: parseFloat(workflow.totalAmount) * 100, currency: 'GBP' } } ] }, }; try { const response = await${squareApiUrl}/${locationId}/checkouts, payload, { headers: { 'Authorization': Bearer ${accessToken}, 'Content-Type': 'application/json', 'Accept': 'application/json' } }); const checkoutUrl =; workflow.url = checkoutUrl const text = You can complete your payment by clicking on the following link: ${checkoutUrl}; await, { type: 'text', text }); } catch (error) { console.error('Failed to create checkout session with Square:', error); const errorMessage = 'Sorry, there was a problem processing your payment. Please try again later.'; await, { type: 'text', text: errorMessage }); } }; this is my code please somebody help me