Create a payment using ‘Shared cards on File’ Unauthorized to use this card” error

I tried “Create Payment” with a"shared card on file" using the method described on this page in a sandbox environment, but an error occurred .
{
“errors”: [
{
“code”: “FORBIDDEN”,
“detail”: “Unauthorized to use this card”,
“field”: “source_id”,
“category”: “AUTHENTICATION_ERROR”
}
]
}

I changed some region values to match Japan, but I executed curl with almost the same content as in the example.
I attach request and response logs. I hope you find some in the logs.

I posted the same content on discord.
I wish you check it again.

Thanks.

:wave: I’m Square Dev AI, here to help answer your question!
Based on the information you’ve provided, the following documentation will help answer your question:

Additional Documentation

Card Payments
Cards API Overview
Create a Card on File and a Payment

If this documentation helped you find a solution, please check the box indicating that this reply solves the problem.
Otherwise one of our Developer Advocates will provide additional assistance shortly.

The error message “Unauthorized to use this card” indicates that the card you’re trying to use for the payment is not authorized for use. This could be due to several reasons such as the card not being properly saved on file, the card being expired or invalid, or the card not having the necessary permissions for use.

In the context of a shared card on file, it’s important to note that the card must be properly saved and linked to the customer in both the developer account and the seller account. Also, the seller account must grant the necessary permissions to the developer account to use the shared card.

If you’re testing in the Sandbox environment, make sure you’re using the correct Sandbox test values for the card. Also, ensure that you’re using the correct access token for the account you’re trying to make the payment from.

If you’ve checked all these and the issue persists, it might be a good idea to try creating a new card on file and attempting the payment again.

This answer was reviewed by @Bryan-Square.