diff --git a/src/Message/SetupIntents/CreateSetupIntentRequest.php b/src/Message/SetupIntents/CreateSetupIntentRequest.php index 53eb08b0..1913d2ce 100644 --- a/src/Message/SetupIntents/CreateSetupIntentRequest.php +++ b/src/Message/SetupIntents/CreateSetupIntentRequest.php @@ -22,6 +22,48 @@ */ class CreateSetupIntentRequest extends AbstractRequest { + /** + * @param bool $value + * + * @return AbstractRequest provides a fluent interface. + */ + public function setConfirm($value) + { + return $this->setParameter('confirm', $value); + } + + /** + * @return mixed + */ + public function getConfirm() + { + if (is_null($this->getParameter('confirm'))) { + return 'false'; + } + return $this->getParameter('confirm'); + } + + /** + * @param bool $value + * + * @return AbstractRequest provides a fluent interface. + */ + public function setUsage($value) + { + return $this->setParameter('usage', $value); + } + + /** + * @return mixed + */ + public function getUsage() + { + if (is_null($this->getParameter('usage'))) { + return 'off_session'; + } + return $this->getParameter('usage'); + } + /** * @inheritdoc */ @@ -37,13 +79,15 @@ public function getData() } if ($this->getMetadata()) { - $this['metadata'] = $this->getMetadata(); + $data['metadata'] = $this->getMetadata(); } if ($this->getPaymentMethod()) { - $this['payment_method'] = $this->getPaymentMethod(); + $data['payment_method'] = $this->getPaymentMethod(); } - $data['usage'] = 'off_session'; + $data['confirm'] = $this->getConfirm(); + + $data['usage'] = $this->getUsage(); $data['payment_method_types'][] = 'card'; return $data;