File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -253,7 +253,20 @@ public function getData()
253253 $ data ['transactions ' ][0 ]['item_list ' ]["items " ] = $ itemList ;
254254 }
255255
256- if ($ this ->getCardReference ()) {
256+ if ($ this ->getCardReference () && substr ($ this ->getCardReference (), 0 , 2 ) === 'B- ' ) {
257+ // Card references can be for a billing agreement (format B-....) or a stored card format CARD-...
258+ // here billing agreement
259+ // https://developer.paypal.com/docs/limited-release/reference-transactions/#use-a-reference-transaction-to-make-a-payment
260+ $ this ->validate ('amount ' );
261+ $ data ['payer ' ]['funding_instruments ' ][] = array (
262+ 'billing ' => array (
263+ 'billing_agreement_id ' => $ this ->getCardReference (),
264+ ),
265+ );
266+ $ data ['payer ' ]['payment_method ' ] = 'paypal ' ;
267+ } elseif ($ this ->getCardReference ()) {
268+ // stored card
269+ //https://developer.paypal.com/docs/integration/direct/vault/#pay-with-vaulted-card
257270 $ this ->validate ('amount ' );
258271
259272 $ data ['payer ' ]['funding_instruments ' ][] = array (
You can’t perform that action at this time.
0 commit comments