You can currently use the /vault API to store credit card details
with PayPal instead of storing them on your own server. After storing
a credit card, you can then pass the credit card id instead of the
related credit card details to complete a payment.
public createCard ( array $parameters = [] ) : Omnipay\PayPal\Message\RestCreateCardRequest | ||
$parameters | array | |
return | Omnipay\PayPal\Message\RestCreateCardRequest |
public function testPayWithSavedCard() { $this->setMockHttpResponse('RestCreateCardSuccess.txt'); $response = $this->gateway->createCard($this->options)->send(); $cardRef = $response->getCardReference(); $this->setMockHttpResponse('RestPurchaseSuccess.txt'); $response = $this->gateway->purchase(array('amount' => '10.00', 'cardReference' => $cardRef))->send(); $this->assertTrue($response->isSuccessful()); $this->assertEquals('44E89981F8714392Y', $response->getTransactionReference()); $this->assertNull($response->getMessage()); }