Moving from WorldPay to Square

Hi, I am moving a client from WorldPay hosted payment pages to Square and I am struggling; I am a programmer but normally leave software installations to our host company - however they won’t help with Square. We are using PHP on a Linux virtual server.

From what I understand the first step is to get web-payments-quickstart working:

First question is : is this correct?

Assuming it is, I have finally managed to get npm upgraded so that everything installs and have fixed all warnings and dependencies, however when I type npm test I get:

Error loading configuration: Errors: ENOENT: no such file or directory, open ‘.env.sandbox’

npm run dev was working after the install allbeit with a warning about the missing ENOENT but is now saying: sh: micro-dev: command not found

Any pointers? Feel like I’m going round in circles and getting nowhere fast.

:wave: You are correct. You’ll need to use the Web Payments SDK. While you can continue to use the Quickstart we do have an example of the Web Payments SDK in PHP.

If you are going to continue to work with the quickstart what changes did you make from the last time it worked to now? :slightly_smiling_face:


Hi Bryan - ah, so I don’t need to get the quickstart working if I use the Web Payments SDK in PHP - that handles everything? If yes, it makes sense to concentrate on that - is there an idiots guide to getting it up and running?

Yeah, the is really straight forward. :slightly_smiling_face:

Hi, back working on this again.
I have successful installed the PHP SDK and used ListLocations with the sandbox.
To accept online payments do I now need to install the Web Payments SDK in PHP or would that have been installed as part of the PHP SDK? What about things like the Customers API - is that included in the PHP SDK?

You’ll need to install the Web Payments SDK to process payment with the PHP SDK. We do have an example in PHP.

Also the PHP SDK does include the Customers API. :slightly_smiling_face:

Perfect - thank you - have a good weekend!

I’m using the PHP web payments example and am getting the following errors; most are self explanatory but can you shed any light on the 499 errors please; I am using the sandbox at the moment.

Looks the form fields didn’t render. Are you using localhost or is this a custom host? If so is it HTTPS? :slightly_smiling_face:

It’s a live 20i hosted site; the form fields initially didn’t render at all as it wasn’t https but it is now and I can see some form fields such as the Full Name …

UPDATE: Just refreshed and all fields are there now with no errors - must have been a cloud catch up issue - cheers

Hi Bryan; 2 minor issues remain.

#1 The customer does not currently want to use anything other than debit/credit card so I have removed the bank account and Google Pay / Apple Pay lines from the form and commented out the associated java script modules; however the payment flow java script is complaining:

Uncaught (in promise) ReferenceError: ApplePay is not defined
at SquarePaymentFlow (sq-payment-flow.js:7:3)
at sq-payment-flow.js:92:1

Is this an issue or is there something different I need to do?

#2 If I use a test card, e.g. 4111 1111 1111 1111 it asks for a zip code but if I enter a valid UK credit card it doesn’t ask for a postcode - is this because I am using the sandbox?

No need to worry about that warning if the form is rendering correctly and processing the payments.

Also the card payment method of the Web Payments SDK automatically infers whether to display the postal code and copy (ZIP code, postal code, or postcode) based on the issuing country of the buyer’s credit card. Depending on the card that’s used, the SDK automatically removes the postal code if the card’s issuing country does not require the postal code for the payment. :slightly_smiling_face: