solution = [ 'accountSid' => $accountSid, 'callSid' => $callSid, 'sid' => $sid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) .'/Calls/' . \rawurlencode($callSid) .'/Payments/' . \rawurlencode($sid) .'.json'; } /** * Update the PaymentInstance * * @param string $idempotencyKey A unique token that will be used to ensure that multiple API calls with the same information do not result in multiple transactions. This should be a unique string value per API call and can be a randomly generated. * @param string $statusCallback Provide an absolute or relative URL to receive status updates regarding your Pay session. Read more about the [Update](https://www.twilio.com/docs/voice/api/payment-resource#statuscallback-update) and [Complete/Cancel](https://www.twilio.com/docs/voice/api/payment-resource#statuscallback-cancelcomplete) POST requests. * @param array|Options $options Optional Arguments * @return PaymentInstance Updated PaymentInstance * @throws TwilioException When an HTTP error occurs. */ public function update(string $idempotencyKey, string $statusCallback, array $options = []): PaymentInstance { $options = new Values($options); $data = Values::of([ 'IdempotencyKey' => $idempotencyKey, 'StatusCallback' => $statusCallback, 'Capture' => $options['capture'], 'Status' => $options['status'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new PaymentInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['callSid'], $this->solution['sid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.PaymentContext ' . \implode(' ', $context) . ']'; } }