To generate your public key in the Sandbox environment, use the following command:
curl -X PUT \
https://sandbox.api.assinaturas.pagseguro.com/public-keys \
-H "Authorization: Bearer YOUR_TOKEN"
Then, to retrieve the created key and get the publicKey value, run:
curl -X GET \
https://sandbox.api.assinaturas.pagseguro.com/public-keys \
-H "Authorization: Bearer YOUR_TOKEN"
Replace YOUR_TOKEN with your access Bearer Token. In the JSON response, copy the full
publicKey content and paste it in the field below.
More details at Create Public Key - PagBank.