diff --git a/client/tokenized-payment-request/cart-api.js b/client/tokenized-payment-request/cart-api.js index 4f1e90e42c3..24603fc5132 100644 --- a/client/tokenized-payment-request/cart-api.js +++ b/client/tokenized-payment-request/cart-api.js @@ -103,14 +103,14 @@ export default class PaymentRequestCartApi { * * @return {Promise} Cart response object. */ - async createAnonymousCart() { + async createSeparateCart() { const response = await this._request( { method: 'GET', path: '/wc/store/v1/cart', // parse: false to ensure we can get the response headers parse: false, headers: { - // sending an empty value, so that the custom session handler is leveraged. + // sending an empty value, so that the custom session handler is leveraged to create a separate cart. 'X-WooPayments-Tokenized-Cart-Session': '', }, } ); diff --git a/client/tokenized-payment-request/payment-request.js b/client/tokenized-payment-request/payment-request.js index 00b48f68df3..5e1d0c10d49 100644 --- a/client/tokenized-payment-request/payment-request.js +++ b/client/tokenized-payment-request/payment-request.js @@ -121,7 +121,7 @@ export default class WooPaymentsPaymentRequest { // so that we don't affect the products in the main cart. // On cart, checkout, place order pages we instead use the cart itself. if ( getPaymentRequestData( 'button_context' ) === 'product' ) { - await this.paymentRequestCartApi.createAnonymousCart(); + await this.paymentRequestCartApi.createSeparateCart(); } const paymentRequestButton = this.wcpayApi @@ -432,7 +432,7 @@ export default class WooPaymentsPaymentRequest { // to avoid scenarios where the stock for a product with limited (or low) availability is added to the cart, // preventing other customers from purchasing. const temporaryCart = new PaymentRequestCartApi(); - await temporaryCart.createAnonymousCart(); + await temporaryCart.createSeparateCart(); const cartData = await temporaryCart.addProductToCart(); diff --git a/client/tokenized-payment-request/test/cart-api.test.js b/client/tokenized-payment-request/test/cart-api.test.js index d4dca34dc62..9972e79af9e 100644 --- a/client/tokenized-payment-request/test/cart-api.test.js +++ b/client/tokenized-payment-request/test/cart-api.test.js @@ -38,7 +38,7 @@ describe( 'PaymentRequestCartApi', () => { const api = new PaymentRequestCartApi(); const anotherApi = new PaymentRequestCartApi(); - await api.createAnonymousCart(); + await api.createSeparateCart(); expect( apiFetch ).toHaveBeenCalledWith( expect.objectContaining( {