Twilio Pay Connectors - Local Testing

Server is running on: http://localhost:8000


Test 1: Basic Pay Connector

URL: pay-connector.php

<?xml version="1.0" encoding="UTF-8"?>
<Response><Pay paymentConnector="Ubaidullah"/></Response>

Test 2: Payment with Charge

URL: payment-with-charge.php

<?xml version="1.0" encoding="UTF-8"?>
<Response><Say voice="alice" language="en-US">You will be charged 10 dollars for this service.</Say><Pay paymentConnector="Ubaidullah" chargeAmount="10.00" currency="usd" action="http://localhost:8000/payment-status.php" method="POST"/></Response>

Test 3: Payment Tokenization

URL: payment-tokenization.php

<?xml version="1.0" encoding="UTF-8"?>
<Response><Say voice="alice" language="en-US">We will now collect your payment information for future use.</Say><Pay paymentConnector="Ubaidullah" chargeAmount="0" action="http://localhost:8000/payment-token-handler.php" method="POST"/></Response>

Test 4: Complete Payment Flow

URL: complete-payment-flow.php?amount=15.00

<?xml version="1.0" encoding="UTF-8"?>
<Response><Say voice="alice" language="en-US">Welcome to our payment service.</Say><Say voice="alice" language="en-US">You will be charged 15.00 dollars. Please have your credit card ready.</Say><Pause length="1"/><Pay paymentConnector="Ubaidullah" chargeAmount="15.00" currency="usd" action="http://localhost:8000/payment-status.php" method="POST"/></Response>

Testing Instructions:

  1. Open browser and go to: http://localhost:8000/test-local.php
  2. Click on any of the links above to see the TwiML output
  3. To test with Twilio, you'll need to expose this server using ngrok or similar tool
  4. Update the webhook URLs in Twilio Console to point to your public URL

Available Endpoints: