Comunidade

Ask a Question
Back to All

Criar planos para assinaturas API só retorna NULL

estou usando php e preciso criar o plano pela api
estou usando a url
https://ws.sandbox.pagseguro.uol.com.br/pre-approvals/request/?email='.$this->email.'&token='.$this->token;

enviando os dados

"reference" => $plano['code'],
"preApproval" => [
"name" => $plano['nome'],
"charge" => "AUTO",
"period" => "MONTHLY",
"amountPerPayment" => $plano['valor'],
"expiration" => ["value" => 12,"unit" => "1 year"],
"details" => "plano criado pelo sistema",
]

a api so me retorna NULL

quando tento pelo GuzzleHttp

$data = [
//"redirectURL" => "string",
"reference" => 'sfasd24dfd',
"preApproval" => [
"name" => 'plano de teste',
"charge" => "AUTO",
"period" => "MONTHLY",
"amountPerPayment" => 99.99,
"expiration" => ["value" => 12,"unit" => "1 year"],
"details" => "plano criado pelo sistema",
],
"receiver" => ["email" => $email]
];

returna

Uncaught GuzzleHttp\Exception\ClientException: Client error: POST https://ws.sandbox.pagseguro.uol.com.br/v2/pre-approvals/request/[email protected]&token=E29E40515F1E46F3ADA68E24DCDE1E8E resulted in a 406 Not Acceptable response: JBossWeb/2.0.1.GA - Error report

<style>
<!--H1 {font-family:Tahoma,Arial,sans-serif;color:whit (truncated...)
</style>