|
| 1 | +# Card vaulting & vaulted checkout: testing notes |
| 2 | + |
| 3 | +Vaulting tests need PayPal's "**save payment methods**" test cards, which are **not |
| 4 | +interchangeable** with the "purchase flow" cards. Using the wrong table is the most common mistake |
| 5 | +here. |
| 6 | + |
| 7 | +## Sandbox setup |
| 8 | + |
| 9 | +To exercise the 3DS path at all, set the plugin's **3D Secure** option to **ALWAYS**. The sandbox |
| 10 | +does not require 3DS by default, so with any other setting the test cards below authenticate without |
| 11 | +triggering the flow you want to test. |
| 12 | + |
| 13 | +## 3DS modes |
| 14 | + |
| 15 | +3D Secure authentication has two possible behaviors. Both must work identically; the only difference |
| 16 | +is whether the shopper has to enter an OTP. |
| 17 | + |
| 18 | +| | Frictionless ("no challenge") | Step-up ("challenge") | |
| 19 | +|------------------|-------------------------------------------|--------------------------------------| |
| 20 | +| **What it is** | No user input; the bank approves silently | A manual OTP step is required | |
| 21 | +| **New card** | Overlay closes itself after a few seconds | Overlay expands into an OTP form | |
| 22 | +| **Vaulted card** | Redirects out, then back to the shop | Redirects out, returns after the OTP | |
| 23 | + |
| 24 | +- "New card" = entering card details at checkout or adding one in My Account. |
| 25 | +- "Vaulted card" = paying with a saved card at checkout. |
| 26 | +- "Checkout" = Block checkout or Classic checkout, both are identical in this aspect. |
| 27 | + |
| 28 | +## Cards to use for vaulting tests |
| 29 | + |
| 30 | +Current "Save payment methods" table (expiry = `01/current year + 3`). |
| 31 | + |
| 32 | +| Network | Frictionless | Step-up | |
| 33 | +|------------|--------------------|--------------------| |
| 34 | +| Visa | `4000000000002701` | `4000000000002503` | |
| 35 | +| Mastercard | `5200000000002235` | `5200000000002151` | |
| 36 | + |
| 37 | +Do **not** use purchase-flow cards (e.g. `4868719196829038`, `4868719166101368`, |
| 38 | +`5329879707824603`) for vaulting. They mint a token that looks valid (every request returns `2xx`), |
| 39 | +but the later charge fails with a very visible `403 PERMISSION_DENIED`. |
| 40 | + |
| 41 | +## References |
| 42 | + |
| 43 | +- [Cards for "Save payment methods"](https://developer.paypal.com/docs/checkout/advanced/customize/3d-secure/test/#test-cases-and-card-details-for-save-payment-methods) ← |
| 44 | + *what we need for vaulting!* |
| 45 | +- [Cards for "Purchase flow"](https://developer.paypal.com/docs/checkout/advanced/customize/3d-secure/test/#test-cases-and-card-details-for-purchase-flows) - |
| 46 | + *not usable for vaulting, added for distinction* |
| 47 | + |
| 48 | +## Test coverage |
| 49 | + |
| 50 | +The 3DS authentication itself runs in the browser SDK and on PayPal's servers, so the end-to-end |
| 51 | +save + 3DS + charge flow can only be verified **manually** (real browser, with the sandbox setup and |
| 52 | +save-flow cards above). A live-API integration test would be non-deterministic. |
| 53 | + |
| 54 | +The surrounding plugin logic is covered by automated tests that mock the PayPal HTTP boundary and |
| 55 | +assert what our code sends and does with responses: |
| 56 | + |
| 57 | +- [Integration: VaultedCard3dsTransactionTest.php](../tests/integration/PHPUnit/Transaction/VaultedCard3dsTransactionTest.php): |
| 58 | + resume-nonce / capture / authorize state machine (uses a `payer-action` link to represent |
| 59 | + "3DS required"). |
| 60 | +- [Integration: WooCommercePaymentTokensTest.php](../tests/integration/PHPUnit/Vaulting/WooCommercePaymentTokensTest.php): |
| 61 | + response → `WC_Payment_Token_CC` persistence. |
| 62 | +- [Unit: CaptureCardPaymentTest.php](../tests/PHPUnit/WcGateway/Endpoint/CaptureCardPaymentTest.php): |
| 63 | + vaulted-charge order-body construction. |
| 64 | +- [Unit: CreateSetupTokenTest.php](../tests/PHPUnit/SavePaymentMethods/Endpoint/CreateSetupTokenTest.php) |
| 65 | + and [Unit: CreatePaymentTokenTest.php](../tests/PHPUnit/SavePaymentMethods/Endpoint/CreatePaymentTokenTest.php): |
| 66 | + vault-token setup-request body and exchange-response handling. |
0 commit comments