Quantcast
Channel: Square Developer Forums - Latest topics
Viewing all articles
Browse latest Browse all 1328

How to Enable and Test 3D Secure (OTP) with Square PHP SDK in Sandbox?

$
0
0

I am integrating Square payments using the PHP SDK in my application, and I want to test the 3D Secure (OTP-like flow) in the sandbox environment.

  • Do I need to configure anything specific in the PHP SDK to trigger the OTP verification?
  • How do I properly pass the verification_token in the PHP SDK?
  • Are there specific sandbox test cards that trigger 3DS authentication?

Below is my code
const payments = Square.payments(‘SANDBOX_APP_ID’, ‘sandbox’);
const card = await payments.card();
await card.attach(‘#card-container’);

document.getElementById(‘payment-button’).addEventListener(‘click’, async function () {
const result = await card.tokenize();
if (result.status === ‘OK’) {
// Send token to server
fetch(‘process_payment.php’, {
method: ‘POST’,
headers: { ‘Content-Type’: ‘application/json’ },
body: JSON.stringify({ token: result.token })
});
}
});
Please tell me the all steps. Any guidance would be greatly appreciated!

3 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 1328

Trending Articles