x

How to create customer card using REST API.

Hi,

We had a client requirement where we had to create customer in Square and save back the square customer id in Salesforce (or any other system). We have done this successfully by reading Square Doc. But we got stuck when we started creating customer cards just because while creating customer card we need nonce and the nonce as per the Square doc only created through the "Square Payment Form" it is very strange because we are doing all the thing in backend(Apex code) but only for the nonce we had to create the VF page(web page) only to generate the nonce. So that we can save customer card. But there was one more challenge we had because "Square Payment Form" uses JS SDK and in Salesforce we were using apex to create customer using Square Customer API so we were not able to call the VF page from the apex. But after searching and spending some time we find the way to call VF page from apex. but again we got stuck in JS because when we call VF page from apex in salesforce the JS does not run/execute maybe because we are running/calling the VF page from server(Apex code). So after spending much more time our efforts did not get result just because Square only provide nonce through "Square Payment Form". 

 

 

440 Views
Message 1 of 2
Report
1 REPLY 1
Alumni

You are correct in that we do require the Square Payment Form for a customer to manually enter their card data to generate a nonce, @David001. However, our API specialist who I ran this by is personally not familiar with Apex, or "VF page".

 

Are you seeing any errors within your browser console on the Square payment form?

Valentina
Community Moderator, Square
Sign in and click Mark as Best Answer if my reply answers your question.
426 Views
Message 2 of 2
Report