diff --git a/src/Message/PaymentIntents/AuthorizeRequest.php b/src/Message/PaymentIntents/AuthorizeRequest.php index 65965058..7691135a 100644 --- a/src/Message/PaymentIntents/AuthorizeRequest.php +++ b/src/Message/PaymentIntents/AuthorizeRequest.php @@ -399,7 +399,7 @@ public function getData() $data['confirm'] = $this->getConfirm() ? 'true' : 'false'; - if ($this->getReturnUrl()) { + if ($this->getConfirm() && !$this->getOffSession()) { $this->validate('returnUrl'); $data['return_url'] = $this->getReturnUrl(); } diff --git a/tests/Message/PaymentIntents/AuthorizeRequestTest.php b/tests/Message/PaymentIntents/AuthorizeRequestTest.php index 7254e9eb..1826f55a 100644 --- a/tests/Message/PaymentIntents/AuthorizeRequestTest.php +++ b/tests/Message/PaymentIntents/AuthorizeRequestTest.php @@ -45,7 +45,7 @@ public function testGetData() $this->assertSame(array('foo' => 'bar'), $data['metadata']); $this->assertSame(100, $data['application_fee']); $this->assertSame('off_session', $data['setup_future_usage']); - $this->assertSame(true, $data['off_session']); + $this->assertSame('true', $data['off_session']); } /**