twiliotwilio-apitwilio-php

Pay session and payment card information capture


Update: After 2 weeks of communicating with Twilio support, it turns out there was an issue on their side and there was actually nothing wrong with what I was doing.

I'm in the process of implementing Pay Sessions using Payment Resources and I'm having issues with collecting information.

From what I understand from the docs (which is not all that clear), when I update a Pay Session passing the "Capture" parameter with the information I want to collect, it should trigger the collection on the call, right?

Currently everything goes well, I'm not getting any sort of errors from Twilio, but nothing happens when I update the Pay Session.

I'm doing this in PHP, here is basically my code:

I initiate the Pay Session as in the docs:

$sid = getenv("TWILIO_ACCOUNT_SID");
$token = getenv("TWILIO_AUTH_TOKEN");
$twilio = new Client($sid, $token);

$twilio
    ->calls("MyCallSid")
    ->payments->create(
        "abcde",
        "https://www.mycallbackurl.com"
    );

This works fine, my pay session is initialized and I'm able to cancel it as well.

How I try to trigger information collection by updating the resource:

$twilio
    ->calls("MyCallSid")
    ->payments("MyPaySessionId")
    ->update(
        "asdfqwer",
        "https://www.mycallbackurl.com",
        ["capture" => "payment-card-number"]
    );

While this technically runs without any errors, nothing happens on the call, and the callback URL is never called by Twilio.

From my understanding of the (unclear) docs, this should trigger the payment card number collection, so I expect some sort of generic instructions to be played on the call for the callee (voice prompt), or isn't this what this does?

The documentation really needs clarification on payment resources.


Solution

  • Issue was on Twilio's side, they are working on a fix as of Sept. 30 2024.