square checkout duplicating users

365 Views Asked by At

I'm using square checkout to create a payment screen

$checkout = new \SquareConnect\Model\CreateCheckoutRequest();   
$checkoutUrl = $result->getCheckout()->getCheckoutPageUrl();

I successfully get the lineitems and taxes, names and prices etc. We pass along the users email address and name to this endpoint which appear on the checkout screen successfully.

In my app users can create accounts which also create square customers, we store the customer ID in our data base.

When I make a payment I am redirected to a page on my website:

$checkout->setRedirectUrl("https://www.example.net/order-complete");

I receive the get variables successfully.

** Note: I have turned off Instant profiles!

The transaction creates a NEW Customer duplicate in the square POS back end instead of tying the transaction to the email address we provided.

This creates a new user ID which means we can't link the items a user orders together because each order creates a new user.

Why is this? How do I tie an order to a user????

Do I need to create the customer order pages and manually create the order using:

$api = createChargeRequest();

Thank you, this is driving me mad that you cannot get the checkout to tie the order to a customer. I have searched websites and documentation but can find nothing except instant profiles, which have been disabled.

1

There are 1 best solutions below

6
sjosey On

Currently the Checkout API does not check for customer duplicates and will always create a new customer based on the information provided.

For more control over your customer creation, you should look into the Square Payment Form and Transactions API, which would allow you to create your own credit card form, and attach a customer to the payment (ie if they already exist, you can look up their customer_id and pass it along the request).