diff --git a/src/Message/PaymentIntents/ClonePaymentMethodRequest.php b/src/Message/PaymentIntents/ClonePaymentMethodRequest.php new file mode 100644 index 00000000..a01e5f23 --- /dev/null +++ b/src/Message/PaymentIntents/ClonePaymentMethodRequest.php @@ -0,0 +1,48 @@ +validate('customerReference', 'paymentMethod'); + + $data['payment_method'] = $this->getPaymentMethod(); + $data['customer'] = $this->getCustomerReference(); + + return $data; + } + + /** + * @inheritdoc + */ + public function getEndpoint() + { + return $this->endpoint.'/payment_methods'; + } + + /** + * @inheritdoc + */ + protected function createResponse($data, $headers = []) + { + return $this->response = new Response($this, $data, $headers); + } +} diff --git a/src/PaymentIntentsGateway.php b/src/PaymentIntentsGateway.php index e6ecea2f..0b9e7d08 100644 --- a/src/PaymentIntentsGateway.php +++ b/src/PaymentIntentsGateway.php @@ -166,6 +166,16 @@ public function deleteCard(array $parameters = array()) return $this->createRequest('\Omnipay\Stripe\Message\PaymentIntents\DetachPaymentMethodRequest', $parameters); } + /** + * Clone a Payment Method to a Connected Stripe account. + * + * @return \Omnipay\Stripe\Message\PaymentIntents\ClonePaymentMethodRequest + */ + public function clonePaymentMethod(array $parameters = array()) + { + return $this->createRequest('\Omnipay\Stripe\Message\PaymentIntents\ClonePaymentMethodRequest', $parameters); + } + // Setup Intent /**