File tree Expand file tree Collapse file tree 3 files changed +50
-6
lines changed Expand file tree Collapse file tree 3 files changed +50
-6
lines changed Original file line number Diff line number Diff line change @@ -69,6 +69,31 @@ $customer = $gateway->findCustomer(1)->send();
69
69
```
70
70
You can find full list of options [ here] ( https://developers.braintreepayments.com/reference/request/customer/find/php )
71
71
72
+ ### Create payment method
73
+
74
+ ``` php
75
+ $method = $gateway->createPaymentMethod([
76
+ 'customerId' => $user->getId(),
77
+ 'paymentMethodNonce' => 'paymentnonce',
78
+ 'options' => [
79
+ 'verifyCard' => true
80
+ ]
81
+ ]);
82
+ ```
83
+ You can find full list of options [ here] ( https://developers.braintreepayments.com/reference/request/payment-method/create/php ) .
84
+
85
+ ### Update payment method
86
+
87
+ ``` php
88
+ $method = $gateway->updatePaymentMethod([
89
+ 'paymentMethodToken' => 'token123',
90
+ 'options' => [
91
+ 'paymentMethodNonce' => 'paymentnonce'
92
+ ]
93
+ ]);
94
+ ```
95
+ You can find full list of options [ here] ( https://developers.braintreepayments.com/reference/request/payment-method/update/php ) .
96
+
72
97
###Create subscription
73
98
74
99
``` php
Original file line number Diff line number Diff line change @@ -13,13 +13,9 @@ class UpdatePaymentMethodRequest extends AbstractRequest
13
13
{
14
14
public function getData ()
15
15
{
16
- $ parameters = array ();
17
- $ parameters += $ this ->getOptionData ();
18
-
16
+ $ data = array ();
19
17
$ data ['token ' ] = $ this ->getToken ();
20
- if (!empty ($ parameters )) {
21
- $ data ['parameters ' ] = $ parameters ;
22
- }
18
+ $ data ['parameters ' ] = $ this ->parameters ->get ('paymentMethodOptions ' );
23
19
24
20
return $ data ;
25
21
}
@@ -36,4 +32,24 @@ public function sendData($data)
36
32
37
33
return $ this ->createResponse ($ response );
38
34
}
35
+
36
+ /**
37
+ * @param string $value
38
+ *
39
+ * @return \Omnipay\Common\Message\AbstractRequest
40
+ */
41
+ public function setPaymentMethodToken ($ value )
42
+ {
43
+ return $ this ->setParameter ('token ' , $ value );
44
+ }
45
+
46
+ /**
47
+ * @param array $options
48
+ *
49
+ * @return \Omnipay\Common\Message\AbstractRequest
50
+ */
51
+ public function setOptions (array $ options = array ())
52
+ {
53
+ return $ this ->setParameter ('paymentMethodOptions ' , $ options );
54
+ }
39
55
}
You can’t perform that action at this time.
0 commit comments