Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions src/Message/PaymentIntents/ClonePaymentMethodRequest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php

/**
* Stripe Create Payment Method Request.
*/
namespace Omnipay\Stripe\Message\PaymentIntents;

/**
* Clone a payment method to a connected Stripe account.
*
* @see \Omnipay\Stripe\Message\PaymentIntents\AttachPaymentMethodRequest
* @see \Omnipay\Stripe\Message\PaymentIntents\DetachPaymentMethodRequest
* @see \Omnipay\Stripe\Message\PaymentIntents\UpdatePaymentMethodRequest
* @link https://docs.stripe.com/payments/payment-methods/connect?lang=php#cloning-payment-methods
*/
class ClonePaymentMethodRequest extends AbstractRequest
{
/**
* @inheritdoc
*/
public function getData()
{
$data = [];

$this->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);
}
}
10 changes: 10 additions & 0 deletions src/PaymentIntentsGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -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

/**
Expand Down