Cashapp integration question using SDK

Hello Team,

The CashApp integration example is very useful. However, I think there is a major gap in the recommended solution for cashApp integration offered via Square Web Payment SDK.

Use case:

  1. User starts checkout $baseUrl/cart and selects CashApp button on Mobile.

  2. At this time, the square.paymentRequest gets called. Its worth noting that the response from this methods is too generic and it has an ID. However, there is no API that can take this id and return any response about what happened to that req at later point in time.
    Question 1: It would be helpful to get a confirmation on this please ?

  3. User jumps on CashApp app on the phone via deep link, authorizes, and gets redirected to redirect url set in the CashApp obj. e.g: lets say I can set it to same $baseUrl/cart or $baseUrl/complete-checkout. Its worth noting that when redirect happens the url gets appended with a query param cash_app_req_id=.

  4. So now the redirected url page loads and this causes the onTokenization event listener object to be flushed out. The hack would be to detect redirect from CashApp and stop reloading page and try to hold that onTokenization event listener active so that the onTokenization event gets consumed for the token to complete the payment. But its an hack. [Pls know that my web app is in React]

What I am wanting to do is a clean solution which is a classic flow pattern in any checkout as follows:

  1. Init the req. Get an id. Hold it or populate in the redirect url.

  2. After receving the redirect, consume the IDs. i.e %baseUrl/complete-checkout?cash_req_id=<>&myChkoutId=<>

  3. Look up details for the pay_req_id using like below and upon success, create order.
    Retrieve request | Cash App API
    Create payment | Cash App API

function handleCheckoutComplete(){
const myChekoutDetails = fetchCheckout(myChkoutId);
const {status, grantId, token} = getReqDetails(id);
if(status === ‘success’){
const resp = createPayment(token);
if(resp.status === OK){

const {orderId = }createOrder(myChekoutDetails.id, );
router.push(orderId)
}
}
}

So its very clear that direct CashApp integration is the solution I need, but the onboarding process isnt clear.

Questions:

  1. Can someone validate the limitation about event listener approach and its flakiness please ?
  2. Are there alternative approaches using square SDK itself that I am missing ?
  3. Where can i fill the in take information to integration with CashApp directly pls ? What is the partner team email ?

Thank You,
Krishna
TBD Health

With Cash app Payment Request is a client-side concept that is used by multiple payment methods (e.g., Apple Pay, Google Pay, Cash App Pay). It is not persisted and does not relate to any server API interactions.

There’s no need to hack anything. Our SDK is designed with this redirect case in mind. For React, a useEffect hook could be used to add the event listener and update the component’s state with anything received.

At this time there isn’t any alternative solutions available. We’re constantly working to improve our features based on feedback like this, so I’ll be sure to share your request to the API product team. :slightly_smiling_face: