x

Oauth access token connect to a customer

In my application, I have customer signup, create a customer profile (createCustomer)  and store their card (createCustomerCard) in Square and then ask them to connect their seller account to  Oauth for a seller marketplace.

How can I tie the access token returned from OAuth to a customer?  I received back the fields: access_tokentoken_typemerchant_idrefresh_token. 

 

Is there a way to pass a Customer ID in Oauth to be returned with the access token? 

1,579 Views
Message 1 of 5
Report
4 REPLIES 4
Admin

 

@adia

 

If you want your application to OAuth merchants, you won't need to create a customer, just OAuth them. The merchant_id is what ties an access token to a particular merchant. This will allow you to call API endpoints on the merchant’s behalf. Then, you can create customers for merchants.

 

Hope that makes sense, let me know if you have further questions.

kellyj
Technical Program Manager: AI
Square Inc
1,518 Views
Message 2 of 5
Report

Thank you @kellyj 

 

Once I have the access_token it looks like I could call v1/me to retrieve the business information? I may be able to use that information to create a customer profile. Does the access_token provided allow legacy v1/ endpoints to be used? I'm trying this in the sandbox. 

 

I have users signup to my marketplace application and create a profile, then they can Oauth their square account later. I'm not clear how I can use any of the information returned by Obtaining the token or retrieving the business information to tie it to their account in my application. Is it acceptable to add a customer ID to the optional state query param?

 

 

1,508 Views
Message 3 of 5
Report
Square Community Moderator

@adia

 

Yes, it should work.Someone on the merchant-side would need to enter a CC info of course, and the payment form would need to be tied to the developer’s account, not the merchant’s account. For a subscription solution that could send the merchant to a payment form -> save the card on file for your Developer account, and charge it on a monthly basis (this is charging the merchant’s card).   

Kassi
Community Moderator, Square
Sign in and click Mark as Best Answer if my reply answers your question.
1,483 Views
Message 4 of 5
Report

Thank you!

1,468 Views
Message 5 of 5
Report